SlideShare a Scribd company logo
1 of 6
create foreign key constraints for the appropriate tables in your Chicago_School_DB
database from the CLI in MySQL. Since your tables have already been created, this will
need to be accomplished through the Alter Table command. For a deliverable, take a
screen shot of each alter table command successfully being executed.
Chicago School DB relations:
School relation
schoolNumber
name
address
phoneNumber
built
size
Student relation
studentNumber
firstName
lastName
birthdate
schoolNumber
Teacher relation
teacherID
firstName
lastName
hireDate
supervisor
Subject relation
subjectNumber
Name
gradeLevel
Class relation
teacherID
studentNumber
subjectNumber
grade
Administrator relation
employeeNumber
schoolNumber
firstName
lastName
phoneNumber
officerNumber
CREATE DATABASE IF NOT EXISTS `chicago_school_db`;
USE `chicago_school_db`;
DROP TABLE IF EXISTS `teacher`;
CREATE TABLE `teacher` (
`teacherID` int NOT NULL,
`firstname` varchar(50) DEFAULT NULL,
`lastname` varchar(50) DEFAULT NULL,
`hireDate` date DEFAULT NULL,
`supervisor` int DEFAULT NULL,
PRIMARY KEY (`teacherID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
LOCK TABLES `teacher` WRITE;
INSERT INTO `teacher` VALUES (4,'James','Bond','2010-01-24',150),
(16,'Chadwick','Boseman','2008-06-19',4),
(18,'Danai','Gurira','2008-08-14',16),
(24,'Paul','Rudd','2007-08-16',18),
(25,'Gemma','Chan','2006-02-14',4),
(52,'Mark','Ruffalo','2016-04-12',138),
(60,'Chris','Evans','2016-07-01',138),
(76,'Ryan','Reynolds','2001-05-18',101),
(77,'Brie','Larson','2003-02-20',18),
(89,'Tom','Hiddleston','2020-06-05',101),
(101,'Chris','Pratt','2008-06-19',172),
(119,'Tom','Holland','2017-11-07',138),
(138,'Robert','Downey','2003-07-09',52),
(146,'Scarlett','Johansson','2020-06-05',4),
(150,'Anthony','Mackie','2015-02-26',18),
(172,'Benedict','Cumberbatch','2006-02-14',18),
(193,'Jeremy','Renner','2014-07-11',101);
UNLOCK TABLES;
DROP TABLE IF EXISTS `subject`;
CREATE TABLE `subject` (
`subjectNumber` int NOT NULL,
`name` varchar(100) DEFAULT NULL,
`gradeLevel` varchar(2) DEFAULT NULL,
PRIMARY KEY (`subjectNumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
LOCK TABLES `subject` WRITE;
INSERT INTO `subject` VALUES (9,'Astronomy','9'),
(13,'US History','12'),(23,'Geography','10'),
(33,'Biology','10'),(35,'Entomology','9'),
(43,'Algebra II','10'),
(53,'Self Defense','12'),
(62,'Algebra','9'),
(67,'Literature','12'),
(70,'Norse Mythology','10'),
(78,'World History','11'),
(83,'Legal Studies','11'),
(85,'Introduction to Computer Science','11');
UNLOCK TABLES;
DROP TABLE IF EXISTS `student`;
CREATE TABLE `student` (
`studentNumber` int NOT NULL,
`schoolNumber` int NOT NULL,
`firstName` varchar(50) DEFAULT NULL,
`lastName` varchar(50) DEFAULT NULL,
`birthDate` date DEFAULT NULL,
PRIMARY KEY (`studentNumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
LOCK TABLES `student` WRITE;
INSERT INTO `student` VALUES (1093,45,'Hermione','Granger','2006-11-24'),
(1217,45,'Ron','Weasley','2005-08-17'),
(1440,345,'Britta','Perry','2006-05-21'),
(1448,93,'Jessie','Spano','2007-02-15'),
(1601,54,'Eric','Mathews','2005-08-22'),
(1803,119,'Tyra','Collette','2007-08-02'),
(1927,93,'Kelly','Kapowski','2009-02-22'),
(1972,93,'Samuel','Powers','2007-04-14'),
(2036,345,'Annie','Edison','2006-05-25'),
(2056,119,'Taylor','Kitsch','2009-08-08'),
(2168,119,'Zach','Gilford','2005-08-02'),
(2213,119,'Jason','Street','2006-01-17'),
(2258,54,'Topanga','Lawrence','2008-03-05'),
(2411,45,'Harry','Potter','2006-09-15'),
(2492,345,'Jeff','Winger','2008-08-10'),
(2600,45,'Neville ','Longbottom','2007-11-01'),
(2725,54,'Shawn','Hunter','2008-05-31'),
(2732,93,'Zack','Morris','2008-02-18'),
(2895,54,'Cory','Mathews','2007-02-17'),
(2932,345,'Abed','Nadir','2007-04-15');
UNLOCK TABLES;
DROP TABLE IF EXISTS `school`;
CREATE TABLE `school` (
`schoolNumber` int NOT NULL,
`name` varchar(200) DEFAULT NULL,
`address` varchar(95) DEFAULT NULL,
`phoneNumber` varchar(10) DEFAULT NULL,
`built` date DEFAULT NULL,
`size` int DEFAULT NULL,
PRIMARY KEY (`schoolNumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
LOCK TABLES `school` WRITE;
INSERT INTO `school` VALUES (45,'Hogwarts Scool of Witchcraft and Wizardry','738
North Williams Ave.','5056448362','2000-11-14',414000),
(54,'John Adams High School','8226 Selby Lane','5056444088','2012-12-13',118500),
(93,'Bayside High','7914 Aspen Drive','5057756575','2000-08-20',175645),
(119,'Dillon High School','475 South University Ave.','5058672818','2006-10-03',102598),
(345,'Green Dale High','772 Grand St.','5056624410','2009-09-17',250345);
UNLOCK TABLES;
DROP TABLE IF EXISTS `class`;
CREATE TABLE `class` (
`teacherID` int NOT NULL,
`studentNumber` int NOT NULL,
`subjectNumber` int NOT NULL,
`grade` int DEFAULT NULL,
PRIMARY KEY (`teacherID`,`studentNumber`,`subjectNumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
LOCK TABLES `class` WRITE;
UNLOCK TABLES;
DROP TABLE IF EXISTS `administrator`;
CREATE TABLE `administrator` (
`employeeNumber` int NOT NULL,
`schoolNumber` int NOT NULL,
`firstName` varchar(50) DEFAULT NULL,
`lastName` varchar(50) DEFAULT NULL,
`phoneNumber` varchar(10) DEFAULT NULL,
`officeNumber` varchar(3) DEFAULT NULL,
PRIMARY KEY (`employeeNumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
LOCK TABLES `administrator` WRITE;
INSERT INTO `administrator` VALUES
(430,45,'Albus','Dumbledore','2072087222','201'),
(161,345,'John','Oliver','4255510706','321'),
(241,54,'Eli','Williams','4344641774','502'),
(253,93,'Dennis','Haskins','5056465505','987'),
School relation
schoolNumber name address phoneNumber built size

More Related Content

Similar to Add foreign keys to Chicago School DB tables

Sql success ch02
Sql success ch02Sql success ch02
Sql success ch02roughsea
 
More SQL in MySQL 8.0
More SQL in MySQL 8.0More SQL in MySQL 8.0
More SQL in MySQL 8.0Norvald Ryeng
 
Nodejs mongoose
Nodejs mongooseNodejs mongoose
Nodejs mongooseFin Chen
 
I am working on this homework using MYSQL database. Can you help. At.docx
I am working on this homework using MYSQL database. Can you help. At.docxI am working on this homework using MYSQL database. Can you help. At.docx
I am working on this homework using MYSQL database. Can you help. At.docxmaple8qvlisbey
 
Consider the classes below- Here is the code for the ParentChildRelati.pdf
Consider the classes below- Here is the code for the ParentChildRelati.pdfConsider the classes below- Here is the code for the ParentChildRelati.pdf
Consider the classes below- Here is the code for the ParentChildRelati.pdf21stcenturyjammu21
 
ALL BASIC SQL SERVER QUERY
ALL BASIC SQL SERVER QUERY ALL BASIC SQL SERVER QUERY
ALL BASIC SQL SERVER QUERY Rajesh Patel
 
js+ts fullstack typescript with react and express.pdf
js+ts fullstack typescript with react and express.pdfjs+ts fullstack typescript with react and express.pdf
js+ts fullstack typescript with react and express.pdfNuttavutThongjor1
 
fullstack typescript with react and express.pdf
fullstack typescript with react and express.pdffullstack typescript with react and express.pdf
fullstack typescript with react and express.pdfNuttavutThongjor1
 
Coding Horrors
Coding HorrorsCoding Horrors
Coding HorrorsMark Baker
 
Hi, I need help with a java programming project. specifically practi.pdf
Hi, I need help with a java programming project. specifically practi.pdfHi, I need help with a java programming project. specifically practi.pdf
Hi, I need help with a java programming project. specifically practi.pdffashioncollection2
 

Similar to Add foreign keys to Chicago School DB tables (14)

Sql success ch02
Sql success ch02Sql success ch02
Sql success ch02
 
More SQL in MySQL 8.0
More SQL in MySQL 8.0More SQL in MySQL 8.0
More SQL in MySQL 8.0
 
Md
MdMd
Md
 
Drupal7 dbtng
Drupal7  dbtngDrupal7  dbtng
Drupal7 dbtng
 
Nodejs mongoose
Nodejs mongooseNodejs mongoose
Nodejs mongoose
 
I am working on this homework using MYSQL database. Can you help. At.docx
I am working on this homework using MYSQL database. Can you help. At.docxI am working on this homework using MYSQL database. Can you help. At.docx
I am working on this homework using MYSQL database. Can you help. At.docx
 
Don kin kong.pptx
Don kin kong.pptxDon kin kong.pptx
Don kin kong.pptx
 
Consider the classes below- Here is the code for the ParentChildRelati.pdf
Consider the classes below- Here is the code for the ParentChildRelati.pdfConsider the classes below- Here is the code for the ParentChildRelati.pdf
Consider the classes below- Here is the code for the ParentChildRelati.pdf
 
ALL BASIC SQL SERVER QUERY
ALL BASIC SQL SERVER QUERY ALL BASIC SQL SERVER QUERY
ALL BASIC SQL SERVER QUERY
 
ts+js
ts+jsts+js
ts+js
 
js+ts fullstack typescript with react and express.pdf
js+ts fullstack typescript with react and express.pdfjs+ts fullstack typescript with react and express.pdf
js+ts fullstack typescript with react and express.pdf
 
fullstack typescript with react and express.pdf
fullstack typescript with react and express.pdffullstack typescript with react and express.pdf
fullstack typescript with react and express.pdf
 
Coding Horrors
Coding HorrorsCoding Horrors
Coding Horrors
 
Hi, I need help with a java programming project. specifically practi.pdf
Hi, I need help with a java programming project. specifically practi.pdfHi, I need help with a java programming project. specifically practi.pdf
Hi, I need help with a java programming project. specifically practi.pdf
 

More from CharlesXMLAllano

dasperiet destrityben- Itivisceffoent if yerapon for 200n7 W- while th.docx
dasperiet destrityben- Itivisceffoent if yerapon for 200n7 W- while th.docxdasperiet destrityben- Itivisceffoent if yerapon for 200n7 W- while th.docx
dasperiet destrityben- Itivisceffoent if yerapon for 200n7 W- while th.docxCharlesXMLAllano
 
Darwin was influenced by many people and events- Which of the followin.docx
Darwin was influenced by many people and events- Which of the followin.docxDarwin was influenced by many people and events- Which of the followin.docx
Darwin was influenced by many people and events- Which of the followin.docxCharlesXMLAllano
 
Daniel Collins is going to meet with a development specialist at the c.docx
Daniel Collins is going to meet with a development specialist at the c.docxDaniel Collins is going to meet with a development specialist at the c.docx
Daniel Collins is going to meet with a development specialist at the c.docxCharlesXMLAllano
 
d- void doubleIt (int -- A) -{ count -1- while (count - A- Iength ){.docx
d- void doubleIt (int -- A) -{ count -1- while (count - A- Iength ){.docxd- void doubleIt (int -- A) -{ count -1- while (count - A- Iength ){.docx
d- void doubleIt (int -- A) -{ count -1- while (count - A- Iength ){.docxCharlesXMLAllano
 
D- Bases for the classificanion of igneass rockt Clasulicarion of ighe.docx
D- Bases for the classificanion of igneass rockt Clasulicarion of ighe.docxD- Bases for the classificanion of igneass rockt Clasulicarion of ighe.docx
D- Bases for the classificanion of igneass rockt Clasulicarion of ighe.docxCharlesXMLAllano
 
D) The medial meniscus E) The lateral meniscus 73) Answer all the part.docx
D) The medial meniscus E) The lateral meniscus 73) Answer all the part.docxD) The medial meniscus E) The lateral meniscus 73) Answer all the part.docx
D) The medial meniscus E) The lateral meniscus 73) Answer all the part.docxCharlesXMLAllano
 
Cutetan l of 3 theEipition 1 of 5e Tertheng and Medin its of daripints.docx
Cutetan l of 3 theEipition 1 of 5e Tertheng and Medin its of daripints.docxCutetan l of 3 theEipition 1 of 5e Tertheng and Medin its of daripints.docx
Cutetan l of 3 theEipition 1 of 5e Tertheng and Medin its of daripints.docxCharlesXMLAllano
 
Current Position Analysis The following items are reported on a compan.docx
Current Position Analysis The following items are reported on a compan.docxCurrent Position Analysis The following items are reported on a compan.docx
Current Position Analysis The following items are reported on a compan.docxCharlesXMLAllano
 
Current evidence indicates that the process of photosynthesis arose mo.docx
Current evidence indicates that the process of photosynthesis arose mo.docxCurrent evidence indicates that the process of photosynthesis arose mo.docx
Current evidence indicates that the process of photosynthesis arose mo.docxCharlesXMLAllano
 
Current Attempt in Progress- Pharoah Ltd is a Canadian private company.docx
Current Attempt in Progress- Pharoah Ltd is a Canadian private company.docxCurrent Attempt in Progress- Pharoah Ltd is a Canadian private company.docx
Current Attempt in Progress- Pharoah Ltd is a Canadian private company.docxCharlesXMLAllano
 
Current Attempt in Progress The following function is probability mass.docx
Current Attempt in Progress The following function is probability mass.docxCurrent Attempt in Progress The following function is probability mass.docx
Current Attempt in Progress The following function is probability mass.docxCharlesXMLAllano
 
Current Attempt in Progress The adjusted trial balance of Sandhill Com.docx
Current Attempt in Progress The adjusted trial balance of Sandhill Com.docxCurrent Attempt in Progress The adjusted trial balance of Sandhill Com.docx
Current Attempt in Progress The adjusted trial balance of Sandhill Com.docxCharlesXMLAllano
 
Current Attempt in Progress Lindy Weink- the new controller of Ivanhoe.docx
Current Attempt in Progress Lindy Weink- the new controller of Ivanhoe.docxCurrent Attempt in Progress Lindy Weink- the new controller of Ivanhoe.docx
Current Attempt in Progress Lindy Weink- the new controller of Ivanhoe.docxCharlesXMLAllano
 
Curiosity is an aptly named rover that is a part of NASA's Mars Explor.docx
Curiosity is an aptly named rover that is a part of NASA's Mars Explor.docxCuriosity is an aptly named rover that is a part of NASA's Mars Explor.docx
Curiosity is an aptly named rover that is a part of NASA's Mars Explor.docxCharlesXMLAllano
 
Current Attempt in Progress Chris Newman will invest $10-470 today in.docx
Current Attempt in Progress Chris Newman will invest $10-470 today in.docxCurrent Attempt in Progress Chris Newman will invest $10-470 today in.docx
Current Attempt in Progress Chris Newman will invest $10-470 today in.docxCharlesXMLAllano
 
Current assets Total assets Current liabilities Total liabilities Net.docx
Current assets Total assets Current liabilities Total liabilities Net.docxCurrent assets Total assets Current liabilities Total liabilities Net.docx
Current assets Total assets Current liabilities Total liabilities Net.docxCharlesXMLAllano
 
Cullumber Company manufactures pizza sauce through two production depa.docx
Cullumber Company manufactures pizza sauce through two production depa.docxCullumber Company manufactures pizza sauce through two production depa.docx
Cullumber Company manufactures pizza sauce through two production depa.docxCharlesXMLAllano
 
CRP expression in the liver is most readily induced by what-A- TNF-alp.docx
CRP expression in the liver is most readily induced by what-A- TNF-alp.docxCRP expression in the liver is most readily induced by what-A- TNF-alp.docx
CRP expression in the liver is most readily induced by what-A- TNF-alp.docxCharlesXMLAllano
 
Critically evaluate the Edinburgh Tram project execution and closure a.docx
Critically evaluate the Edinburgh Tram project execution and closure a.docxCritically evaluate the Edinburgh Tram project execution and closure a.docx
Critically evaluate the Edinburgh Tram project execution and closure a.docxCharlesXMLAllano
 
Cross Section 4- The complicated one! Several unconformitics- meaning.docx
Cross Section 4- The complicated one! Several unconformitics- meaning.docxCross Section 4- The complicated one! Several unconformitics- meaning.docx
Cross Section 4- The complicated one! Several unconformitics- meaning.docxCharlesXMLAllano
 

More from CharlesXMLAllano (20)

dasperiet destrityben- Itivisceffoent if yerapon for 200n7 W- while th.docx
dasperiet destrityben- Itivisceffoent if yerapon for 200n7 W- while th.docxdasperiet destrityben- Itivisceffoent if yerapon for 200n7 W- while th.docx
dasperiet destrityben- Itivisceffoent if yerapon for 200n7 W- while th.docx
 
Darwin was influenced by many people and events- Which of the followin.docx
Darwin was influenced by many people and events- Which of the followin.docxDarwin was influenced by many people and events- Which of the followin.docx
Darwin was influenced by many people and events- Which of the followin.docx
 
Daniel Collins is going to meet with a development specialist at the c.docx
Daniel Collins is going to meet with a development specialist at the c.docxDaniel Collins is going to meet with a development specialist at the c.docx
Daniel Collins is going to meet with a development specialist at the c.docx
 
d- void doubleIt (int -- A) -{ count -1- while (count - A- Iength ){.docx
d- void doubleIt (int -- A) -{ count -1- while (count - A- Iength ){.docxd- void doubleIt (int -- A) -{ count -1- while (count - A- Iength ){.docx
d- void doubleIt (int -- A) -{ count -1- while (count - A- Iength ){.docx
 
D- Bases for the classificanion of igneass rockt Clasulicarion of ighe.docx
D- Bases for the classificanion of igneass rockt Clasulicarion of ighe.docxD- Bases for the classificanion of igneass rockt Clasulicarion of ighe.docx
D- Bases for the classificanion of igneass rockt Clasulicarion of ighe.docx
 
D) The medial meniscus E) The lateral meniscus 73) Answer all the part.docx
D) The medial meniscus E) The lateral meniscus 73) Answer all the part.docxD) The medial meniscus E) The lateral meniscus 73) Answer all the part.docx
D) The medial meniscus E) The lateral meniscus 73) Answer all the part.docx
 
