Please write the code for this, the language is SQL.
12.6 LAB: Create LessonSchedule table with FK constraints
Two tables are created:
Horse with columns:
ID - integer; primary key
RegisteredName - variable-length string
Student with columns:
ID - integer; primary key
FirstName - variable-length string
LastName - variable-length string
Create the LessonSchedule table with columns:
HorseID - integer with range up to 65 thousand, not NULL; partial primary key; foreign key references Horse(ID)
StudentID - integer with range from 0 to 65 thousand, foreign key references Student(ID)
LessonDateTime - date/time, not NULL; partial primary key
If a row is deleted from Horse, the rows with the same horse ID should be deleted from LessonSchedule automatically. If a row is deleted from Student, the same student IDs should be set to NULL in LessonSchedule automatically.
289852.1856990.4x32q87
LAB ACTIVITY
12.6.1: LAB - Create LessonSchedule table with FK constraints
0 / 10
Main.sql
Load default template:
CREATE TABLE Horse (
ID SMALLINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
RegisteredName VARCHAR(15)
);
CREATE TABLE Student (
ID SMALLINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
FirstName VARCHAR(20),
LastName VARCHAR(30)
);
Your SQL statements go here.