Note that for the sales transaction relation
Dr Dave Pitts | CS610AH2: Database Management | Spring 2014 |
---|
Assignment 1
1. Consider the following scenario: a company has a number of customers who have addresses and phone numbers and we assume that while their may be multiple customers with the same address, no two customers with the same name have the same address or the same phone number. Each customer has a customer id, which is unique to that customer. Suppose that this information is stored as a relational database relation or table. Answer the following:
2. Consider the previous scenario. Suppose now that the company wants to also build relations that describes its inventory and its sales transactions. For the inventory, the store keeps track of the following:
◦ the product manufacturer
For the sales transactions, the company tracks the following
◦ the customer making the sale
Develop the schemas for each of the above relations, including primary keys. Note that for the sales transaction relation, you must develop foreign keys that refer to the customer table and the inventory table.
3. Suppose that company created a unique transaction id for each customer purchase. How would that change your schema for the sales transaction table in the previous question in terms of candidate keys?
R1 | R2 |
|
|
j | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A B C | C D E | s t | f | ||||||||||||
1 e 4 | 2 s |
|
t | f | s | ||||||||||
2 g 9 |
|
4 e | 8 | ||||||||||||
9 h 15 k | d a | w | |||||||||||||
4. | |||||||||||||||
5. |
|
||||||||||||||
6. |
|
||||||||||||||
7. | |||||||||||||||
8. | |||||||||||||||
9. | |||||||||||||||
10. | |||||||||||||||
11. |
|
||||||||||||||
12. |
|
||||||||||||||
13. | |||||||||||||||
14. | |||||||||||||||
15. | |||||||||||||||
|
|||||||||||||||
100 Bill | M | Fr | 3.3 |
|
ClubID | ||||||||||
M | So | ||||||||||||||
ClubID Name | Meeting | ||||||||||||||
|
|
||||||||||||||
102 Sue | F | Jr | 3.2 | Room | |||||||||||
Chess | |||||||||||||||
103 Mary F | Sr | 3.6 | |||||||||||||
105 Jane | F | Fr | 2.9 |
|
|
||||||||||
2/3
Write the relational algebra expressions that will produce tables with the following information, using the tables Student, Club, ClubMem show above.