学生表 CREATE TABLE Students (Sno CHAR(9) PRIMARY KEY, Sname CHAR(20), Ssex CHAR(2), Ssage SMALLINT, Sdept CHAR(20), Scredit SMALLINT DEFAULT O ); INSERT INTO Students (Sno,Sname,Ssex,Sage,Sdept) VALUES ('201215121','李勇','男',20,'计算机系'); INSERT INTO Students (Sno,Sname,Ssex,Sage,Sdept) VALUES ('201215122','刘晨','女',19,'计算机系'); INSERT INTO Students (Sno,Sname,Ssex,Sage,Sdept) VALUES ('201215123','王敏','女',18,'数学系'); INSERT INTO Students (Sno,Sname,Ssex,Sage,Sdept) VALUES ('201215125','张立','男',19,'机电系'); INSERT INTO Students (Sno,Sname,Ssex,Sage,Sdept) VALUES ('201215130','周欣欣','女',21,'机电系'); INSERT INTO Students (Sno,Sname,Ssex,Sage,Sdept) VALUES ('201215131','张强','男',19,'外语系'); INSERT INTO Students (Sno,Sname,Ssex,Sage,Sdept) VALUES ('201215133','刘明','男',18,'艺术系'); INSERT INTO Students (Sno,Sname,Ssex,Sage,Sdept) VALUES ('201215134','李彦志','男',21,'艺术系'); INSERT INTO Students (Sno,Sname,Ssex,Sage,Sdept) VALUES ('201215138','江松','男',21,'外语系'); INSERT INTO Students (Sno,Sname,Ssex,Sage,Sdept) VALUES ('201215136','吴淑霞','女',19,'计算机系'); INSERT INTO Students (Sno,Sname,Ssex,Sage,Sdept) VALUES ('201215137','丁芳','女',20,'计算机系');找出错误并改正
时间: 2023-08-20 10:39:20 浏览: 330
有两处错误需要改正:
1. 在创建 Students 表时,Ssage 属性名拼写错误,应该是 Sage 而不是 Ssage。
2. 在插入数据时,最后一个学生的 Scredit 属性默认值写错了,应该是 0 而不是 O。
以下是已经改正后的 SQL 语句:
```
CREATE TABLE Students (
Sno CHAR(9) PRIMARY KEY,
Sname CHAR(20),
Ssex CHAR(2),
Sage SMALLINT,
Sdept CHAR(20),
Scredit SMALLINT DEFAULT 0
);
INSERT INTO Students (Sno,Sname,Ssex,Sage,Sdept)
VALUES
('201215121','李勇','男',20,'计算机系'),
('201215122','刘晨','女',19,'计算机系'),
('201215123','王敏','女',18,'数学系'),
('201215125','张立','男',19,'机电系'),
('201215130','周欣欣','女',21,'机电系'),
('201215131','张强','男',19,'外语系'),
('201215133','刘明','男',18,'艺术系'),
('201215134','李彦志','男',21,'艺术系'),
('201215138','江松','男',21,'外语系'),
('201215136','吴淑霞','女',19,'计算机系'),
('201215137','丁芳','女',20,'计算机系');
```
阅读全文