向上吧,少年! 2021-03-09 14:05 采纳率: 33.3%
浏览 54

请教,我的sql语句哪里错了?

# 查询“1”课程比“2”课程成绩高的所有学生的学号;

我写的:
select a.sno from (select sno,cno,score from sc where cno=1) a, (select sno,cno,score from sc where cno =2) b where a.sno = b.sno AND a.score > b.score;

正确答案:

SELECT a.sno FROM sc a, sc b WHERE a.sno = b.sno AND a.cno = 1 AND b.cno = 2 AND a.score > b.score;

为什么“我写的”sql语句执行会报错,自己没有找出错误原因,请教大家

 

  • 写回答

3条回答 默认 最新

  • 关注

    题主,贴下报错信息还有表结构看看。

    评论

报告相同问题?