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.
Implement a new strong entity phone, as shown in the following diagram:
The diagram has four entities and three relationships. The entities are phone, store, staff, and customer. Phone has attributes phoneid R U countrycode R phonenumber R and phonetype. Store, staff, and customer have no attributes. The relationships are storehasphone, staffhasphone, and customerhasphone. All relationships have cardinality oneone maximum and zerozero minimum.
The diagram uses Sakila naming conventions. Follow the Sakila conventions for your 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 Remove the phone column from address. This column is replaced by the new strong entity.
Step Implement the strong entity as a new phone table. Specify data types VARCHAR for phonetype and integer for other columns. Specify a suitable primary key and NOT NULL constraints according to the diagram.
Step Implement the has relationships as foreign keys in customer, staff, and store. Specify UNIQUE constraints according to the diagram. Specify SET NULL for delete rules and CASCADE for update rules, as follows:
ALTER TABLE customer
ADD FOREIGN KEY phoneid REFERENCES phonephoneid ON DELETE SET NULL ON UPDATE CASCADE;
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