Uploaded by Shivam Rustogi

Homework #2

advertisement
HOMEWORK #2
CS 6400- FALL 2021
(Posted: Oct 26; Due on Canvas Nov.2, 2021)
(Total – 60pts., worth 5% of grade after conversion to 4 point scale)
TOPIC – Classic papers: Chen, SEQUEL2, O-O Manifesto and Rel. Algebra,
Calculus, and QBE, SQL).
NOTE: This is the take-home portion of Exam1 to allow you access to the papers and
the book for answering questions that could not be included in the in-class exam. The
GT honor code must be observed; evidence of collaboration will be treated seriously.
For Relational algebra symbols, if you have difficulty, write separately on a piece of
paper, and insert the image if you like. The best way to answer is to place your answer
after every question and then upload as a word or pdf document.
Q1. CHEN PAPER (14 PTS.) [CHEN, 1976]
A) (6 pts.) In section 2, Chen devotes a lot of his discussion to entity sets, value sets
and relationship sets. He defines an attribute of an entity in terms of these sets
as a function. Consider an entity type CAR. It has 3 attributes: VIN (vehicle id
number) ; TAG#, a composite attribute made up of State and Lic_plate_no. and
Color, a multivalued attribute.
(i) Write the mathematical definitions of VIN and TAG# individually as per Chen’s
proposal.
Assume that the value sets are called Vin-value-set, States, Lic-plate-vale-set and
Colors, respectively.
(ii) if both are Keys (or “entity keys” as Chen calls them), what special property is held
by their corresponding function?
(iii) Can the attribute Color be described by this functional notation? Why or why not?
B) ( 4 pts) In Figure 1, Chen refers to four levels of logical views and the
corresponding data models.
At levels 3 and 4 he has “Access-path independent “ and “Access-path-dependent” data
structures. What data models do you think these refer to? Explain what these two terms
signify and state in what way the corresponding data models exemplify those terms.
C)
(4 pts.) On p.22, Chen shows a mapping of the manufacturing database example
ERD into a set of relations. If we were to compare his way of describing the mapped
relations to what SQL CREATE TABLE definitions would look like, point out at least
2 different things (semantic informational items) he is specifying that would be
missing in the SQL definition.
Q2. SEQUEL2 CLASSIC PAPER (6 pts.) [Chamberlin et al. 1976]
Hw#2 (Takehome part2 of exam1)
1
CS6400-Fall'21-Navathe
If you go through this paper, you will find almost all the features of the SQL
language we describe in Chapters 6 and 7 were proposed back then by the
System R researchers. On pages 565-566 (6th -7th page of paper), where they
dealt with Data definition facilities, they describe specifications of access aids
called Image and Link which are not present in today’s SQL.
Given the following 2 relations:
BOOK (Book_ISBN#, Name, Primary_author)
AUTHOR (Author-name, Author_affiliation)
Where the primary keys are Book_ISBN# for BOOK and Author_name for
AUTHOR, and foreign key Primary_author that refers to the AUTHOR table.
Write one example of CREATE IMAGE and one example of CREATE LINK
statement and write in English what your statement accomplishes.
Q3. ( 7 points) O-O Manifesto Paper [Atkinson et al, 1989]
In the manifesto paper, authors included the following among mandatory features
for a DBMS to be object-oriented. Answer the question against each feature
below in a couple of sentences each.
A. Complex Objects: does the relational model have this feature? Do you
think NOSQL systems are primarily having an edge by supporting
them? If so, how?
B. Object identity : how does this concept in O-O compare with the
identifying attribute in ER and the primary key concept in the relational
model? Is this concept more general and hence more powerful?
C. Encapsulation : does this concept pertain to the structure of object or
behavior of object? Comment on how this concept has been borrowed
from programming languages and adapted into databases.
Q3. (33 PTS.) RELATIONAL ALGEBRA, CALCULUS, QBE
Consider the Order processing database:
CUSTOMER (CID, Cname, Phone, City)
ITEM (ITEMID, ItemName, QuantityOnHand, UnitPrice)
ORDERDETAIL (OID, ITEMID, QuantityOrdered)
ORDER (OID, CID, Date)


Primary keys are underlined
CID is a foreign key in Order referencing the Customer relation
Hw#2 (Takehome part2 of exam1)
2
CS6400-Fall'21-Navathe



ITEMID is a foreign key in OrderDetail referencing the Item relation
OID is a foreign key in OrderDetail referencing the Order relation
Date is represented as “YYYYMMDD”
Note that Order Detail has a tuple for every item ordered in each order.
Express the queries as indicated below.(NOTE: You must use the notations and syntax
precisely. Any deviations will be subject to reduction in points).
A. (6 pts.) Draw query tree for the following query:
p CID, ITEMID, (sOrderDetail.OID = Order.OID (sQuantityOrdered> 100 OrderDetail X s Date = “20211010” Order)
-
Write in English what this query does
The above query is inefficient due to the Cartesian product and some other
operations. Write in Algebra a better version of this query.
B. (6 pts.) Write an algebra expression that produces the following result: (total
quantity of each item ordered by each customer). Note: A customer may order
the same item multiple times on multiple orders. (Hint: You will need to use the
functional notation with F). Report must produce exact headings as shown.
Cust_ID
Item_ID
-
-
-
-
SUM (QtyOrdered)
C. (6 pts.) Write in Tuple Calculus:
(Note: Here is the  symbol if you need to use it).
List the Id (OID) and Date of those orders which contained some item (means at least
one item) whose unit price exceeded $100.
D. (5 pts.) Write in Domain Calculus
List the name of Customers who placed an Order (at least one order) on date
“20211024”.
E. (6 pts.) Write in QBE:
Hw#2 (Takehome part2 of exam1)
3
CS6400-Fall'21-Navathe
List the <Customer Name, Customer Phone#, Order# , Order_date and
QuantityOrdered > as a result for customers who have placed an order for Item#
“12345” after the Date: “20210901”.
F. (4 pts.) Write the above query (the one you did in QBE) in SQL.
Hw#2 (Takehome part2 of exam1)
4
CS6400-Fall'21-Navathe
Download