1.已知employee表數據如下:
EMPNO EMPNAME DEPT
Z3 張三 銷售部
L4 李四 銷售部
W5 王五 技術部
Z6 趙六 技術部
要得到如下結果:
NUM EMPNO EMPNAME DEPT
1 Z3 張三 銷售部
2 L4 李四 銷售部
1 W5 王五 技術部
2 Z6 趙六 技術部
其SQL如下:
select row_number() over(partition by dept order by empno) as num,empno,empname,dept from employee;
2.一成績表中,求出只要有一門及以上的課程不及格的同學
select sno,sname from grades group by sno having min(score) < 60;
posted on 2010-08-29 12:51
譚明 閱讀(255)
評論(0) 編輯 收藏 所屬分類:
Oracle