+1(978)310-4246 credencewriters@gmail.com
  

Assignment 1
Submit your responses as a PDF file via Canvas by the due date.
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 superkeys for this relation?
c. Which of the superkeys 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
Assume that a customer makes only one order on any given day.
Develop the schemas for each of the above relations, including primary keys and foreign
keys, using only attributes representing the information described above. Note that for
the sales transaction relation, you must develop foreign keys that refer to the customer
table and the inventory table.
Page 1 of 4
3. Consider the following set of tables describing students and school clubs:
Student
ClubMemberships
SID Name Gender Status GPA
100 Bill
M
Fr
3.3
Clubs
101 John
M
So
2.1
CID
Name MtgRm
102 Sue
F
Jr
3.2
1
Chess 144
103 Mary F
Sr
3.6
2
Debate 145
105 Jane
Fr
2.9
F
CID
SID
1
100
1
200
1
300
2
300
2
400
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?
6. Consider the following scenario from your textbook on page 118 dealing with a chain of
hotels that need to manage the bookings of their guests into rooms at specific hotels in
the chain. The hotel chain maintains four tables in order to manage this information:
Hotel(hotelNo, hotelName, city)
Room(roomNo, hotelNo, type, price)
Booking(hotelNo, guestNo, dateFrom, dateTo, roomNo)
Guest(guestNo, guestName, guestAddress, guestPhoneNo, guestEmail)
The underlined attribute(s) of each relation form the primary key of the relation.
a. Identify foreign key relations in the tables that will allow the appropriate referential
integrity rules to be applied. For each foreign key relation, specify the referring table, the
primary table, and the attributes that form the foreign key in the referring table. For
example, a guest should not be booked into a non-existing room at a hotel. A guest
should not be booked into a room unless there is information about the guest.
Page 2 of 4
For the remaining questions, use the following set of relational database tables to the
results for the relational algebra expressions.
R3
F G H
R1
R2
j y i
A B C D
C D E F
s t
1 e 4
e
2 s 11 t
t f s
2 g 9
g
4 e 8
d
x b o
9 h 15 k
d a w
3 x 13 f
f
7. 𝜎𝐸
Purchase answer to see full
attachment

  
error: Content is protected !!