Download COSC 5040 – Distributed Database Design

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Microsoft Jet Database Engine wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Clusterpoint wikipedia , lookup

Database model wikipedia , lookup

Relational algebra wikipedia , lookup

Relational model wikipedia , lookup

Transcript
6/30/2017
Page 1
Name: ______________________________________
COSC 5040 – Distributed Database Design
Week 1 Homework
1. 3.12 (page 81) Consider the AIRLINE relational database schema shown in Figure 3.8, which
describes a database for airline flight information. Each FLIGHT is identified by a flight
NUMBER, and consists of one or more FLIGHT_LEGs with LEG_NUMBERs 1, 2, 3, etc.
Each leg has scheduled arrival and departure times and airports, and has many
LEG_INSTANCEs--one for each DATE on which the flight travels. FARES are kept for each
flight. For each leg instance, SEAT_RESERVATIONs are kept, as is the AIRPLANE used in
the leg, and the actual arrival and departure times and airports. An AIRPLANE is identified by
an AIRPLANE_ID, and is of a particular AIRPLANE_TYPE. CAN_LAND relates
AIRPLANE_TYPEs to the AIRPORTs in which they can land. An AIRPORT is identified by an
AIRPORT_CODE. Consider an update for the AIRLINE database to enter a reservation on a
particular flight or flight leg on a given date.
6/30/2017
Page 2
Specify all the referential integrity constraints on Figure 3.8 using the following format.
Schema (Table) Name
Attribute #1
Attribute #2
Attribute #3
Attribute #4
Attribute #5
Primary Key: Attribute #1
Foreign Key: Attribute #4 Relates to <Attribute Name> in <Schema Name>
ETC.
6/30/2017
Page 3
6/30/2017
Page 4
2. 3.14 (page 82) Consider the following six relations for an order-processing database
application in a company:
CUSTOMER (Cust#, Cname, City)
ORDER (Order#, Odate, Cust#, Ord_Amt)
ORDER_ITEM (Order#, Item#, Qty)
ITEM (Item#, Unit_price)
SHIPMENT (Order#, Warehouse#, Ship_date)
WAREHOUSE (Warehouse#, City)
Here, Ord_Amt refers to total dollar amount of an order; Odate is the date the order was
placed; Ship_date is the date an order (or part of an order) is shipped from the warehouse.
Assume that an order can be shipped from several warehouses. Specify the foreign keys for
this schema using the following format.
Schema (Table) Name
Attribute #1
Attribute #2
Attribute #3
Attribute #4
Attribute #5
Primary Key: Attribute #1
Foreign Key: Attribute #4 Relates to <Attribute Name> in <Schema Name>
ETC.
6/30/2017
Page 5
3. 4.10 (page 112) Develop the SQL code for the following queries on the COMPANY relational
database schema. Show the result of each query.
a. Retrieve the names of all employees in department 5 who work more that 10 hours per
week on the ProductX project.
b. List the name of all employees who have a dependent with the same first name as
themselves.
c. Find the names of all employees who are directly supervised by ‘Franklin Wong’.