Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DROP TABLE course ;
- CREATE TABLE course
- (
- CourseID INT NOT NULL AUTO_INCREMENT ,
- Title VARCHAR(64) NOT NULL,
- Credits INT NOT NULL,
- PRIMARY KEY (CourseID)
- );
- INSERT INTO course VALUES (1050, 'Chemistry', 3 );
- INSERT INTO course VALUES (4022, 'Microeconomics', 3 );
- INSERT INTO course VALUES (4041, 'Macroeconomics', 3 );
- INSERT INTO course VALUES (1045, 'Calculus', 4 );
- INSERT INTO course VALUES (3141, 'Trigonometry', 4 );
- INSERT INTO course VALUES (2021, 'Composition', 3 );
- INSERT INTO course VALUES (2042, 'Literature', 4 );
- SELECT * FROM course;
- DROP TABLE student ;
- CREATE TABLE student
- (
- ID INT NOT NULL AUTO_INCREMENT ,
- FirstMidName VARCHAR(64) NOT NULL,
- LastName VARCHAR(64) NOT NULL,
- EnrolmentDate datetime NOT NULL ,
- PRIMARY KEY(ID)
- );
- INSERT INTO student VALUES (DEFAULT, 'Carson', 'Alexander', '2010-12-31 23:59:59' );
- INSERT INTO student VALUES (DEFAULT, 'Meredith', 'Alonso', '2010-12-31 23:59:59' );
- INSERT INTO student VALUES (DEFAULT, 'Arturo', 'Anand', '2010-12-31 23:59:59' );
- INSERT INTO student VALUES (DEFAULT, 'Gytis', 'Barzdukas', '2010-12-31 23:59:59' );
- INSERT INTO student VALUES (DEFAULT, 'Yan', 'Li', '2010-12-31 23:59:59' );
- INSERT INTO student VALUES (DEFAULT, 'Peggy', 'Justice', '2010-12-31 23:59:59' );
- INSERT INTO student VALUES (DEFAULT, 'Laura', 'Norman', '2010-12-31 23:59:59' );
- INSERT INTO student VALUES (DEFAULT, 'Nino', 'Olivetto', '2010-12-31 23:59:59' );
- DROP TABLE enrolment;
- CREATE TABLE enrolment
- (
- EnrolmentID INT NOT NULL AUTO_INCREMENT ,
- CourseID INT NOT NULL ,
- ID INT NOT NULL ,
- Grade CHAR NOT NULL,
- CONSTRAINT PK1 PRIMARY KEY(EnrolmentID),
- CONSTRAINT FK1 FOREIGN KEY(CourseID) REFERENCES course(CourseID),
- CONSTRAINT FK2 FOREIGN KEY(ID) REFERENCES student(ID)
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement