栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

数据库原理——错误记录

数据库原理——错误记录

错误1
column "student.sno" must appear in the GROUP BY clause or be used in an aggregate function

group by是按照某一个属性来分类,如果此时student.sno不在其中,分完类后,就无法找到这个属性。除非使用聚集函数,这个时候只需要计算值,并不需要找到这个属性。

错误2

正确写法:

select sname from student s1 where not exists (select cno from course where s1.sdept = course.sdept except select cno from sc where s1.sno = sc.sno);

错误写法(删去了一对括号):

select sname from student s1 where not exists select cno from course where s1.sdept = course.sdept except select cno from sc where s1.sno = sc.sno;

-- ERROR:  syntax error at or near "select"
-- 第1行select sname from student s1 where not exists select cno fro...

解释:可能是会有歧义,不知道not exists判断的是哪个。

注意

未完。。。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/326517.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号