甲骨文秩函数
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了甲骨文秩函数相关的知识,希望对你有一定的参考价值。
A few examples of the RANK function.
--1 Basic SELECT RANK(200) WITHIN GROUP (ORDER BY fees_paid) AS rank_val FROM student; --2 Different value, duplicate SELECT RANK(150) WITHIN GROUP (ORDER BY fees_paid) AS rank_val FROM student; --3 Different value, duplicate, but second column SELECT RANK(150, 'Minson') WITHIN GROUP (ORDER BY fees_paid, last_name) AS rank_val FROM student; --4 Nulls first SELECT RANK(150) WITHIN GROUP (ORDER BY fees_paid NULLS FIRST) AS rank_val FROM student; --5 Name but order by value - error SELECT RANK('Tom') WITHIN GROUP (ORDER BY fees_paid) AS rank_val FROM student; --6 Name sorting SELECT RANK('Steven') WITHIN GROUP (ORDER BY first_name) AS rank_val FROM student; --7 Name that does not exist SELECT RANK('Brad') WITHIN GROUP (ORDER BY first_name) AS rank_val FROM student; --Analytical Functions --8 Basic - partition by gender SELECT student_id, first_name, last_name, gender, fees_paid, RANK() OVER (PARTITION BY gender ORDER BY fees_paid) AS rank_val FROM student; --9 Basic - partition by fees paid SELECT student_id, first_name, last_name, gender, fees_paid, RANK() OVER (PARTITION BY fees_paid ORDER BY last_name, first_name) AS rank_val FROM student; --10 No partition SELECT student_id, first_name, last_name, gender, fees_paid, RANK() OVER (ORDER BY fees_paid) AS rank_val FROM student;
以上是关于甲骨文秩函数的主要内容,如果未能解决你的问题,请参考以下文章
Matlab signrank 函数中的矛盾结果(Wilcoxon 符号秩检验)[重复]