需要再研究的题目

--40、以班号和年龄从大到小的顺序查询Student表中的全部记录。
select sno,sname,ssex,class,YEAR(GETDATE())-YEAR(sbirthday) from stu order by class desc,YEAR(GETDATE())-YEAR(sbirthday) desc

 

--28、查询“计算机系”与“电子工程系“不同职称的教师的Tname和Prof。
select * from Teacher
where (Depart = '计算机系' or Depart = '电子工程系')
and Prof in
(
select Prof from Teacher
group by Prof
having COUNT(*) <2
)

 

--38、查询Student表中每个学生的姓名和年龄。
select sname,YEAR(GETDATE())-YEAR(sbirthday)from stu
select DATEDIFF (YEAR,sbirthday,GETDATE()),*from stu

posted on 2017-06-24 16:13  homie  阅读(115)  评论(0编辑  收藏  举报