Cutetan l of 3 theEipition 1 of 5e Tertheng and Medin its of daripints.docx
Cutetan l of 3 theEipition 1 of 5e Tertheng and Medin its of daripints.docxCutetan l of 3 theEipition 1 of 5e Tertheng and Medin its of daripints.docx
Cutetan l of 3 theEipition 1 of 5e Tertheng and Medin its of daripints.docx
 
Current Position Analysis The following items are reported on a compan.docx
Current Position Analysis The following items are reported on a compan.docxCurrent Position Analysis The following items are reported on a compan.docx
Current Position Analysis The following items are reported on a compan.docx
 
Current evidence indicates that the process of photosynthesis arose mo.docx
Current evidence indicates that the process of photosynthesis arose mo.docxCurrent evidence indicates that the process of photosynthesis arose mo.docx
Current evidence indicates that the process of photosynthesis arose mo.docx
 
Current Attempt in Progress- Pharoah Ltd is a Canadian private company.docx
Current Attempt in Progress- Pharoah Ltd is a Canadian private company.docxCurrent Attempt in Progress- Pharoah Ltd is a Canadian private company.docx
Current Attempt in Progress- Pharoah Ltd is a Canadian private company.docx
 
Current Attempt in Progress The following function is probability mass.docx
Current Attempt in Progress The following function is probability mass.docxCurrent Attempt in Progress The following function is probability mass.docx
Current Attempt in Progress The following function is probability mass.docx
 
