0% found this document useful (0 votes)
47 views

Sample Final1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Sample Final1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Computer and Information Science 631

Final Examination

• You are allowed to bring to the exam one sheet of paper HAND-WRITTEN on both sides (if
needed). On this sheet of paper you can write down what you think you will need for the exam.

• There is no question during the exam. If you are unsure, write down your assumptions

• The total points is 100

1 Database Design [40]


You have to design a database to store the data needed to run a movie distribution company.
The database keeps track of all movies currently available to be shown in theaters. Each movie is
identified by a unique ID, a title, the producer, and the release date. Other information recorded in the
database about each movie is its rating. At any given time, the distribution company wants to know which
theaters are playing which movies. For every movie, the company would like to know the actors cast in the
movie.

the actors appearing in the movie, and which local distributors are distributing the movie.

The database should keep track of each movie theater currently operational. Each theater is identified by
an ID but also its name and location. The manager of the theater and the number of screens (at least one) in
the theater are also recorded. For each movie showing in the theater, both its identifying information and the
local distributor providing the movie are recorded. Each theater may use several distributors, but only one
distributor provides any one movie. A movie house always has as many movies showing as it has screens. The
start date and end date of any movies showing in the theater are also recorded.
The database keeps information on movie reviews. For each review the following information is kept: the
movie reviewed, the reviewer, the date the review was written, the publisher of the review (e.g. NY Times,
PBS,MSNBC), and the text of the review. (Even if a review appears in several forms, e.g. Web,
newspaper, TV, it has only one publisher.)
The business name, proprietor, address and telephone number of each local distributor are recorded.
Local distributors are uniquely identified by their business names. The movies each distributor carries for
distribution are recorded. Information is kept on actors, specifically each actors name, mandatory Actors Equity
unique ID number, agent, and a scalar measure of the actors ability to draw viewers. An actor need not have
an agent, but cannot have more than one agent. Information is kept on agents who can represent actors,
specifically each agents name, mandatory unique taxpayer ID, address, telephone number and email
address.

1
1. Identify entity types and attributes
2. Identify relationships types and mapping cardinalities
3. List 10 functional dependencies
4. Present a complete ER diagram
5. Give a step by step mapping of the ER diagram to the relational model.

2 Database Querying [35]


Consider the relations:
Customer(CID, Name, City), Order(OID,
CID, Date), and LineItem(LID,
OID,Product, Amount),
where CID is a customer id and is a key for Customer, OID is an order id and is a key for Order, and LID is
a line item id and is a key for LineItem. In addition the attribute CID of Order is a foreign key referring to
the CID of Customer, that is, for each CID c of Order there is exactly one tuple of Customer whose CID
attribute is c. The OID of LineItem is a foreign key referring to the OID of Order.
Express the following queries (I) in Tuple Relational Calculus (1 and 2), (II) in Algebra
(3 to 4), (III) in SQL (1 to 5):
1. List the customers who ordered computers
2. List the customers who ordered all the products
3. List the products bought by all the customers of Newark
4. List the products ordered only by the customers of Newark
5. List the average number of items per order

2
3 Logical Query Plan Transformation [15]
Consider the two relations R(A,B,C) and S(C,D,E). Consider the following relational algebra expression:
ΠA,B σS>C=5∧R.A=10∧R.C=S>C (R × S)

Transform this expression into an equivalent expression that

• Has no Cartesian product

• Performs projections as early as possible

• Performs selections as early as possible (give selections ”priority” over projections)

You might also like