1001.查询管理系1990年以前出生的女生姓名、系和出生日期
select sname,sdept,csrq from student
where sdept=‘管理系’ and sex=‘女’ and year(csrq)<‘1990’
1002.查询选修了1号课或3号课成绩都大于80分的的学生的学号和成绩
select sno,grade from sc
where cno in(‘1’,‘3’) and grade>80
1003.查询信息系所有女生年龄大于21的姓名,及所在系及年龄(当前年2010,年龄用age表示)
select sname,sdept,year(date())-year(csrq) as age from student
where sex=‘女’ and sdept=‘信息系’ and (2010-year(csrq))>21
1004.查询课程名含有数据两个字的,先行课程号不为0,学分大于2的的课程的课程号、课程名和学分
select cno,cname,ccredit from course
where cname like ‘%数据%’ and cpno <>‘0’ and ccredit >2
1005.查询计算机系或信息系中年龄介于20与23之间的同学情况,不含20与23.(设当前年为2010年,提示用当前年减去出生年再与20岁,23岁比较)
select * from student
where (sdept=‘计算机系’ or sdept=‘信息系’) and (2010-year(csrq))>20 and (2010-year(csrq))<23
1006.查询名字中第3个字为玲4月4号出生的学生的姓名和学号
select sname,sno from student
where sname like ‘__玲%’ and month(csrq)=4 and day(csrq)=4
1007.查询所有名字中含有“小”的非信息系同学的的姓名和系
select sname,sdept from student
where sname like ‘%小%’ and sdept not in (‘信息系’)
1008.查询管理系所有非李姓的2009及2010级同学情况
select * from student
where sdept=‘管理系’ and sname not like ‘李%’ and (sno like ‘2009%’ or sno like ‘2010%’)
1009.查询所有出生为90后的计算机系的两字李姓同学及管理系的两字王姓同学的情况
select * from student
where year(csrq)>=1990 and((sname like ‘李_’ and sdept=‘计算机系’ ) or (sname like’王_’ and sdept=‘管理系’))
1010.请查询计算机系或文传系2011级90后4月出生的女生情况。
select * from student
where sno like ‘2011%’ and year(csrq)>=1990 and month(csrq)=4 and sex=‘女’ and (sdept =‘计算机系’ or sdept=‘文传系’)