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