Current Attempt in Progress The adjusted trial balance of Sandhill Com.docx
Current Attempt in Progress The adjusted trial balance of Sandhill Com.docxCurrent Attempt in Progress The adjusted trial balance of Sandhill Com.docx
Current Attempt in Progress The adjusted trial balance of Sandhill Com.docx
 
Current Attempt in Progress Lindy Weink- the new controller of Ivanhoe.docx
Current Attempt in Progress Lindy Weink- the new controller of Ivanhoe.docxCurrent Attempt in Progress Lindy Weink- the new controller of Ivanhoe.docx
Current Attempt in Progress Lindy Weink- the new controller of Ivanhoe.docx
 
Curiosity is an aptly named rover that is a part of NASA's Mars Explor.docx
Curiosity is an aptly named rover that is a part of NASA's Mars Explor.docxCuriosity is an aptly named rover that is a part of NASA's Mars Explor.docx
Curiosity is an aptly named rover that is a part of NASA's Mars Explor.docx
 
Current Attempt in Progress Chris Newman will invest $10-470 today in.docx
Current Attempt in Progress Chris Newman will invest $10-470 today in.docxCurrent Attempt in Progress Chris Newman will invest $10-470 today in.docx
Current Attempt in Progress Chris Newman will invest $10-470 today in.docx
 
