5.7 LAB - Implement supertype and subtype entities (Sakila) Refer to the customer and staff tables of the Sakila databas

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

5.7 LAB - Implement supertype and subtype entities (Sakila) Refer to the customer and staff tables of the Sakila databas

Post by answerhappygod »

5 7 Lab Implement Supertype And Subtype Entities Sakila Refer To The Customer And Staff Tables Of The Sakila Databas 1
5 7 Lab Implement Supertype And Subtype Entities Sakila Refer To The Customer And Staff Tables Of The Sakila Databas 1 (89.95 KiB) Viewed 30 times
5.7 LAB - Implement supertype and subtype entities (Sakila) Refer to the customer and staff tables of the Sakila database. These tables have many columns in common and represent similar entities. Convert the customer and staff entities into subtypes of a new supertype person address belongs to 1(1) M(0) • address_id has data type SMALLINT UNSIGNED. • store_id has data type TINYINT UNSIGNED. person_id first_name last name email active last update 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 • All columns are NOT NULL • The person_id columns have data type SMALLINT UNSIGNED. • The last_update and create_date columns have data type TIMESTAMP. • The picture column has data type BLOB. • All other columns have data type VARCHAR(20). DROP TABLE customer, staff; ALTER TABLE payment person Implement supertype and subtype entities as person, customer, and staff tables with primary key person_id. Implement attributes as columns: staff • person_id picture username password Implement the dependency relationships between subtype and supertype entities as foreign keys: The person_id columns of customer and staff become foreign keys referring to person. • Specify CASCADE actions for both relationships. Implement the belongs to and works at relationships as foreign keys: • belongs to becomes an address_id foreign key in person referring to address. • works_at becomes a store_id foreign key in staff referring to store • Specify RESTRICT actions for both relationships. DROP CONSTRAINT fk payment_customer, DROP CONSTRAINT fk_payment_staff; ALTER TABLE rental ALTER TABLE store customer • person_id create_date DROP CONSTRAINT fk_rental_customer, DROP CONSTRAINT fk_rental_staff; The address and store tables, with primary keys address_id and store_id, are pre-defined in the zyLab environment. Foreign keys must have the same data types as the referenced primary keys: works at M(0) 1(1) DROP CONSTRAINT fk_store_staff; If you execute your solution with the Sakila database, you must first drop customer, staff, and all constraints that refer to these tables. Use the following statements with Sakila only, not in the zyLab environment: store
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply