adbms assignment 1

2
Assignment N0.1 Q1 Suppose we are given a database with a table T with attributes (A, B, C, D, E) and a set of functional dependencies F = {A BC, CD E, B D, E A}. a. Show that the decomposition of T into T1 and T2, with heading (A, B, C) and (A, D,E) respectively, is a lossless-join decomposition. b. Give a 3NF lossless-join decomposition of T. c. Give a BCNF lossless-join decomposition of T. Are all functional dependencies preserved. Q2.Consider the following OQL schema class Movie public type tuple(title: string, rating: string, genre: set(string), year: integer, cast: unique set(Actor) ) class Actor public type tuple (name: string, birthplace: string, acted_in: set(tuple(role: string, movie: Movie)) name Movies: unique set(Movie) name Actors: unique set(Actor) Write the following OQL queries. a) Print the number of movies that Ronald Reagan acted in b) Print the titles of all comedies c) For each movie, print the title of the movie and the name and roles of each cast member d) Print the titles of movies produced by year. Q3 Consider the following schedule: R2(X), R3(X), W3(X), R1(Y), R1(X), W1(Y), R2(Y), W2(Y), COMMIT(T1), COMMIT(T2), COMMIT(T3) a)Assuming that all three transactions commit, draw the precedence (serialization) graph. b) Is this schedule conflict-serializable? Why or why not? c) Describe how this sequence is handled using strict two-phase locking and assuming that a transaction that requests a lock is blocked in case of lock incompatibility. The transaction’s request is reconsidered as soon as the lock is released.

Upload: renuka-pawar

Post on 21-Apr-2015

159 views

Category:

Documents


5 download

TRANSCRIPT

Assignment N0.1

Q1 Suppose we are given a database with a table T with attributes (A, B, C, D, E) and a set offunctional dependencies F = {A BC, CD E, B D, E A}.

a. Show that the decomposition of T into T1 and T2, with heading (A, B, C) and (A, D,E) respectively, is a lossless-join decomposition.

b. Give a 3NF lossless-join decomposition of T. c. Give a BCNF lossless-join decomposition of T. Are all functional dependencies preserved.

Q2.Consider the following OQL schemaclass Movie public typetuple(title: string,rating: string,genre: set(string),year: integer,cast: unique set(Actor))class Actor public typetuple (name: string,birthplace: string,acted_in: set(tuple(role: string,movie: Movie))name Movies: unique set(Movie)name Actors: unique set(Actor)

Write the following OQL queries.

a) Print the number of movies that Ronald Reagan acted in

b) Print the titles of all comedies

c) For each movie, print the title of the movie and the name and roles of each cast member

d) Print the titles of movies produced by year.

Q3 Consider the following schedule:R2(X), R3(X), W3(X), R1(Y), R1(X), W1(Y), R2(Y), W2(Y), COMMIT(T1),COMMIT(T2), COMMIT(T3)a)Assuming that all three transactions commit, draw the precedence (serialization)graph.b) Is this schedule conflict-serializable? Why or why not?

c) Describe how this sequence is handled using strict two-phase locking and assumingthat a transaction that requests a lock is blocked in case of lock incompatibility. Thetransaction’s request is reconsidered as soon as the lock is released.

Q4 Consider the following XML document:<DB><student><idnum> 1234 </idnum> <name> Jones </name><courses><course> <cname> Math3 </cname> <prof> Leibniz </prof> <room> 24 </room> <grade> A </grade> </course><course> <cname> Chem5 </cname> <prof> Avogadro </prof> <room> 12B </room> <grade> B </grade></course></courses></student><student><idnum> 3456 </idnum> <name> Smith </name><courses><course> <cname> Math3 </cname> <prof> Leibniz </prof> <room> 24 </room> <grade> B </grade> </course><course> <cname> Phil7 </cname> <prof> Hume </prof> <room> 18 </room> <grade> A </grade> </course><course> <cname> Math5 </cname> <prof> Hypatia </prof> <room> 24 </room> <grade> A </grade> </course></courses></student><student><idnum> 6789 </idnum> <name> Brown </name><courses><course> <cname> Greek2 </cname> <prof> Sappho </prof> <room> 26 </room> <grade> C </grade> </course><course> <cname> Phil7 </cname> <prof> Hume </prof> <room> 18 </room> <grade> A </grade> </course></courses></student></DB>

a) Write down the DTDb) Using the file “db.xml “, write X queries for the following:

i) The courses taught in room 24.ii) The students who got an A in some courseiii) The students who didn’t take any math courseiv) The courses for which at least one student got an A and one other

The student got a C

Q5 Consider the Cricket database.

Match(matched,team1,team2,ground, date,winner)

Player(playerid,lname,fname,country,yborn,bplace,ftest)

Batting(matchid,pid,order,hout,fow,nruns,mts,nballs,fours,sixes)

Bowling(matched,pid,novers,maidens,nruns,nwickets)

Suppose the data is distributed amongst the node in England,West Indies, Australia and India. Describe how will you fragment, replicate and distribute the data.

Q6. Design a star schema and snowflake schema of sales dept of ABC company.

Q7 Write short notes on Temporal databases and data mining.