CREATE VIEW V_S_C_G AS SELECT student.sno,sname,course.cno,cname,grade FROM course INSERT JOIN sc ON course.cno=sc.cno INSERT JOIN student ON sc.cno=student.cno 报错:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT JOIN sc ON course.cno=sc.cno INSERT JOIN student ON sc.cno=student.cno' at line 5 应该怎么改
时间: 2023-06-11 21:10:10 浏览: 210
数据库系统概论Sql练习表student、sc、course.pdf
您的 SQL 语法有误,应该将 "INSERT" 改为 "INNER",即:
```
CREATE VIEW V_S_C_G AS
SELECT student.sno, sname, course.cno, cname, grade
FROM course
INNER JOIN sc ON course.cno = sc.cno
INNER JOIN student ON sc.sno = student.sno;
```
这样就可以创建一个名为 V_S_C_G 的视图,其中包含学生信息、课程信息和成绩信息。
阅读全文