Consider the following database schema:

1. Supplier(SName, ItemName, Price)—supplier SName sells item ItemName at Price

2. Customer(CName, Address)—customer CName lives at Address.

3. Order(CName, SName, ItemName, Qty)—customer CName has ordered Qty of item ItemName from supplier SName.

4. Item(ItemName, Description)—information about items.

(a) Draw the E-R diagram from which the above schema might have been derived. Specify the keys.

(b) Suppose now that you want to add the following constraint to this diagram: Every item is supplied by some supplier . Modify the diagram to accommodate this constraint. Also show how this new diagram can be translated back to the relational model.



(c) Repeat parts (a) and (b) in UML.




(a) The key of Supplier is SName, ItemName;ofCustomer is CName; of Item is ItemName;andofOrder is CName, SName, ItemName (and,
possibly, Qty, if multiple orders for the same item from the same supplier are allowed).
(b) One possible relational tables corresponding to this E-R diagram:
```
CREATE TABLE Customer (
CName CHAR(10) NOT NULL,
Address CHAR(20),
PRIMARY KEY(CName));

CREATE TABLE Supplier (
SName CHAR(10) NOT NULL,
PRIMARY KEY(SName));

CREATE TABLE Item (
ItemName CHAR(10) NOT NULL,
Description CHAR(20),
Price FLOAT,
SName CHAR(10) NOT NULL,
PRIMARY KEY(ItemName, SName),
FOREIGN KEY(SName) references Supplier);
CREATE TABLE Order (
CName CHAR(10) NOT NULL,
SName CHAR(10) NOT NULL,
ItemName CHAR(10) NOT NULL,
Qty INTEGER,
PRIMARY KEY(CName, SName, ItemName),
FOREIGN KEY(CName) REFERENCES Customer,
FOREIGN KEY(SName) REFERENCES Supplier,
FOREIGN KEY(ItemName) REFERENCES Item);
```

Computer Science & Information Technology

You might also like to view...

The code that will swap the first two elements of an array called friends is:

a) friends[0] = friends[1]; friends[1] = friends[0]; b) temp = friends[1]; friends[2] = friends[1]; friends[1] = temp; c) temp = friends[0]; friends[1] = friends[0]; friends[0] = temp; d) temp = friends[0]; friends[0] = friends[1]; friends[1] = temp;

Computer Science & Information Technology

The ____________________ Tool creates polygons or stars.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

In JavaScript, the ____ object refers to the Web page where the text in HTML documents and output from your JavaScript programs are displayed.

A. HTTP B. document C. UML D. DNS

Computer Science & Information Technology

What are the various ways images can be classified?

What will be an ideal response?

Computer Science & Information Technology