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


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

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

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

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/18


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM