Ass#2 - University Directory: Western Illinois University

advertisement
School of Computer Science
IS 342
Assignment#2
Western Illinois University
Amaravadi
Worth: 20 Pts
DATABASE BASICS
Due: ___/____/____
Answer the following problems on this sheet itself. Please make sure your work is professional (you do
not have to type it).
1.
2.
Identify five important attributes for each of the following entity classes (5pts):
a. automobile parts:
b.
airline flights:
c.
houses:
d.
insurance policies:
e.
business expense (such as what an employee may incur on a business trip):
Go to the Port of Grays Harbor, [http://www.portofgraysharbor.com/]and identify four different
types of entity classes and four attributes (one attribute for each entity class) related to the harbor.
Make sure they are directly concerned with ships and shipping and they are important. Be sure to
apply the “would we be interested in this data?” test (2pts).
3.
Draw an enterprise data model (such as shown below/see also notes on Database Planning) for
each of the following situations i.e. draw separate models for each situation (2pts):
has
Company
Customers

A ship can use several berths while in the harbor. A berth can be used by several ships.

A car can have several parts, a part can go into more than one type of car.

A student can win several awards, an award is given to only one student.

A board supervises a single school district. A school district has only one board.
2
4.
Draw an (integrated) enterprise data model for the following banking situation using these
assumptions (3pts):
a. Entity classes are Branch, Manager, Customer, Teller, Account, and Transactions.
b. A branch can have several customers, but a customer is associated with a single branch.
c. A branch can have several tellers but a teller may work at only one branch.
d. An account is serviced by one branch only, but there can be several accts per branch.
e. A customer can have more than one account (savings, checking, loan etc.) and the account can
be operated by more than one account holder.
f. A customer can perform more than one transaction (deposit, withdrawal), but each transaction,
(designated by a transaction id) is performed by only one customer.
g. A branch has one manager only and a manager works for a particular branch.
h. A teller can handle multiple transactions. A transaction is performed by one teller only.
3
5.
Develop an enterprise data model for the following campus interviewing situation. Recruiters
representing different companies arrive on campus during the recruiting season. Each recruiter
represents only one company. Larger companies may send more than one recruiter. Each recruiter
is assigned a booth where interviewing will take place. [Obviously more than one recruiter may
share a booth]. Companies offer one or more positions. Candidates interview with recruiters for
positions in their respective organizations. A recruiter may be trying to find candidates for more
than one position. A recruiter may interview one or more candidates for each position. A candidate
can interview with several recruiters. (4pts)
6.
Write SQL commands based on the tables given below, to produce a listings of the following:
a. List the product number and description for all dining room furniture (ROOM = 'DR'). (1
point).
b. List the name and address for customer number C325 (1 point)
c. List the customer number, name and the orders they placed. (1 point).
4
d. List the results of running the query in “c” above. (1 point).
5
-----THIS IS A TUTORIAL PLEASE DO NOT SUBMIT THIS PART--------NOTE THAT AN SQL COMMAND HAS THE FOLLOWING FORMAT:
Select <attribute1>, <attribute2>, …
From <table1>,< table2>,…
Where <condition1>, <condition2>…;
For e.g. to select all order information for orders placed after 8/24, we write:
Select Order#, Date, Customer#
From Order
Where Date > 8/24;
For producing a listing of all customer names and addresses, we write:
Select Name, Address
From Customer;
For producing a listing of all Product#s, Descriptions, Finish and Price for Chairs and Tables, we
write:
Select Product#, Description, Finish, Unit Price
From Product
Where (Description = ‘Chair’ ) or (Description = ‘Table’);
To find vendors supplying tables we write:
Select Vendor#
From Product, Vendor
Where Product.Description = “Table” and
Product.Product# = Vendor.Product#
6
Pine Valley Furniture Database
PRODUCT
Prod#
0100
0350
0625
0975
1000
1250
1425
Description
Table
Table
Chair
Wall Unit
Dresser
Chair
Bookcase
Finish
Room
Oak
Maple
Oak
Pine
Cherry
Maple
Birch
DR
DR
DR
FR
BR
LR
LR
Unit -Price
500
625
100
750
800
400
250
CUSTOMER
Cust#
Name
Address
C100
C150
C325
C468
C500
Contemporary Casuals
Value Furniture
Home Furnishings
Western Furniture
Impressions
100 Oak Palo Alto CA
200 Walnut Cupertino CA
300 Maple San Jose CA
400 Locust San Francisco CA
500 Pine Redwood City CA
ORDER
Order#
Date
A1000
B2500
C3000
D1500
9/16/XX
10/15/XX
8/20/XX
11/1/XX
Customer#
C325
C468
C325
C500
VENDOR
Product#
0350
0625
0975
1000
1250
1425
Vendor#
VF88
VF88
VF88
QS145
TB899
TB899
7
Download