查询学过「张三」老师授课的同学的信息
分析: 这个是很常见的多表联合查询
查询
select student.* from student,teacher,course,sc where student.sid = sc.sid and course.cid=sc.cid and course.tid = teacher.tid and tname = '张三';
结果:
+------+--------+---------------------+------+ | SId | Sname | Sage | Ssex | +------+--------+---------------------+------+ | 01 | 赵雷 | 1990-01-01 00:00:00 | 男 | | 02 | 钱电 | 1990-12-21 00:00:00 | 男 | | 03 | 孙风 | 1990-12-20 00:00:00 | 男 | | 04 | 李云 | 1990-12-06 00:00:00 | 男 | | 05 | 周梅 | 1991-12-01 00:00:00 | 女 | | 07 | 郑竹 | 1989-01-01 00:00:00 | 女 | +------+--------+---------------------+------+
以上