笔试的时候在数据库里碰到这个问题的次数最多;
平时在看相关PHP的书本的时候这种练习较少,实际二次开发的时候因为这种复杂关系牵扯到的逻辑代码有时候较多...
1.找出没有供应零件P2的供应商的供应商名
-
SELECT DISTINCT S.SAME
-
FROM S
-
WHERE S.S# NOT IN
-
( SELECT SP S#
-
FROM SP
-
WHERE SP.P# = 'P2');
2.
-
有学生表和学生成绩表,查询“95033”班所选课程的平均分:
-
SELECT y.cno,avg(y.degree) as "平均分" FROM student x, score y
-
WHERE x.class="95033" and x.sno=y.sno GROUP by y.cno;
3.
SELECT know.title,answer.content FROM destoon_know know,destoon_know_answer answer WHERE know.itemid = answer.itemid and answer.itemid=2
阅读(3240) | 评论(0) | 转发(0) |