如果s3 为学生学号:
select s from sc where c in(select c from sc where s='s3')

解决方案 »

  1.   

    select distinct s from sc a
    where not exists(select 1 from sc where s='s3' and  c not in
    (select c from sc b where a.s=b.s))
      

  2.   

    --try
    select s
    from sc
    where exists
    (select 1 from sc,(select c,count(*) as ccount
    from sc where s='s3'
    group by c) Tc
    where c=Tc.C and having cont(*)=TC.ccount)
    )
      

  3.   

    select s from sc
    where c in (select c from sc where s='s3')
    group by s having count(s)=(select count(c) from sc where s='s3')
      

  4.   

    select distinct s from sc A
    where s in (select s from sc where s='s3' and c not in(select c from sc B where A.s=B.s))