(SubjectNo char (2) the CONSTRAINT PK_Subject PRIMARY KEY,
SubjectName char (8) the NOT NULL UNIQUE,
SubjectType char (4) the CHECK (SubjectType IN (' major ', 'other')),
SubjectHour tinyint
)
GO
The CREATE TABLE the Teacher
(Tno char (4) the CONSTRAINT PK_Teacher PRIMARY KEY,
Tname char (8) the NOT NULL UNIQUE,
Tsex char (2) the DEFAULT 'female' CHECK (Tsex IN (' male ', 'woman')),
Tage tinyint,
Twage tinyint,
Tsubject char (2) the CONSTRAINT FK_Teacher_Tsubject FOREIGN KEY REFERENCES the Subject (SubjectNo),
CHECK (Tage> Twage)
)
GO
The CREATE TABLE Class
(ClassNo char (4) the CONSTRAINT PK_Class PRIMARY KEY,
The ClassName char (1) NOT NULL, UNIQUE,
Tno char (4) NOT NULL,
The CONSTRAINT FK_Class_Tno FOREIGN KEY REFERENCES (Tno) the Teacher (Tno)
)
GO
The CREATE TABLE C_S_T
(ClassNo char (4) the CONSTRAINT FK_C_S_T_ClassNo FOREIGN KEY REFERENCES the Class (ClassNo),
SubjectNo char (2) the CONSTRAINT FK_C_S_T_SubjectNo FOREIGN KEY REFERENCES the Subject (SubjectNo),
Tno char (4) the CONSTRAINT FK_C_S_T_Tno FOREIGN KEY REFERENCES the Teacher (Tno),
Semester char (6) NOT NULL,
Remark a Decimal (3, 1),
The CONSTRAINT PK_C_S_T PRIMARY KEY (ClassNo, SubjectNo, Semester)
)
GO
The CREATE TABLE Student
(Sno char (5) the CONSTRAINT PK_Student PRIMARY KEY,
Sname char (8) NOT NULL,
Ssex char (2) the CHECK (Ssex IN (' male ', 'woman')),
Sage tinyint CHECK (Sage<18),
ClassNo char (4) the CONSTRAINT FK_Student_ClassNo FOREIGN KEY REFERENCES the Class (ClassNo),
Sstatus char (1) the DEFAULT 'T'
)
GO
The CREATE TABLE Exam_Score
(Semester char (6) NOT NULL,
Sno char (5) the CONSTRAINT FK_Exam_Score_Sno FOREIGN KEY REFERENCES Student (Sno),
SubjectNo char (2) the CONSTRAINT FK_Exam_Score_SubjectNo FOREIGN KEY REFERENCES the 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) the CHECK (Etype (IN 'school take an examination of,' area ', 'test,')),
The CONSTRAINT PK_Exam_Score PRIMARY KEY (Semester, Sno, SubjectNo)
This is one of six table
Now query the classmate's 2014-1, 14001 semester exam course name, teaching teacher name and overall rating scores (Exam_Score. Tscore)
I want to create a view to connect six form but there is a problem
The CREATE VIEW V_14001
AS the SELECT SubjectName Tname, Mscore Fscore, Tscore
C_S_T From the Subject, the Teacher, Class, Student, Exam_Score
WHERE the Subject. SubjectNo=C_S_T. SubjectNo and C_S_T. Tno.=the Teacher Tno and the Teacher. The Tno=Class. Tno and
Class. ClassNo=Student. ClassNo and Student. The Sno=Exam_Score. Sno
Would you please tell me why is
CodePudding user response:
What is the error information?CodePudding user response:
No error message and can be executed correctly, but the result is not correct, language and thought is show flat including the mathematics behind the teacher Mr. Zhao, what reason is this excuse me?