有一学生成绩表内容如下:
id name score1001 张三 95
1002 李四 70
1005 王五 85
1008 刘二 85
1010 李刚 59学生成绩排名后如下:
id name score 排名
1001 张三 95 1
1005 王五 85 2
1008 刘二 85 2
1002 李四 70 3
1010 李刚 59 4求查询语句,本人是菜鸟,多谢各位大大 帮忙!
id name score1001 张三 95
1002 李四 70
1005 王五 85
1008 刘二 85
1010 李刚 59学生成绩排名后如下:
id name score 排名
1001 张三 95 1
1005 王五 85 2
1008 刘二 85 2
1002 李四 70 3
1010 李刚 59 4求查询语句,本人是菜鸟,多谢各位大大 帮忙!
解决方案 »
- Oracle连接问题
- 导入表department表PL/SQL Developer中汉字正常,BCB开发软件查询乱码 在线等。。
- 提供一个好地方
- 分页存储过程执行时报错,请大家帮忙看看。
- 用数组作为oracle参数该怎么写?
- EM服务正常但启动dbconsole后firefox却显示无法打开
- 如何在查询语句中,得到两个日期字段相差的小时数??
- 在Oracle中SQL的时间表达CreateTime>=2004-6-1 00:00:01 AND CreateTime<=2004-6-30 23:59:59 错在哪时里?
- 关于oracle中的系统表
- 急求救:这个过程为什么出错啊
- 求 日期格式问题
- 求助:关于oracle10g中文乱码问题
select id,name,score,row,dense_rank()over(order by score) from tablename ;
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as SYS
SQL>
SQL> with student as
2 (
3 select 1001 id, '张三' name,95 score from dual union all
4 select 1002 ,'李四' ,70 score from dual union all
5 select 1005 ,'王五', 85 score from dual union all
6 select 1008, '刘二', 85 score from dual union all
7 select 1010 ,'李刚', 59 score from dual
8 )
9 select id ,name,score,dense_rank()over(order by score desc) from student
10 / ID NAME SCORE DENSE_RANK()OVER(ORDERBYSCORED
---------- ---- ---------- ------------------------------
1001 张三 95 1
1005 王五 85 2
1008 刘二 85 2
1002 李四 70 3
1010 李刚 59 4SQL>
已写入 file afiedt.buf 1 with tb as(
2 select 1001 id,'张三' name, 95 score from dual
3 union all
4 select 1002,'李四',70 from dual
5 union all
6 select 1005,'王五',85 from dual
7 union all
8 select 1008,'刘二',85 from dual
9 union all
10 select 1010,'李刚',59 from dual)
11 select id,name,score,dense_rank() over (order by score desc) 排名
12* from tb
SQL> / ID NAME SCORE 排名
---------- ---- ---------- ----------
1001 张三 95 1
1005 王五 85 2
1008 刘二 85 2
1002 李四 70 3
1010 李刚 59 4