SQL database definition

May 20th, 2013
Price: $15 USD

Question description

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.

Tutor Answer

(Top Tutor) Daniel C.
School: University of Virginia

Studypool has helped 1,244,100 students

Review from our student for this Answer

May 22nd, 2013
"Top quality work from this guy! I'll be back!"
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1824 tutors are online

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