Answered step by step
Verified Expert Solution
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
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: LAB Implement supertype and subtype entities Sakila
Similar antities rave mary commonattibutes and re azionships. Similar erities are often converted into subtypes a supertype er:ity as
IlL srated 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 sjffix
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 onc th data type SMaLINI JNSGNED.
The lastrivate and createdate cou nn have data type TIMEsTMP
The picturacoluminhas da:a type sLob.
All other columnaharc cata type varciar
Inclement the belongsto anc wa:ksat relationships as foreign key's:
wozksazbecomesa atcreid torelgn key In staff wl:h cata type INYINI UNSI GNED.
Specify RESTRICT 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
ATER TABLE payment
DROP CONSTRAINT tkpaymentcuszomer,
drop congtraint fkpaymentstaff;
AI'LK T'ABLE rental
IROD CONSTRAINT fkrontilcuotomor,
IROR CONSTRAINT fkrentalstaze;
AUTER TABLE store
DROP CONSTRAINT IK sLULE sLafl;
TROF TART.F M:stnmer, stat;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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