Oracle稠密秩函数
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle稠密秩函数相关的知识,希望对你有一定的参考价值。
A few examples of the DENSE_RANK function.
/* DENSE_RANK */ SELECT * FROM student ORDER BY fees_paid; --Example 1 SELECT DENSE_RANK(100) WITHIN GROUP (ORDER BY fees_paid) AS rank_val FROM student; --Example 2 SELECT DENSE_RANK(150) WITHIN GROUP (ORDER BY fees_paid) AS rank_val FROM student; --Example 3 SELECT DENSE_RANK(150, 'Minson') WITHIN GROUP (ORDER BY fees_paid, last_name) AS rank_val FROM student; --Example 4 SELECT DENSE_RANK(150) WITHIN GROUP (ORDER BY fees_paid NULLS FIRST) AS rank_val FROM student; --Example 5 SELECT DENSE_RANK('Julie') WITHIN GROUP (ORDER BY fees_paid) AS rank_val FROM student; --Example 6 SELECT DENSE_RANK('Julie') WITHIN GROUP (ORDER BY first_name) AS rank_val FROM student; --Example 7 SELECT DENSE_RANK('Boris') WITHIN GROUP (ORDER BY first_name) AS rank_val FROM student; SELECT * FROM student; UPDATE student SET gender = 'F' WHERE first_name IN ('Susan', 'Julie', 'Michelle', 'Tanya'); UPDATE student SET gender = 'M' WHERE gender IS NULL; --Example 8 SELECT student_id, first_name, last_name, gender, fees_paid, DENSE_RANK() OVER (PARTITION BY gender ORDER BY fees_paid) AS rank_val FROM student; --Example 9 SELECT student_id, first_name, last_name, gender, fees_paid, DENSE_RANK() OVER (PARTITION BY fees_paid ORDER BY last_name, first_name) AS rank_val FROM student; --Example 10 SELECT student_id, first_name, last_name, gender, fees_paid, DENSE_RANK() OVER (ORDER BY fees_paid) AS rank_val FROM student; --Example 11 SELECT student_id, first_name, last_name, gender, fees_paid, RANK() OVER (PARTITION BY gender ORDER BY fees_paid) AS rank_val, DENSE_RANK() OVER (PARTITION BY gender ORDER BY fees_paid) AS dense_rank_val FROM student;
以上是关于Oracle稠密秩函数的主要内容,如果未能解决你的问题,请参考以下文章
如何在 Toad for Oracle 中使用自定义代码片段?
seaborn使用violinplot函数可视化小提琴图使用swarmplot函数添加抖动数据点(jittered points)显示数据的稠密程度
seaborn使用violinplot函数可视化小提琴图并在violinplot函数中设置inner参数来添加数据点显示数据的稠密程度