access中的一个SQL语句(急)

来源:百度知道 编辑:UC知道 时间:2024/07/06 15:34:32
表名:deptment
字段名称 数据类型 字段说明 备注
dpno Int 整型 系别号 主键
dpname char(20) 系别名

表名:S(学生表)
字段名称 数据类型 字段说明 备注
sno 数字 学号 主键
sname 文本 姓名
sbirth 文本 籍贯
sdept 数字 系别号

统计每个系(系名)学生的人数。
用SQL语句查询

哈哈,50分,你的问题也太简单了吧!

select dpname , (select count(*) from s where sdept=dpno) as studentCount from deptment

select a.dpname as 系别名,count(*) as 人数
from deptment a,s b
where a.dpno=b.sdept
group by a.dpname

select deptment.dpname,count(S.sno)
from deptment,S
where deptment.dpno = s.dpname
group by deptment.dpname
order by deptment.dpname

select count(s.sdept ) from deptment,s where deptment.dpno=s.sdept group by s.sdept