Line 5: | |||
MySQL | MySQL | ||
- | use test; | + | use test; |
- | drop table Course; | + | drop table Course; |
- | create table Course( | + | create table Course( |
- | CourseID char, | + | CourseID char, |
- | Name varchar(45), | + | Name varchar(45), |
- | PRIMARY KEY ( CourseID ) | + | PRIMARY KEY ( CourseID ) |
- | ); | + | ); |
- | INSERT INTO `test`.`Course` | + | INSERT INTO `test`.`Course` |
- | (`CourseID`, | + | (`CourseID`, |
- | `Name`) | + | `Name`) |
- | VALUES | + | VALUES |
- | ("A", | + | ("A", |
- | "Math"); | + | "Math"); |
- | INSERT INTO `test`.`Course` | + | INSERT INTO `test`.`Course` |
- | (`CourseID`, | + | (`CourseID`, |
- | `Name`) | + | `Name`) |
- | VALUES | + | VALUES |
- | ("B", | + | ("B", |
- | "English"); | + | "English"); |
- | INSERT INTO `test`.`Course` | + | INSERT INTO `test`.`Course` |
- | (`CourseID`, | + | (`CourseID`, |
- | `Name`) | + | `Name`) |
- | VALUES | + | VALUES |
- | ("C", | + | ("C", |
- | "Science"); | + | "Science"); |
- | drop table Student; | + | drop table Student; |
- | create table Student( | + | create table Student( |
- | StudentID int, | + | StudentID int, |
- | Name varchar(45), | + | Name varchar(45), |
- | PRIMARY KEY ( StudentID ) | + | PRIMARY KEY ( StudentID ) |
- | ); | + | ); |
- | INSERT INTO `test`.`Student` | + | INSERT INTO `test`.`Student` |
- | (`StudentID`, | + | (`StudentID`, |
- | `Name`) | + | `Name`) |
- | VALUES | + | VALUES |
- | (1, | + | (1, |
- | "Bob"); | + | "Bob"); |
- | INSERT INTO `test`.`Student` | + | INSERT INTO `test`.`Student` |
- | (`StudentID`, | + | (`StudentID`, |
- | `Name`) | + | `Name`) |
- | VALUES | + | VALUES |
- | (2, | + | (2, |
- | "Sue"); | + | "Sue"); |
- | INSERT INTO `test`.`Student` | + | INSERT INTO `test`.`Student` |
- | (`StudentID`, | + | (`StudentID`, |
- | `Name`) | + | `Name`) |
- | VALUES | + | VALUES |
- | (3, | + | (3, |
- | "Tom"); | + | "Tom"); |
- | drop table Enrollment; | + | drop table Enrollment; |
- | create table Enrollment( | + | create table Enrollment( |
- | CourseID char, | + | CourseID char, |
- | StudentID int | + | StudentID int |
- | ); | + | ); |
- | INSERT INTO `test`.`Enrollment` | + | INSERT INTO `test`.`Enrollment` |
- | (`CourseID`, | + | (`CourseID`, |
- | `StudentID`) | + | `StudentID`) |
- | VALUES | + | VALUES |
- | ("A", | + | ("A", |
- | 1); | + | 1); |
- | INSERT INTO `test`.`Enrollment` | + | INSERT INTO `test`.`Enrollment` |
- | (`CourseID`, | + | (`CourseID`, |
- | `StudentID`) | + | `StudentID`) |
- | VALUES | + | VALUES |
- | ("A", | + | ("A", |
- | 3); | + | 3); |
- | INSERT INTO `test`.`Enrollment` | + | INSERT INTO `test`.`Enrollment` |
- | (`CourseID`, | + | (`CourseID`, |
- | `StudentID`) | + | `StudentID`) |
- | VALUES | + | VALUES |
- | ("C", | + | ("C", |
- | 1); | + | 1); |
---- | ---- |