SQL database definition

Question Description

Need help with my Programming question - I’m studying for my class.

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.

Entity-relationship diagram


Please see attached

Entity types

Employee (EmployeeNo, Name)

Store (StoreCode, Type)

Product (ProductCode, Description, Cost)

Additional constraints

c.1 The EmployeeNo attribute of Employee takes a character string value in the range 00000 to 99999.

c.2 The StoreCode attribute of Store takes a character string value in the range 00000 to 99999.

c.3 The Type attribute of Store takes a value of either regional or local store.

c.4 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:


the ‘posted foreign key’ approach to implement the WorksAt and Manages relationships;

SQL 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:

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).

c.6 Regional stores must stock all of the products.

Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

Final Answer

muhoilya (4)

Top quality work from this tutor! I’ll be back!

Just what I needed… fantastic!

Use Studypool every time I am stuck with an assignment I need guidance.


Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors