Lab 15

 Objective

Using what we have created → Lab 6 create a table to address the many-many relationship that exists between the student and the class. Note - a student can have many classes, and a class can have many students. You will use the following SQL to create the table

DROP TABLE IF EXISTS `joinStudentClass`; CREATE TABLE `joinStudentClass` ( `ID` mediumint NOT NULL AUTO_INCREMENT, `studentID` int NOT NULL, `classID` varchar(10) NOT NULL, PRIMARY KEY (`ID`), KEY `studentID` (`studentID`), KEY `classID` (`classID`), CONSTRAINT `joinstudentclass_ibfk_1` FOREIGN KEY (`studentID`) REFERENCES `student` (`studentId`), CONSTRAINT `joinstudentclass_ibfk_2` FOREIGN KEY (`classID`) REFERENCES `class` (`classID`) );

 

Once you have created the table, please insert the following records to associate the proper students with their classes. You will need to add some classes to the class table to reference below

ID

studentID

(You may need to add records to your student table for the info below)

classID

(You may need to add records to your class table for the info below)

ID

studentID

(You may need to add records to your student table for the info below)

classID

(You may need to add records to your class table for the info below)

1

1005

CS-110

2

1002

BIS-245

3

1000

BIS-245

4

1000

CIS-110

5

1001

ENG-101

6

1004

ENG-101

7

1005

BIS-100

 

 

Upload a screenshot of your SQL Schema (it would look like the one below) as well as the output to a SELECT command on each of the tables. Extra Credit (25 points) - Create a select command to use a join on the tables to show the data output results from all the tables. Additionally, Copy/paste your SQL to your word document submission.

 

Â