这个数据库查询语句怎么写,有图

来源:百度知道 编辑:UC知道 时间:2024/06/07 10:56:56
查询同时选修了1号和2号课程的学生学号。这个怎么写的

select a.sno
from (select * from 表名 where cno=1) a,
(select * from 表名 where con=2) b
where a.sno=b.sno

select dist(SNO) from table where CNO=1 and CNO=2;
大概这样了,上面的dist好象不对,你注意下。这个表怎么没主键的。

Select A.SNO From 表 A, 表 B Where A.SNO=B.SNO And A.CNO='1' And B.CNO='2'