Current assets Total assets Current liabilities Total liabilities Net.docx
Current assets Total assets Current liabilities Total liabilities Net.docxCurrent assets Total assets Current liabilities Total liabilities Net.docx
Current assets Total assets Current liabilities Total liabilities Net.docx
 
Cullumber Company manufactures pizza sauce through two production depa.docx
Cullumber Company manufactures pizza sauce through two production depa.docxCullumber Company manufactures pizza sauce through two production depa.docx
Cullumber Company manufactures pizza sauce through two production depa.docx
 
CRP expression in the liver is most readily induced by what-A- TNF-alp.docx
CRP expression in the liver is most readily induced by what-A- TNF-alp.docxCRP expression in the liver is most readily induced by what-A- TNF-alp.docx
CRP expression in the liver is most readily induced by what-A- TNF-alp.docx
 
Critically evaluate the Edinburgh Tram project execution and closure a.docx
Critically evaluate the Edinburgh Tram project execution and closure a.docxCritically evaluate the Edinburgh Tram project execution and closure a.docx
Critically evaluate the Edinburgh Tram project execution and closure a.docx
 
Cross Section 4- The complicated one! Several unconformitics- meaning.docx
Cross Section 4- The complicated one! Several unconformitics- meaning.docxCross Section 4- The complicated one! Several unconformitics- meaning.docx
Cross Section 4- The complicated one! Several unconformitics- meaning.docx
 

