练习7--查询没学过"张三"老师讲授的任一门课程的学生姓名


-- 查询没学过"张三"老师讲授的任一门课程的学生姓名 

select
    s_name
from
    student
where
    s_id not in (
    select
        distinct s_id
    from
        score
    where
        c_id in (
            select t2.c_id
        from
            teacher t1,
            course t2
        where
            t1.t_id = t2.t_id
            and t1.t_name = '张三'))
select
    a.s_name
from
    student a
where
    a.s_id not in (
    select
        s_id
    from
        score
    where
        c_id = (
            select c_id
        from
            course
        where
            t_id =(
            select
                t_id
            from
                teacher
            where
                t_name = '张三'))
    group by
        s_id);

 

-- 2019/04/24


免责声明!

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



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