ok.
就是比如说S003学了2门课(CNO)(当然不一定是2门咯),要查询学过这2门课的学生的学生号(SNO)

解决方案 »

  1.   

    select sno from sc where cno in (  select cno from sc where  sno in(  select  sno from  sc where cno='s003'))
      

  2.   

    哦,那个S003是SNO(学号),不是课程号
      

  3.   

    select sno from sc where cno in (select cno from c inere join sc on c.cno=sc.cno
    where c.sno='s003')
      

  4.   

    select distinct x.sno, x.sname from t_s as x, t_sc as y
    where
    (
    (select count(*) from t_sc as z where z.sno = x.sno ) >=
    (select count(*) from t_sc where t_sc.sno = 's003') and x.sno <> 's003'
    )