该语句实现的路径应该是 Grade 表, Course 表中可能有某门课,一个学生都没有选修的。
所以不能是查询 Course 表的 Cno。
② 找出 01311 班女学生的个人信息;
select * from student
where Ssex = '女' and clno = '01311' ;
③ 找出 01311 班、01312 班的学生、性别、出生年份;
select Sname,Ssex,2012- Sage as birth
from student
where clno = '01311' or clno = '01312';
OR:
select Sname,Ssex,2012- Sage as birth
from student
where clno in('01311', '01312');
OR:(在 T-SQL 中,超大纲了,呵呵)
Select sname,sex,year(getdate())-sage
From student
Where clno in (‘01311’,’01312’);
④ 找出所有姓李的学生的个人信息;
select * from student
where Sname like '李%';
⑤ 找出学生李勇所在班级的学生人数;
Select count(*) from student
Where clno in (Select clno from student
Where sname=”李勇”);
Or: Select number from class