查询学过「张三」老师授课的同学的信息
多表联合查询
and(和)
第一种:
命令:select ex_xueshengbiao_95.Sid,ex_xueshengbiao_95.Sname,ex_xueshengbiao_95.Sage,ex_xueshengbiao_95.Ssex
from ex_xueshengbiao_95,ex_kechengbiao_95, ex_jiaoshibiao_95,ex_chengjibiao_95
where ex_kechengbiao_95.Tid=ex_jiaoshibiao_95.Tid
and ex_kechengbiao_95.Cid=ex_chengjibiao_95.Cid
and ex_chengjibiao_95.Sid=ex_xueshengbiao_95.Sid
and ex_jiaoshibiao_95.Tname=‘张三‘
(2)第二种
命令:select * from ex_xueshengbiao_95
where Sid in (select Sid from ex_chengjibiao_95
where Cid in (select Cid from ex_kechengbiao_95
where Tid in (select Tid from ex_jiaoshibiao_95
where Tname=‘张三‘)))
mysql查询(七)
原文地址:https://www.cnblogs.com/zgqbky/p/13427386.html