sql面试题

来源:百度知道 编辑:UC知道 时间:2024/05/16 10:58:31
id name subject score createdate

1.创建时间为3天前0点创建的纪录,20分钟前创建的纪录?

2.3门以上不及格学生的学生姓名?

3. id name
1 a
2 b
3 a
4 a
id为identity,只留一条a与一条b
4.总分排名5-7的学生姓名(name,score),最好写成存储过程,请注意并列排名的问题
使用oracle来实现

1、select * from table where createdate=trunc(sysdate)-3;
select * from table where createdate=(sysdate-20/1440);

2、select name from table where score<60 group by name having count(score)>2
3、你的意思是不是这个 select max(id), name from table group by name
4、select name,total score from (select name,sum(score) total from table group by name order by total desc)where rownum<8 and rownum>4