Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement the diagram in three steps: Step 1 . Create a person supertype table: Create a primary key person _ id with data type SMALLINT

Implement the diagram in three steps:
Step 1. Create a person supertype table:
Create a primary key person_id with data type SMALLINT UNSIGNED.
Add the common columns of customer and staff (refer to the diagram). Specify the same data types and constraints as in customer and staff.
Implement the belongs_to relationship as a foreign key constraint on address_id. Specify the same foreign key rules as in customer and staff.
Step 2. Drop common columns from customer and staff:
Drop columns that moved to person in step 1.
Do not drop last_update, as every Sakila table has this column.
Drop the foreign key constraint on address_id before dropping this column.
Step 3. Implement IsA relationships in customer and staff:
Drop the existing primary key columns.
Add new primary keys person_id with data type SMALLINT UNSIGNED.
Implement the IsA relationships as foreign key constraints on person_id. Specify CASCADE foreign key rules.
HINT: Use ALTER TABLE to add and drop foreign key constraints:
ALTER TABLE customer
ADD FOREIGN KEY (person_id) REFERENCES person(person_id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE customer
DROP FOREIGN KEY customer_ibfk_1;
-- customer_ibfk_1 is a symbol representing the first foreign key declared in customer

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions