DBMS Assignment
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 there 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:
a. What is the schema for this relation (the attributes or columns and their domains or types)?
b. What are possible super keys for this relation?
c. Which of the super keys identified above are the candidate keys for the relation?
d. What is the best choice from the candidate keys for the primary key of the relation?
2. Consider the previous scenario. Suppose now that the company wants to also build relations that describe its inventory and sales transactions. For the inventory, the store keeps track of the following:
· The product manufacturer name
· The product model number
· The number in stock
· The wholesale price
· The retail price
A manufacturer has many products, each of which has a product number that is unique for that manufacturer. However, two manufacturers could have the same product numbers for some of their products.
For the sales transactions, the company tracks the following
· The customer id of the customer making the sale
· The date of the sale
· The product purchased model number
· The product purchased manufacturer name
· The price paid including tax
3. Consider the following set of tables describing students and school clubs:
a. Assuming that SID and CID are unique identifiers, what are likely primary keys for the Student and Clubs tables?
b. What is the primary key for the ClubMemberships table?
c. What are foreign keys necessary for this set of tables in order to ensure that only registered students can be in clubs and students can only join registered clubs?
4. Can you add the following tuple to the ClubMemberships table based on your foreign keys?
(3, 200)
Why or why not?
5. Can you add the following tuple to the ClubMemberships table based on your foreign
keys?
(1, 101)
Why or why not?