您的位置:首页 > 数据库

sql

2013-11-24 10:00 330 查看
select *

from teacher

where ((ttitle='教授')or(year(getdate())-year(tbirthday))>50 )and tsex='女'

select *

from teacher

where year(tbirthday)>1975 and year(tbirthday)<1980

select *

from teacher

where not(tbirthday between '1975-1-1' and '1980-12-31')

select *

from teacher

where year(tbirthday)!>1975 or year(tbirthday)!<1980

select *

from teacher

where not(year(tbirthday)>1975 and year(tbirthday)<1980)

select *

from student

where classno in ('07010111', '07010211')

select top 11 sname

from student

where(sname not in(select top 9 sname from student))

select sname from student

union

select tname from teacher

select *

from student

where sno like '07%_5'

select *

from student

where sno like '07%5'

select *

from teacher

where tname like '张%' or tname like '李%' or tname like '王%'

select *

from course

where cname='VFP_6.0数据库'

select ttitle 职称,count(*) 人数

from teacher

group by ttitle

/*练习*/

select classno, count(*) 人数

from student

group by classno

select ssex, count(*) 人数

from student

group by ssex

select pno, count(*) 班级数目

from class

group by pno

select deptno, count(*) 专业数目

from professional

group by deptno

select year(sbirthday) 年份, count(*) 学生人数

from student

group by year(sbirthday)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: