I am having issues with executing this in mysql and getting foreign key related error. Please assist with necessary correction   ------------------------------------------start -------------------------------------------- Create schema video_world   Create Table CITIZEN( Citizen_Memid int NOT NULL, Citizen_Name varchar(30), Citizen_Address varchar(100), primary key (Citizen_Memid) );   Create Table CD ( Cd_ID int NOT NULL, Cd_Title varchar(50), primary key (Cd_ID) );   Create Table borrowedrecords ( borrowedrecordid int NOT NULL, Citizen_Memid int NOT NULL, pending_dues decimal(5,2) borroweddate_time datetime, returndate_time datetime, foreign key (Citizen_Memid) references CITIZEN(Citizen_Memid), primary key (borrowedrecordid), );   Create Table CitizenKeyfob ( Citizen_Memid int NOT NULL, borrowedrecordid int NOT NULL, Cd_ID int NOT NULL, foreign key (Citizen_Memid) references (CITIZEN) foreign key (borrowedrecordid) references (borrowedrecords) foreign key (Cd_ID) references (Cd) );   INSERT INTO Citizen (Citizen_Memid, Citizen_Name, Citizen_Address) VALUES ('10001', 'Christian' , '345 North st')   INSERT INTO Cd (Cd_ID, Cd_Title) VALUES ('93883838', 'Jumanji')   INSERT INTO borrowedrecords (borrowedrecordid, Citizen_Memid, pending_dues, returndate_time) VALUES ('919333', '10001', '0', '2020-05-20 09:16:23')   INSERT INTO CitizenKeyfob (Citizen_Memid, borrowedrecordid, Cd_ID) VALUES ('10001', '919333', '93883838')

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

I need help with figuring out why my sql statements are not working properly.

Here is the complete list of query i wrote. I am having issues with executing this in mysql and getting foreign key related error. Please assist with necessary correction

 

------------------------------------------start --------------------------------------------

Create schema video_world

 

Create Table CITIZEN(

Citizen_Memid int NOT NULL,

Citizen_Name varchar(30),

Citizen_Address varchar(100),

primary key (Citizen_Memid)

);

 

Create Table CD

(

Cd_ID int NOT NULL,

Cd_Title varchar(50),

primary key (Cd_ID)

);

 

Create Table borrowedrecords

(

borrowedrecordid int NOT NULL,

Citizen_Memid int NOT NULL,

pending_dues decimal(5,2)

borroweddate_time datetime,

returndate_time datetime,

foreign key (Citizen_Memid) references CITIZEN(Citizen_Memid),

primary key (borrowedrecordid),

);

 

Create Table CitizenKeyfob

(

Citizen_Memid int NOT NULL,

borrowedrecordid int NOT NULL,

Cd_ID int NOT NULL,

foreign key (Citizen_Memid) references (CITIZEN)

foreign key (borrowedrecordid) references (borrowedrecords)

foreign key (Cd_ID) references (Cd)

);

 

INSERT INTO Citizen (Citizen_Memid, Citizen_Name, Citizen_Address)

VALUES ('10001', 'Christian' , '345 North st')

 

INSERT INTO Cd (Cd_ID, Cd_Title)

VALUES ('93883838', 'Jumanji')

 

INSERT INTO borrowedrecords (borrowedrecordid, Citizen_Memid, pending_dues, returndate_time)

VALUES ('919333', '10001', '0', '2020-05-20 09:16:23')

 

INSERT INTO CitizenKeyfob (Citizen_Memid, borrowedrecordid, Cd_ID)

VALUES ('10001', '919333', '93883838')

 

--------------------------------------------------------end -----------------------------------------

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Analysis of Performance Measurement
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education