sql

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)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值