A retail chain owns several stores. Each store, depending on its size
and the range of products it stocks, is designated as being either a regional
or a local store. Each employee works at a single store. Some employees may
manage a store.
Please see attached
Employee (EmployeeNo, Name)
Store (StoreCode, Type)
Product (ProductCode, Description,
The EmployeeNo attribute of Employee takes a character string value in the
range 00000 to 99999.
The StoreCode attribute of Store takes a character string value in the range 00000 to 99999.
The Type attribute of Store takes a value of either regional or local store.
The ProductCode attribute of Product takes a character string value in the
range 00000 to 99999. (a) Give the SQL required to
create a database that represents the E–R data model for the retail chain given
in Figure 1.
In your database definition, you should use:
‘posted foreign key’ approach to implement the WorksAt and Manages
domains to implement the additional constraints.
(b) Give the SQL
required to modify the database definition you gave as your solution to part
(a) to include CHECK constraints that
represent the following additional constraints:
c.5 The manager
of a store (represented by an occurrence of the Manages relationship) works at
the same store (represented by an occurrence of the WorksAt relationship).
stores must stock all of the products.