有两个表,“学生信息表”,“系信息表”
学生信息表Student:
sno: “学号”
sname:“姓名”
birth:“出生日期”
dno: “系号”
======================
系信息表Department:
dno:”系号“
dname:”系名“
===================
教师信息表 Teacher
tid: ”教师代号“
tname: ”教师姓名“
tbirth:”出生日期“
tdno: ”系号“=======写以下 sql:
1.所有学生的学号、姓名、和所在的系名
2.统计并显示每个系的系号、系名、以及每个系学生的人数
3.列出系号为3的系的所有人员的姓名和出生日期
学生信息表Student:
sno: “学号”
sname:“姓名”
birth:“出生日期”
dno: “系号”
======================
系信息表Department:
dno:”系号“
dname:”系名“
===================
教师信息表 Teacher
tid: ”教师代号“
tname: ”教师姓名“
tbirth:”出生日期“
tdno: ”系号“=======写以下 sql:
1.所有学生的学号、姓名、和所在的系名
2.统计并显示每个系的系号、系名、以及每个系学生的人数
3.列出系号为3的系的所有人员的姓名和出生日期
select s.sno,s.sname,d.dname from student s,Department d where s.dno = d.dno
2
select dno,dname,(select count(*) from student s where s.dno = D.dno) where from Department D group by dno,dname
select sname,birth from student where dno =3
union
select tname,birth from teacher where tno=3