SQL记录
SELECT student.sno,sname,cname
FROM student,sc,course
WHERE sc.sno=student.sno
AND sc.cno=(SELECT cno FROM course WHERE cname='数据库')
AND sc.cno=course.cno
SELECT student.sno,sname,cname
FROM student,sc,course
WHERE sc.sno=student.sno
AND sc.cno=(SELECT cno FROM course WHERE cname='数据库')
贼有趣
1. JOIN: 如果表中有至少一个匹配,则返回行
2. LEFT JOIN: 即使右表中没有匹配,也从左表返回所有的行
3. RIGHT JOIN: 即使左表中没有匹配,也从右表返回所有的行
4. FULL JOIN: 只要其中一个表中存在匹配,就返回行
join:
select student.sno,sname,cno,grade
from sc,student
where sc.sno=student.sno
select student.sno,sname,cno,grade
from student JOIN sc
ON sc.sno=student.sno
两者的查询结果是一样的。。