Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ERROR 3780 (HY000) at line 14: Referencing column 'HorseID' and referenced column 'ID' in foreign key constraint 'lessonschedule_ibfk_1' are incompatible. Correct this code: 1 CREATE
ERROR 3780 (HY000) at line 14: Referencing column 'HorseID' and referenced column 'ID' in foreign key constraint 'lessonschedule_ibfk_1' are incompatible.
Correct this code:
1 CREATE TABLE Horse ( ID 2 3 RegisteredName VARCHAR(15), 4 PRIMARY KEY (ID) 5 6 7 8 9 10 11 PRIMARY KEY (ID) 12 ); 13 ); SMALLINT UNSIGNED AUTO_INCREMENT, CREATE TABLE Student ( ID FirstName LastName Main.sql SMALLINT UNSIGNED AUTO_INCREMENT, VARCHAR (20), VARCHAR(30), 14 CREATE TABLE LessonSchedule ( 15 HorseID INTEGER NOT NULL, 16 Student ID INTEGER, 17 LessonDateTime DATETIME NOT NULL, 18. PRIMARY KEY (HorseID, LessonDateTime), 19 FOREIGN KEY (HorseID) REFERENCES Horse (ID) ON DELETE CASCADE, 20 FOREIGN KEY (StudentID) REFERENCES Student (ID) ON DELETE SET NULL 21 ); 22 23 24 | Load default template... 1 CREATE TABLE Horse ( ID 2 3 RegisteredName VARCHAR(15), 4 PRIMARY KEY (ID) 5 6 7 8 9 10 11 PRIMARY KEY (ID) 12 ); 13 ); SMALLINT UNSIGNED AUTO INCREMENT, CREATE TABLE Student ( ID FirstName LastName Main.sql SMALLINT UNSIGNED AUTO INCREMENT, VARCHAR (20), VARCHAR(30), 14 CREATE TABLE LessonSchedule ( 15 HorseID INTEGER NOT NULL, 16 Student ID INTEGER, 17 LessonDateTime DATETIME NOT NULL, 18. PRIMARY KEY (HorseID, LessonDateTime), 19 FOREIGN KEY (HorseID) REFERENCES Horse (ID) ON DELETE CASCADE, 20 FOREIGN KEY (StudentID) REFERENCES Student (ID) ON DELETE SET NULL 21 ); 22 23 24 | Load default template...
Step by Step Solution
There are 3 Steps involved in it
Step: 1
The error message indicates that there is a mismatch between the data types of the HorseID column in ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started