Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- USE fakedb;
- #DROP TABLE Professors, Course, Semester;
- #DROP TABLE Teaches;
- CREATE TABLE Professors (
- eid INTEGER AUTO_INCREMENT,
- CONSTRAINT ProfKey PRIMARY KEY (eid));
- CREATE TABLE Course (
- courseid INTEGER AUTO_INCREMENT,
- CONSTRAINT CourseKey PRIMARY KEY (courseid));
- CREATE TABLE Teaches (
- eid INTEGER,
- semesterid CHAR(245),
- courseid INTEGER,
- CONSTRAINT TeachesKey PRIMARY KEY(eid,semesterid,courseid),
- FOREIGN KEY (eid) REFERENCES Professors(eid),
- FOREIGN KEY (courseid) REFERENCES Course(courseid)
- );
- SHOW TABLES;
- INSERT INTO Course(courseid)
- VALUES(1343);
- INSERT INTO Professors(eid)
- VALUES(53688);
- INSERT INTO Teaches(eid, courseid)
- VALUES(53688, 1343);
- INSERT INTO Teaches(eid, semesterid, courseid)
- VALUES(53688, 1343);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement