Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4 . 5 LAB - Implement supertype and subtype entities ( Sakila ) Similar entities have many common attributes and relationships. Similar entities are often

4.5 LAB - Implement supertype and subtype entities (Sakila)
Similar entities have many common attributes and relationships. Similar entities are often converted into subtypes of a supertype entity, as illustrated in this lab.
In the Sakila database, the customer and staff tables have several common columns. Convert these tables into subtypes of person. Specifically, write CREATE TABLE statements for person, customer, and staff that implement this ER diagram:4.5 LAB - Implement supertype and subtype entities (Sakila)
Similar antities rave mary commonattibutes and re azionships. Similar er-ities are often converted into subtypes c2 a supertype er:ity as
IlL s.rated in this lac.
In the Sakila database, the cus tomer ard staff tables have several common co umrs. Cor vert these tables into subtypes of persor.
Specificalv, write CFEATE TABLE state nerts for person, customer, and staff th at implement this EF diagram:
=ollow Sakila conventions for :able anc column names:
All lower case
Undarsccre separator betiveen root and s.jffix
Drelon keys have the same name as reterenceo prom a y key
inclement attributes as co unns:
Ine primary key of all three tables is pers on__c'w th data type SMa_LINI JNS_GNED.
The last_rivate and create_date cou nn have data type TIMEsT2MP.
The picturacoluminhas da:a type sLob.
All other columnaharc cata type varciar (20).
Inclement the belongs_to anc wa:ks_at relationships as foreign key's:
wozks_azbecomesa atcre_id torelgn key In st-aff wl:h cata type INYINI UNSI GNED.
Specify R.ESTRICT actiors *or Soth foregn keys.
Kequired rela:ionships become NOI NULL toreign Keys.
Subtype etities have an I on relationship to the superiype. Implement these reation sh ps as foreign keys:
Specity CASCAU= actions tor both toreign keys:
VOTE: If you execuze your solution with the Sakila databa se, you must first drop cus tomcr, zaff, and all constraints that refer to these
ables Use the following statements with Sakila only, not in the zyl ah anviranment
A-TER TABLE payment
DROP CONSTRAINT tk_payment_cuszomer,
drop congtraint fk_payment_staff;
A.I'LK T'ABLE rental
IROD CONSTRAINT fk_rontil_cuotomor,
IROR CONSTRAINT fk_rental_staze;
AUTER TABLE store
DROP CONSTRAINT IK sLULE sLafl;
TROF TART.F M:st.nmer, st.at+;
image text in transcribed

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

More Books

Students also viewed these Databases questions