Recently uploaded

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxabhijeetpadhi001
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 

Recently uploaded (20)

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 

Add foreign keys to Chicago School DB tables

  • 1. create foreign key constraints for the appropriate tables in your Chicago_School_DB database from the CLI in MySQL. Since your tables have already been created, this will need to be accomplished through the Alter Table command. For a deliverable, take a screen shot of each alter table command successfully being executed. Chicago School DB relations: School relation schoolNumber name address phoneNumber built size Student relation studentNumber firstName lastName birthdate schoolNumber Teacher relation teacherID firstName lastName hireDate supervisor Subject relation
  • 2. subjectNumber Name gradeLevel Class relation teacherID studentNumber subjectNumber grade Administrator relation employeeNumber schoolNumber firstName lastName phoneNumber officerNumber CREATE DATABASE IF NOT EXISTS `chicago_school_db`; USE `chicago_school_db`; DROP TABLE IF EXISTS `teacher`; CREATE TABLE `teacher` ( `teacherID` int NOT NULL, `firstname` varchar(50) DEFAULT NULL, `lastname` varchar(50) DEFAULT NULL, `hireDate` date DEFAULT NULL, `supervisor` int DEFAULT NULL, PRIMARY KEY (`teacherID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; LOCK TABLES `teacher` WRITE;
  • 3. INSERT INTO `teacher` VALUES (4,'James','Bond','2010-01-24',150), (16,'Chadwick','Boseman','2008-06-19',4), (18,'Danai','Gurira','2008-08-14',16), (24,'Paul','Rudd','2007-08-16',18), (25,'Gemma','Chan','2006-02-14',4), (52,'Mark','Ruffalo','2016-04-12',138), (60,'Chris','Evans','2016-07-01',138), (76,'Ryan','Reynolds','2001-05-18',101), (77,'Brie','Larson','2003-02-20',18), (89,'Tom','Hiddleston','2020-06-05',101), (101,'Chris','Pratt','2008-06-19',172), (119,'Tom','Holland','2017-11-07',138), (138,'Robert','Downey','2003-07-09',52), (146,'Scarlett','Johansson','2020-06-05',4), (150,'Anthony','Mackie','2015-02-26',18), (172,'Benedict','Cumberbatch','2006-02-14',18), (193,'Jeremy','Renner','2014-07-11',101); UNLOCK TABLES; DROP TABLE IF EXISTS `subject`; CREATE TABLE `subject` ( `subjectNumber` int NOT NULL, `name` varchar(100) DEFAULT NULL, `gradeLevel` varchar(2) DEFAULT NULL, PRIMARY KEY (`subjectNumber`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; LOCK TABLES `subject` WRITE; INSERT INTO `subject` VALUES (9,'Astronomy','9'), (13,'US History','12'),(23,'Geography','10'), (33,'Biology','10'),(35,'Entomology','9'), (43,'Algebra II','10'), (53,'Self Defense','12'), (62,'Algebra','9'), (67,'Literature','12'), (70,'Norse Mythology','10'), (78,'World History','11'), (83,'Legal Studies','11'), (85,'Introduction to Computer Science','11'); UNLOCK TABLES; DROP TABLE IF EXISTS `student`;
  • 4. CREATE TABLE `student` ( `studentNumber` int NOT NULL, `schoolNumber` int NOT NULL, `firstName` varchar(50) DEFAULT NULL, `lastName` varchar(50) DEFAULT NULL, `birthDate` date DEFAULT NULL, PRIMARY KEY (`studentNumber`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; LOCK TABLES `student` WRITE; INSERT INTO `student` VALUES (1093,45,'Hermione','Granger','2006-11-24'), (1217,45,'Ron','Weasley','2005-08-17'), (1440,345,'Britta','Perry','2006-05-21'), (1448,93,'Jessie','Spano','2007-02-15'), (1601,54,'Eric','Mathews','2005-08-22'), (1803,119,'Tyra','Collette','2007-08-02'), (1927,93,'Kelly','Kapowski','2009-02-22'), (1972,93,'Samuel','Powers','2007-04-14'), (2036,345,'Annie','Edison','2006-05-25'), (2056,119,'Taylor','Kitsch','2009-08-08'), (2168,119,'Zach','Gilford','2005-08-02'), (2213,119,'Jason','Street','2006-01-17'), (2258,54,'Topanga','Lawrence','2008-03-05'), (2411,45,'Harry','Potter','2006-09-15'), (2492,345,'Jeff','Winger','2008-08-10'), (2600,45,'Neville ','Longbottom','2007-11-01'), (2725,54,'Shawn','Hunter','2008-05-31'), (2732,93,'Zack','Morris','2008-02-18'), (2895,54,'Cory','Mathews','2007-02-17'), (2932,345,'Abed','Nadir','2007-04-15'); UNLOCK TABLES; DROP TABLE IF EXISTS `school`; CREATE TABLE `school` ( `schoolNumber` int NOT NULL, `name` varchar(200) DEFAULT NULL, `address` varchar(95) DEFAULT NULL, `phoneNumber` varchar(10) DEFAULT NULL, `built` date DEFAULT NULL, `size` int DEFAULT NULL, PRIMARY KEY (`schoolNumber`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
  • 5. LOCK TABLES `school` WRITE; INSERT INTO `school` VALUES (45,'Hogwarts Scool of Witchcraft and Wizardry','738 North Williams Ave.','5056448362','2000-11-14',414000), (54,'John Adams High School','8226 Selby Lane','5056444088','2012-12-13',118500), (93,'Bayside High','7914 Aspen Drive','5057756575','2000-08-20',175645), (119,'Dillon High School','475 South University Ave.','5058672818','2006-10-03',102598), (345,'Green Dale High','772 Grand St.','5056624410','2009-09-17',250345); UNLOCK TABLES; DROP TABLE IF EXISTS `class`; CREATE TABLE `class` ( `teacherID` int NOT NULL, `studentNumber` int NOT NULL, `subjectNumber` int NOT NULL, `grade` int DEFAULT NULL, PRIMARY KEY (`teacherID`,`studentNumber`,`subjectNumber`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; LOCK TABLES `class` WRITE; UNLOCK TABLES; DROP TABLE IF EXISTS `administrator`; CREATE TABLE `administrator` ( `employeeNumber` int NOT NULL, `schoolNumber` int NOT NULL, `firstName` varchar(50) DEFAULT NULL, `lastName` varchar(50) DEFAULT NULL, `phoneNumber` varchar(10) DEFAULT NULL, `officeNumber` varchar(3) DEFAULT NULL, PRIMARY KEY (`employeeNumber`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; LOCK TABLES `administrator` WRITE; INSERT INTO `administrator` VALUES (430,45,'Albus','Dumbledore','2072087222','201'), (161,345,'John','Oliver','4255510706','321'),