練習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