Question: Before you start recording, write a CREATE TABLE statement that creates a new table for the Sakila database called MyMovies. You will design this table

Before you start recording, write a CREATE TABLE statement that creates a new table for the Sakila database called MyMovies. You will design this table yourself, but in your CREATE TABLE you must demonstrate the following concepts:
A column with a NOT NULL constraint
A primary key
A foreign key (referencing one of the existing tables in the Sakila database)
ON UPDATE or ON DELETE clause
A named CHECK constraint
Start recording:
Explain your CREATE TABLE statement and what each of the clauses mean
Add 2 of your favorite movies to the table. (I want you to "live code" this, though you can copy the data values from elsewhere to save you time, if you'd like.)
Make an update or deletion to anything in the database that demonstrates how your ON UPDATE or ON DELETE clause works. (I want you to "live code" this too!)
As you're writing SQL code, please explain the code! (This skill takes practice, but you show much greater levels of expertise if you can code & explain your code simultaneously, like if you were asked to write SQL code in an interview for example...)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!