This is my code but I am having trouble with the SECTION and REGISTRATION table. The error for section says course id isn't a column and with registration, it says there are no foreign key but that is all that is in the registration table.
CREATE TABLE STUDENT(StudentID integer,
StudentName char(25) NOT NULL,
primary key(StudentName))
CREATE TABLE FACULTY(FacultyID integer,
FacultyName char(25) NOT NULL,
primary key(FacultyID))
CREATE TABLE COURSE(CourseID integer,
CourseName char(15) NOT NULL,
primary key(CourseID))
CREATE TABLE QUALIFIED(DateQualified date,
FacultyID integer,
CourseID integer,
foreign key(FacultyID) references FACULTY(FacultyID),
foreign key(CourseID) references COURSE(CourseID))
CREATE TABLE SECTION(SectionNumber int,
Semester char(7),
Foreign key(CourseID) references COURSE(CourseID))
CREATE TABLE REGISTRATION(Foreign Key(StudentID) references STUDENT(StudentID),
Foreign Key(SectionNumber) references SECTION(SectionNumber))
Correct query for SECTION Table is as given follow:
CREATE TABLE SECTION(SectionNumber int,
Semester char(7),
CourseID integer,
Foreign key(CourseID) references COURSE(CourseID))
As you miss to write statement which is in bold first you have to add column in table and then it's constraint.
Correct query for REGISTRATION Table is as given follow:
CREATE TABLE REGISTRATION(
StudentID integer,
SectionNumber int,
Foreign Key(StudentID) references STUDENT(StudentID),
Foreign Key(SectionNumber) references SECTION(SectionNumber))
As you miss to write statement which is in bold first you have to add columns in table and then it's constraint.
If at any point you find any difficulty feel free ask me.
Get Answers For Free
Most questions answered within 1 hours.