练习4--查询"李"姓老师的数量|查询学过"张三"老师授课的同窗的信息

-- 查询"李"姓老师的数量spa

select
    count(1) from teacher where t_name like '李%'

-- 查询学过"张三"老师授课的同窗的信息code

select t1.*
from student t1, score t2 where t1.s_id = t2.s_id and t2.c_id in ( select c_id from course where t_id = ( select t_id from teacher where t_name = '张三'));

 

select a.*
from student a join score b on a.s_id = b.s_id where b.c_id in( select c_id from course where t_id =( select t_id from teacher where t_name = '张三'));

 

--2019/04/18blog

相关文章
相关标签/搜索