SQL SEVER数据准备要求(利用SQL语言插入记录) : a)学生关系表Student中插入各学生自己所在班的全体学生的信息。 b)课程关系表Course插入至少6门课程信息, 至少有3门课有先修课,且至少有2门课有间接先修课(即课程的先修课也有先修课)。 c)选修关系表SC至少要6名同学有选课信息,且至少有3名同学选修所有课程。
时间: 2024-02-16 17:00:21 浏览: 100
好的,以下是插入记录的SQL语句:
a)
```
INSERT INTO Student (Sno, Sname, Ssex, Sage, Sdept)
SELECT Student.Sno, Student.Sname, Student.Ssex, Student.Sage, Student.Sdept
FROM Student, Class
WHERE Student.Classno = Class.Classno;
```
b)
```
INSERT INTO Course (Cno, Cname, Cpno)
VALUES ('C001', 'Database Management System', NULL),
('C002', 'Data Structure and Algorithm', NULL),
('C003', 'Operating System', 'C001'),
('C004', 'Computer Network', 'C002'),
('C005', 'Database Design and Implementation', 'C001'),
('C006', 'Programming Language Concepts', 'C002');
```
c)
```
INSERT INTO SC (Sno, Cno, Grade)
VALUES ('S001', 'C001', 80),
('S001', 'C002', 85),
('S001', 'C003', 90),
('S002', 'C001', 75),
('S002', 'C002', 80),
('S002', 'C003', 85),
('S003', 'C001', 90),
('S003', 'C002', 95),
('S004', 'C001', 80),
('S004', 'C002', 85),
('S004', 'C003', 90),
('S005', 'C001', 75),
('S006', 'C002', 80),
('S006', 'C003', 85),
('S007', 'C001', 90),
('S007', 'C002', 95),
('S007', 'C003', 100);
```
希望能够帮助到你!
阅读全文