create table Exam_Score ( Senester char(6) not null Sno char(5) foreign key references Student(Sno), SubjectNo char(2) foreign key references Subnect(SubjectNo), Mscore tinyint check (Mscore between 0 and 100), Fscore tinyink check (Fscore between 0 and 100), Tscore tinyink check (Tscore between 0 and 100), Etype char(4) )帮我改正错误
时间: 2024-02-24 18:55:40 浏览: 521
在这个 SQL 语句中,存在以下几处错误:
- Senester 应该为 Semester,拼写错误;
- tinyink 应该为 tinyint,拼写错误;
- Subnect 应该为 Subject,拼写错误;
- 在定义 Mscore、Fscore 和 Tscore 列时,应该使用 tinyint 类型,而不是 tinyink 类型;
- 在定义 Mscore、Fscore 和 Tscore 列时,应该使用 check 约束,而不是范围约束;
- 最后一行应该加上分号表示语句结束。
修改后的 SQL 语句如下:
```
create table Exam_Score (
Semester char(6) not null,
Sno char(5) references Student(Sno),
SubjectNo char(2) references Subject(SubjectNo),
Mscore tinyint check (Mscore between 0 and 100),
Fscore tinyint check (Fscore between 0 and 100),
Tscore tinyint check (Tscore between 0 and 100),
Etype char(4)
);
```
阅读全文