SELECT Sname from studentsc where Snostudent=Snosc and scoresc=select score from studentsc where Snostudent=Snosc and Snamestudent=李逵;; 帮我检查一下
这个 SQL 语句的语法有些问题,正确的写法应该是:
SELECT Sname
FROM student, sc
WHERE Sno = student AND Sno = sc
AND score = (SELECT score
FROM student, sc
WHERE Sno = student AND Sno = sc
AND Sname = '李逵');
这个查询语句的意思是:查询和李逵的分数相同的学生姓名。其中,student 表和 sc 表通过 Sno 字段关联起来,Sname 字段表示学生姓名,score 字段表示学生成绩。子查询用于获取李逵的分数值,然后外层查询根据这个分数值来获取对应的学生姓名。
原文地址: https://www.cveoy.top/t/topic/fn2U 著作权归作者所有。请勿转载和采集!