mysql查询
Posted 虞岩
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql查询相关的知识,希望对你有一定的参考价值。
查询学过「张三」老师授课的同学的信息
多表联合查询
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查询的主要内容,如果未能解决你的问题,请参考以下文章