码迷,mamicode.com
首页 > 数据库 > 详细

mysql查询(七)

时间:2020-08-03 18:39:20      阅读:83      评论:0      收藏:0      [点我收藏+]

标签:nbsp   and   class   http   font   src   命令   信息   rom   

查询学过「张三」老师授课的同学的信息

多表联合查询     

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查询(七)

标签:nbsp   and   class   http   font   src   命令   信息   rom   

原文地址:https://www.cnblogs.com/zgqbky/p/13427386.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!