Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Refer to the address, store, staff, and customer tables of the Sakila database. In this lab, these tables initially have the same columns as in
Refer to the address, store, staff, and customer tables of the Sakila database. In this lab, these tables initially have the same columns as in Sakila, however some constraints are different.
The customer and staff tables have many common columns. Move these columns to a new supertype table person, as shown in the following diagram:
The diagram has five entities and two relationships. The entities are person, staff, customer, address, and store. Person is a super type entity, with subtypes staff and customer. Staff appears above customer, within person. Address and store appear outside person. Person has attributes personid R U firstname, lastname, email, active, and lastupdate. Staff has attributes personid R U picture, username, and password. Customer has attributes personid R U and createdate. Address and store have no attributes. Relationship addressbelongstoperson has cardinality onemany maximum and onezero minimum. Relationship staffworksatstore has cardinality manyone maximum and zeroone minimum.
Follow Sakila conventions for table and column names:
All lower case
Underscore separator between root and suffix
Foreign keys have the same name as referenced primary key
Implement the diagram in three steps:
Step Create a person supertype table:
Create a primary key personid 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 belongsto relationship as a foreign key constraint on addressid Specify the same foreign key rules as in customer and staff.
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