ETH Zurich Spring Semester Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: August 19, Exam. Questions

Size: px
Start display at page:

Download "ETH Zurich Spring Semester Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: August 19, Exam. Questions"

Transcription

1 Data Modelling and Databases (DMDB) ETH Zurich Spring Semester 2017 Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: August 19, 2017 Assistant(s): Claude Barthels, Eleftherios Sidirourgos, Last update: Februar 05, 2018 Eliza Wszola, Ingo Müller, Kaan Kara, Renato Marroquín, Zsolt István Exam Rules (please read carefully) You have 120 minutes for the exam. Write the answers on the stack of papers with the title answer sheets. Write your name and Legi number on the cover page of the answer sheets. Please write your Legi number on all other pages of the answer sheets. Use blue or black ink, DO NOT USE red ink. DO NOT USE pencils. Write as clearly as possible and cross out everything that you do not consider to be part of your solution. Answers can be given in either English or German. Hand in your answer sheet. Do not hand in the sheets with the questions. You may keep the question sheets. Remarks Most questions are designed such that the fastest way to solve them is to solve the problem rather than looking at the answers and try to determine which one is correct. We expect it to be slower to try out all combinations of questions and solutions in order to find the ones that match. Do not answer questions at random as wrong answers give negative points. If you do not know the answer, leave it blank.

2 1 Entity-Relationship Model (10 points) Consider the following entity-relationship model: FamilyName ReaderNr ReturnDate Shelf Position Firstname Reader N Borrows M Copy CopyNr City Birthdate N Available 1 Catname 1 ISBN Contains Category N InCat M Book PubYear N N Title Publisher 1 Publishes NumPages Author Pubname Pubcity Solve the following subproblems. (a) (5 points) Given a particular concept (entity or attribute) of Type 1, how many different instances of concepts of Type 2 can it be associated with? In the table on the answer sheet, mark with a checkmark ( ) the widest range that applies. Example: If A is associated with exactly one entity of type B, the corresponding row will look as follows. Type 1 Type 2 A B number of entities of Type 2 exactly 1 at most 1 at least 1 any number (incl. zero) Grading: Each correct answer gives 0.5 point. Each incorrect answer gives point.

3 (b) (2 points) On the answer sheet, mark with a checkmark ( ) whether each of the given statements is true or false. (A) A category can contain itself. (B) If we need to express that a book must have exactly 2 copies, we can do it provided we use a different notation. (C) The model allows a reader to borrow a copy of a non-existent book. (D) Each entity must have exactly one key attribute. Grading: Each correct answer gives 0.5 point. Each incorrect answer gives point. (c) (1 point) Suppose that each book has a unique title. We replace Book s title attribute with a "hastitle" relationship: 1 1 Book Available hastitle Copy Title What is the effect of this change? Pick one answer and mark it on the answer sheet. A. Aside from enforcing title uniqueness, it has no effect. B. A book previously had exactly one title. Now, it has at most one. C. A book previously could have at most one title. Now, it must have exactly one. D. A book previously had exactly one title. Now, it can have arbitrarily many titles. E. A book previously could have at most one title. Now, it can have arbitrarily many titles. (d) (2 points) Suppose we add a new entity set Librarian and connect it to the Borrows relationship in the following way: N M Reader Borrows Copy 1 Librarian On the answer sheet, mark with a checkmark ( ) whether each of the given statements is true or false. Grading: Each correct answer gives 0.5 point. Each incorrect answer gives point.

4 2 Relational Model (8 points) Consider the ER models 1 to 4 and the relational models (a) to (j) given below. For each ER model, specify the letter of the relational model that represents it correctly in the table on the answer sheet, or write none in the space if there is none that represents it. Grading: 2 points for each correct answer, -1 point for each wrong answer. B 1 1 C N c B 1 N C 1 c b R S s b R S s r N D 1 d r N D N d ER model 1 ER model 2 B 1 1 C 1 c B 1 N C c b r R N S D N s d b r R N is_a D s d ER model 3 ER model 4 (a) B(b) R(b,c,d,r), extra key: b,d S(c,d,s) (b) B(b) C(c) D(c,d,s) R(b,c,c,d,r) (c) B(b) C(c) D(c,d,s) R(b,c,d,r), extra key: b,d (d) B(b) D(c,d) R(b,c,d,r), extra key: b,d S(c,d,s) (e) B(b) C(c) D(c,d,s) R(b,c,d,r) (f) B(b) C(c) D(c,d,s) R(b,c,c,r) (g) B(b) C(c) D(c,d,s) R(b,c,c,d,r), extra key: b,d,c (h) B(b) C(c) D(c,d,s) R(b,c,d,r), extra key: b,d (i) B(b) C(c) D(c,d,s) R(b,c,d,r) (j) B(b) C(c,d,s) D(d) R(b,c,d,r), b,d extra key:

5 3 Relational Algebra (15 points) (a) (6 points) Consider the two following relations (A and B). A = W X 1 a 2 c 2 f 3 a 9 b B = X Y Z a 9 3 b 2 1 b 3 1 g 3 0 f 2 0 Consider the following three join queries (Q 1, Q 2, Q 3 ). Q1: A B Q2: A B Q3: A W =Y B For each of the tuples in the answer sheet, mark if the tuple is part of the result of the queries with a checkmark ( ). If a tuple is not part of the result set of a query, place a cross (X) in the corresponding field. Note: The result set can contain additional tuples that are not listed in the answer sheet. Grading: Each correct answer gives 0.25 points. Each incorrect answer gives points. (b) (6 points) Consider the following relations (C, D, E). C = X Y 1 a 2 c 2 f 3 a D = Y c b a b d Z a b f c a E = Z X a 3 b 1 f 2 c 2 For each of the relational algebra expressions listed in the answer sheet, calculate the size (cardinality) of the result set. Grading: Each correct answer gives 1 point. Each incorrect answer gives -0.5 points.

6 (c) (3 points) Consider the following relations modelling a library management system. Reader ( RDNR, Surname, Firstname, City, BirthYear ) Book ( ISBN, Title, Author, NoPages, PubYear, PublisherName ) Publisher ( PublisherName, PublisherCity ) Category ( CategoryName, Description ) Copy ( ISBN, CopyNumber, Shelf, Position ) Loan ( ReaderNr, ISBN, Copy, ReturnDate ) BookCategory ( ISBN, CategoryName ) Consider the following questions: Q1: Which readers (first and last name) from Zurich have read books that have been published before their birth year? Q2: Which books (title) have never been read by a reader from Zurich? Q3: Which publishers (name) offer at least one book not belonging to the category Switzerland? Consider the following queries: A: Π F irstname,surname (σ P uby ear<birthy ear (Reader Loan Book)) B: Π T itle (Book Π Book (σ City= Zurich (Reader) Loan Copy Book)) C: Π F irstname,surname (σ City= Zurich (σ P uby ear<birthy ear(reader Loan Copy))) D: Π P ublishername (Book Π Book (σ CategoryName= Switzerland (BookCategory Book))) E: Π T itle (Book Π Book (σ City= Zurich (Reader Loan Book))) F: Π P ublishername (Π Book (σ CategoryName<> Switzerland (BookCategory Book))) In the answer sheet, mark which query answers which question by placing a a checkmark ( ) in the corresponding field, otherwise leave the field blank. If a query does not answer any question, place a checkmark ( ) in the right-most column in the answer grid. If a question is answered by multiple relational algebra queries, mark all of them. Grading: Each correct answer gives 1 point.

7 4 SQL I (12 points) Suppose we create the following database tables. No additional constraints are imposed. CREATE TABLE Store( id INT NOT NULL, name VARCHAR(30) NOT NULL, city VARCHAR(30) NOT NULL, PRIMARY KEY (id) ); CREATE TABLE Product( id INT NOT NULL, name VARCHAR(30) NOT NULL, supplier VARCHAR(30) NOT NULL, release_year INT, PRIMARY KEY (id) ); CREATE TABLE Available( store_id INT NOT NULL, product_id INT NOT NULL, available_since_year INT NOT NULL, quantity INT NOT NULL, PRIMARY KEY (store_id, product_id) ); Suppose we insert some values to the tables so that we have: Store: Product: Available: id name city 1 Alices Lucerne 2 Black Market Zug 3 CXHJ Aarau 4 Do-It Winterthur id name supplier release_year 1 Mark I IBM ENIAC United States Army Analytical Engine Babbage NULL store_id product_id available_since_year quantity

8 (a) (5 points) How many rows do the following queries return? Grading: Each correct answer gives 1 point. Each incorrect answer gives -0.5 points. 1. SELECT product_id FROM Available WHERE store_id = 1 UNION SELECT product_id FROM Available WHERE store_id = 2; 2. SELECT product_id FROM Available WHERE store_id = 1 INTERSECT SELECT product_id FROM Available WHERE store_id = 2; 3. SELECT product_id, SUM(quantity) FROM Available WHERE quantity > 30 GROUP BY product_id; 4. SELECT product_id, SUM(quantity) FROM Available GROUP BY product_id HAVING SUM (quantity) > 30; 5. SELECT id, ( CASE WHEN release_year = 1946 THEN 'new edition' WHEN release_year = 1944 THEN 'old edition' END ) AS comment FROM Product; (b) (2 points) What are the values returned by the following statement? (SELECT id FROM Product WHERE release_year > 1945 UNION ALL SELECT id FROM Product WHERE release_year <= 1946) ORDER BY id; A. 1, 2 B. 1, 2, 3 C. 1, 2, 2 D. 1, 2, 2, 3, 3 E. 1, 1, 2, 2 F. 1, 1, 2, 2, 3, 3

9 (c) (2 1 / 2 points) Using the given building blocks (A-H), fill the gaps in the query so that it returns results corresponding to the problem description. On the answer sheet, write the letter corresponding to a selected building block next to the number of each gap. Problem: Find stores in which you can buy particular rare products. A product is rare if its total quantity on the market is lower than 60. Resulting rows should consist of store name, product name and supplier. SELECT Product.name, Product.supplier, Store.name FROM Product JOIN Available ON Product.id = Available.product_id JOIN Store ON Store.id = Available.store_id WHERE Product.id 1 ( SELECT 2 GROUP BY product_id ); A. IN B. < C. = D. id FROM Product E. product_id FROM Available F. HAVING SUM(quantity) G. WHERE SUM(quantity) H. EXCEPT (d) (2 1 / 2 points) Repeat the same task for the following problem: Select the names and release years of all products and order the results by release years. If no release year is available, the lowest product s "available_since_year" in the Available table should be used. SELECT name, (CASE 1 ( SELECT 2 FROM Available WHERE 3 = id ) 4 release_year END ) AS release_year FROM Product ORDER BY release_year; A. WHEN release_year = NULL THEN B. WHEN release_year IS NULL THEN C. ELSE D. ELSE THEN E. MIN(available_since_year) F. available_since_year G. product_id H. store_id

10 5 SQL II (5 points) Consider the following relations: Reader ( RDNR, Surname, Firstname, City, BirthYear ) Book ( ISBN, Title, Author, NoPages, PubYear, PublisherName ) Publisher ( PublisherName, PublisherCity ) Category ( CategoryName, BelongsTo ) Copy ( ISBN, CopyNumber, Shelf, Position ) Loan ( ReaderNr, ISBN, Copy, ReturnDate ) BookCategory ( ISBN, CategoryName ) (a) (2 1 / 2 points) Consider a SQL database with the above relations, where all attributes are specified to be NOT NULL. Given the following query template that should list all readers that loaned books of the following categories ROMANCE, DRAMA or MYSTERY. SELECT RDNR, Surname FROM Reader, Loan, BookCategory WHERE predicate ; For each of the following predicates, say whether it produces the desired result if used in the template: (A) Reader.RDNR = Loan.ReaderNr AND BookCategory.ISBN = Loan.ISBN AND (BookCategory.CategoryName = 'ROMANCE' OR BookCategory.CategoryName = 'DRAMA' OR BookCategory.CategoryName = 'MYSTERY') (B) Reader.RDNR = Loan.ReaderNr AND BookCategory.ISBN = Loan.ISBN AND (BookCategory.CategoryName = 'ROMANCE' AND BookCategory.CategoryName = 'DRAMA' AND BookCategory.CategoryName = 'MYSTERY') (C) (Reader.RDNR = Loan.ReaderNr AND BookCategory.ISBN = Loan.ISBN AND BookCategory.CategoryName = 'ROMANCE') OR (Reader.RDNR = Loan.ReaderNr AND BookCategory.ISBN = Loan.ISBN AND BookCategory.CategoryName = 'DRAMA') OR (Reader.RDNR = Loan.ReaderNr AND BookCategory.ISBN = Loan.ISBN AND BookCategory.CategoryName = 'MYSTERY') (D) Reader.RDNR = Loan.ReaderNr AND BookCategory.ISBN = Loan.ISBN AND BookCategory.CategoryName = 'ROMANCE' OR BookCategory.CategoryName = 'DRAMA' OR BookCategory.CategoryName = 'MYSTERY' (E) (Reader.RDNR = Loan.ReaderNr AND BookCategory.ISBN = Loan.ISBN AND BookCategory.CategoryName = 'ROMANCE') OR BookCategory.CategoryName = 'DRAMA' OR BookCategory.CategoryName = 'MYSTERY' Grading: 0.5 points for each correct answer points for each incorrect answer.

11 (b) (2 1 / 2 points) Consider the following query that retrieves a single reader among the youngest readers who returned a book the longest time ago. SELECT Firstname, Surname, ReturnDate FROM Reader, Loan WHERE Reader.RDNR = Loan.ReaderNr ORDER BY Reader.BirthYear DESC, Loan.ReturnDate ASC LIMIT 1; For each of the following statements, say whether they are TRUE or FALSE. (A) The query does not produce the desired result because it does not have a JOIN clause. (B) The query would be wrong if it had an ORDER clause with only one of the two attributes. (C) The LIMIT clause is not needed as the query returns all the needed tuples in the right order. (D) Both relations Reader and Loan are needed to relate the readers with the loans they have made. (E) If two readers born on the same year returned a book on the same day, the query would return incorrect results. Grading: 0.5 points for each correct answer points for each incorrect answer.

12 6 SQL III (7 1 / 2 points) Consider the following relations: Reader ( RDNR, Surname, Firstname, City, BirthYear ) Book ( ISBN, Title, Author, NoPages, PubYear, PublisherName ) Publisher ( PublisherName, PublisherCity ) Category ( CategoryName, BelongsTo ) Copy ( ISBN, CopyNumber, Shelf, Position ) Loan ( ReaderNr, ISBN, Copy, ReturnDate ) BookCategory ( ISBN, CategoryName ) Consider a SQL database with the above relations, where all attributes are specified to be NOT NULL. Now consider the following seven queries: (Q1) SELECT ReaderNR FROM Reader JOIN Loan ON Reader.RDNR = Loan.ReaderNR WHERE Loan.ISBN IN ( SELECT ISBN FROM Copy GROUP BY ISBN HAVING COUNT(CopyNumber) = 13 ) (Q2) SELECT ReaderNR FROM Reader JOIN Loan ON Reader.RDNR = Loan.ReaderNR WHERE Loan.ISBN IN ( SELECT ISBN FROM Copy WHERE CopyNumber = 13 ) (Q3) WITH ( SELECT ISBN, COUNT(*) AS cnt FROM Copy GROUP BY ISBN ) AS Interm SELECT ReaderNR FROM Reader JOIN Loan ON Reader.RDNR = Loan.ReaderNR JOIN Copy ON Copy.ISBN = Loan.ISBN JOIN Interm ON Copy.ISBN = Interm.ISBN WHERE Interm.cnt = 13 (Q4) SELECT ReaderNR FROM Reader JOIN Loan ON Reader.RDNR = Loan.ReaderNR WHERE Loan.ISBN IN ( SELECT DISTINCT ISBN FROM Copy WHERE CopyNumber = 13 ) (Q5) WITH ( SELECT Book.ISBN AS ISBN, COUNT(Title) AS cnt, MAX(CopyNumber) AS maxcn FROM Copy JOIN Book ON Book.ISBN = Copy.ISBN GROUP BY ISBN ORDER BY cnt DESC ) AS Interm SELECT ReaderNR FROM Reader JOIN Loan ON Reader.RDNR = Loan.ReaderNR JOIN Copy ON Copy.ISBN = Loan.ISBN JOIN Interm ON Copy.ISBN = Interm.ISBN WHERE Interm.cnt = 13

13 (Q6) WITH ( SELECT Book.ISBN AS ISBN, COUNT(Title) AS cnt, MAX(CopyNumber) AS maxcn FROM Copy JOIN Book ON Book.ISBN = Copy.ISBN GROUP BY ISBN ORDER BY cnt DESC LIMIT 13 ) AS Interm SELECT ReaderNR FROM Reader JOIN Loan ON Reader.RDNR = Loan.ReaderNR JOIN Copy ON Copy.ISBN = Loan.ISBN JOIN Interm ON Copy.ISBN = Interm.ISBN (Q7) SELECT DISTINCT ReaderNR FROM Reader JOIN Loan ON Reader.RDNR = Loan.ReaderNR WHERE Loan.ISBN IN ( SELECT ISBN FROM Copy GROUP BY ISBN HAVING COUNT(CopyNumber) = 13 ) Some of these queries solve the same task and return identical results. Using the table on the answer sheet, determine which queries are equivalent by defining equivalence classes consisting of all queries that return identical results on any database instance. Grading: Partial points for every correct equivalence. 0 points if any false equivalence is specified.

14 7 Integrity Constraints (12 points) (a) (3 points) Consider the following ER model. Which relational database schema represents this model accurately? Complete the correpsonding DML statements on the answer sheet. /^E E d E (b) (6 points) Consider the following schema: CREATE TABLE Reader ( ReaderNr INT PRIMARY KEY, FamilyName VARCHAR(20) NOT NULL, FirstName VARCHAR(20) NOT NULL ); CREATE TABLE Copy ( CopyNr INT NOT NULL PRIMARY KEY, Position INT NOT NULL ); CREATE TABLE Borrows ( ReaderNr INT NOT NULL, CopyNr INT NOT NULL, PRIMARY KEY(ReaderNr, CopyNr), constraint fk_reader FOREIGN KEY(ReaderNr) ON DELETE RESTRICT ON UPDATE CASCADE, constraint fk_copy FOREIGN KEY(CopyNr) ON DELETE NO ACTION ON UPDATE RESTRICT ); Initially, the relations contain the following entries: Copy = Reader = ReaderNr FamilyName FirstName 1 Turing Alan 2 Shannon Claude 3 Hamming Richard CopyNr Position Borrows = ReaderNr CopyNr 1 3 The answer sheet contains sequences of queries that are executed on these relations one after each other. Each sequence starts with the initial state of the database. For each sequence, answer the corresponding question by filling in the table on the answer sheet. Sequence (i): How many tuples are in each relation after executing the queries? Sequence (ii): How many tuples are in each relation after executing the queries? Sequence (iii): Can the queries by executed (yes/no for each query)? Sequence (iv): Can the queries by executed (yes/no for each query)? Grading 0.5 points for each correct answer (table cell), -0.5 points for each incorrect answer.

15 (c) (3 points) For each of the following statements, determine whether it is true or false by placing a checkmark ( ) in the corresponding cell of the table on the answer sheet. (A) An ON UPDATE SET NULL constraint ensures that an update on the referenced entry will cause the foreign key that references the updated entry to be set to NULL. (B) An ON UPDATE CASCADE constraint specified for an attribute in a table may lead to changing attributes in other tables. (C) An ON DELETE RESTRICT constraint ensures that an entry in the referenced table cannot be deleted, if a reference to it exists. Grading: 1 point for each correct line, -1 for each wrong line.

16 8 Normal Forms (12 points) (a) Consider the relation R(A, B, C, D, E) with the following three sets of functional dependencies F 1, F 2, F 3. F 1 F 2 F 3 A C C E A B C DE BD AE AC DE B AE A BC AD C i. (3 points) For each set of functional dependencies, determine all the candidate keys of the relation R. Grading: Each correct answer gives 1 point. ii. (3 points) For each set of functional dependencies, determine the highest normal form the relation R is in. Grading: Each correct answer gives 1 point. (b) Consider the following relation with its set of functional dependencies. Book ( ISBN, Title, Author, NoPages, PubYear, PublisherName, PublisherCity ) ISBN Title, Author, NoPages, PubYear, PublisherName PublisherName PublisherCity i. (1 point) What is the highest normal form the relation is in? What is the problematic functional dependency that prevents the relation from being in a higher normal form? A. ISBN Title, Author, NoPages, PubYear, PublisherName B. PublisherName PublisherCity ii. (1 point) Propose a lossless decomposition of the relation that brings the relation into a higher normal form. Mark all keys of the relations. iii. (1 point) Proof that the proposed decomposition is lossless. (c) Consider the relation R(A, B, C, D, E) with the following set of functional dependencies. A BC DE BC C D i. (1 point) Find the minimum basis of the set of functional dependencies. A. DE BC, C D B. A BC, E B, C D C. A BC, E BC, C D D. A BC, DE BC E. The given set of functional dependencies is minimal. F. None of the above. ii. (1 point) Find the correct decomposition of R given each set of functional dependencies according to the synthesis algorithm. iii. (1 point) Which is the highest normal form that the synthesis algorithm guarantees the resulting relation(s) to be in?

17 9 Join Processing (7 points) Given are three relations R, S and T that already reside in memory. Their cardinalities are as follows: R =12,000 S =90,000 T =1,000,000 We have a query Q twj that requires joining the three tables together. The estimate of the pairwise join sizes for the join predicates used in this query are: R S =2,000 R T =11,000 T S =3,000 (a) (1 point) How many possible join orders are there for these three relations? Grading: 1 point for correct answer. (b) (3 points) If we choose to use only block nested loop joins for Q twj and take the number of comparisons as cost, what is the optimal join order? Write down the cost of each join in that particular ordering. Grading: 3 points if both the order and the calculations are correct. (c) (3 points) Assume we use only the canonical hash join algorithm to execute the join and all intermediary data fits in memory. We take the number of hash table accesses (inserts or lookups) as the cost of a join. What is the optimal join order in this case? Write down the cost of each join in that particular ordering. Grading: 3 points if both the order and the calculations are correct.

18 10 Transactions (13 1 / 2 points) Notation used in this exercise: b i - Begin of transaction i. r i (A) - Transaction i reads data object A. w i (A) - Transaction i writes to data object A. c i - Transaction i commits successfully. a i - Transaction i aborts or is aborted. (a) (4 1 / 2 points) For each of the given histories below, draw a serializability graph on the answer sheet and indicate if it is serializable. i. r 2 (A) r 3 (B) w 3 (B) r 2 (B) w 2 (A) r 1 (A) w 1 (A) r 3 (A) c 3 c 2 c 1 ii. r 1 (A) r 2 (B) w 1 (A) w 2 (A) r 3 (A) w 3 (A) c 1 c 2 c 3 iii. r 1 (A) w 1 (A) r 2 (A) w 2 (A) w 2 (B) r 1 (B) c 2 c 1 (b) (9 points) For each of the following histories, find the strictest recoverability class (not recoverable, recoverable, avoid-cascading aborts, strict) and indicate if it is possible under strict 2-phase locking (S2PL) and snapshot isolation (SI), respectively. Write the name of the recoverability class in the table on the answer sheet and write Yes or No indicating if the history is possible. 1. History: b 1 r 1 (A) b 2 r 2 (A) r 2 (B) w 2 (A) w 1 (B) c 1 c 2 2. History: b 1 r 1 (A) b 2 w 1 (A) c 1 r 2 (A) w 2 (A) c 2 3. History: b 1 b 2 r 1 (A) r 2 (C) w 1 (B) w 1 (A) c 1 w 2 (A) c 2 4. History: b 1 w 1 (A) c 1 b 2 r 2 (A) b 3 r 3 (A) w 2 (B) w 3 (C) c 2 c 3 5. History: b 1 r 1 (A) w 1 (A) b 2 r 2 (A) c 2 b 3 r 3 (B) c 3 c 1 6. History: b 1 w 1 (B) b 2 w 2 (B) c 1 r 2 (A) r 2 (B) c 2 Grading: 0.5 for every correct answer (table cell), -0.5 for each incorrect answer.

19 11 Two-Phase Commit (18 points) Consider a distributed transactional system with one coordinator C and two participants P 1 and P 2. The coordinator also acts as participant. We describe the execution of the Two- Phase Commit Protocol among these nodes as a sequence of the following types of events. The first letter of each event indicates the node takes the action, the second entry the action, and the third letter the recipient of the action where applicable. Types of events that can only take place at the coordinator (C): C, VoteRequest, P i = C sends a vote request to participant P i C, ReceiveVote, P i = C receives a vote from participant P i C, SendCommit, P i = C sends a Commit decision to node P i C, SendAbort, P i = C sends an Abort decision to participant P i Types of events that can only take place at the participants (P i ): P i, ReceiveVoteRequest, C = P i receives a vote request from C P i, ReceiveDecision, C = P i receives the global decision from C P i, VoteAbort, C = P i sends an Abort vote to C P i, VoteCommit, C = P i sends an Abort vote to C Types of events that can take place at any node (X {C, P 1, P 2 }): X, Fail = X fails X, Recover = X finishes recovery X, Abort = X (locally) notifies the rest of the system that the global decision is to abort X, Commit = X (locally) notifies the rest of the system that the global decision is to commit X, Timeout, Y = times out waiting for a message from Y, Y {C, P 1, P 2 } You can abbreviate the action component of events by the capital letters of that action. For example, you can write RVR for ReceiveVoteRequest or F for Fail. (a) (5 points) Assume that P 1 fails before it is contacted by the coordinator with a VoteRequest and it does not Recover. Assume also that P 2 votes Commit when asked. Construct a sequence of events describing a correct and complete execution of the Two-Phase Commit Protocol for this situation. Write your solution on the answer sheet. (b) (5 points) Construct a sequence of events describing a correct and complete execution of the Two-Phase Commit Protocol where one participant is uncertain and therefore not allowed to Commit because some other site s decision has been to Abort. Write your solution on the answer sheet.

20 (c) (8 points) Assume that we add the following operation to the repertoire of possible events taking place at any node X, X {C, P 1, P 2 }: X, log action = X writes an entry about action into its persistent log Assume that the protocol produces the strict minimum of number of log events needed to recover from failures. For each of the following statements, state whether it is true or false by checking the corresponding box in the table on the answer sheet. (A) C, log StartProtocol must take place before any C, VoteRequest, P i. (B) Each C, VoteRequest, P i must be preceeded by C, log VoteRequest, P i. (C) Each C, VoteRequest, P i must be followed by C, log VoteRequest, P i. (D) Each P i, VoteCommit, C must be preceeded by P i, log VoteCommit. (E) Each P i, VoteCommit, C must be followed by P i, log VoteCommit. (F) Each C, SendCommit, P i must be preceeded by C, log ReceiveVote, P i. (G) Each C, SendCommit, P i must be followed by C, log ReceiveVote, P i. (H) C, Commit can only take place after a C, ReceiveVote, P i for each P i. (I) Each X, Commit must be preceeded by X, log Commit. (J) Each X, Commit must be followed by X, log Commit. (K) After P i, log VoteCommit, it is possible to observe P i, Abort. (L) After P i, log VoteAbort, it is possible to observe P i, Commit. (M) If P i, log VoteCommit was the last log event before P i, Fail, P i can deduce the outcome of the transaction without the help of any other site after P i, Recover. (N) If P i, log VoteAbort was the last log event before P i, Fail, P i can deduce the outcome of the transaction without the help of any other site after P i, Recover. (O) If P i, log Commit was the last log event before P i, Fail, P i can deduce the outcome of the transaction without the help of any other site after P i, Recover. (P) If P i, log Abort was the last log event before P i, Fail, P i can deduce the outcome of the transaction without the help of any other site after P i, Recover. Grading: 0.5 points for each correct line for each wrong line.

21 Empty Pages You can use the following pages at your convenience.

22

23

24

25 Data Modelling and Databases (DMDB) ETH Zurich Spring Semester 2017 Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: August 19, 2017 Assistant(s): Claude Barthels, Eleftherios Sidirourgos, Last update: Februar 05, 2018 Eliza Wszola, Ingo Müller, Kaan Kara, Renato Marroquín, Zsolt István Exam Answer Sheets Name: Legi-Nr: Question: Total Points: / / Score: Reminders Write all your answers on this stack of papers ( answer sheets ). Write your name and Legi number on the cover page of the answer sheets. Please write your Legi number on all other answer sheets. Do not separate the individual sheets of this stack. If there are pages missing, you will not receive any points for these pages. Hand in this stack of answer sheets.

26 Legi-Nr: 1 Entity-Relationship Model Question 1.a: Type 1 Type 2 number of entities of Type 2 exactly 1 at most 1 at least 1 any number (incl. zero) Book Book Book Book Book Category Copy ISBN NumPages Publisher Category Copy Publisher ISBN NumPages Book Book Book Book Book Question 1.b: Statement TRUE FALSE Statement (A) Statement (B) Statement (C) Statement (D) Question 1.c: A B C D E Question 1.d: Statement TRUE FALSE 1. A particular reader can borrow from many librarians. 2. A particular copy can be borrowed from many librarians. 3. A particular copy can be borrowed by only one reader. 4. A particular copy can be borrowed by a particular reader only from one librarian. 2 Relational Model Question 2: ER model ER model 1 ER model 2 ER model 3 ER model 4 Relational Model

27 Legi-Nr: 3 Relational Algebra Question 3.a: Tuple [A.W, A.X, B.X, B.Y, B.Z] Q 1 Q 2 Q 3 [-, -, b, 2, 1] [1, a, -, -, -] [3, a, b, 3, 1] [9, b, b, 2, 1] [2, c, -, -, -] [2, f, f, 2, 0] [1, a, a, 9, 3] [2, c, f, 2, 0] Question 3.b: Query Result Set Size C D E (C D) E C σ X>1 (E) C ρ Z Y (E) D Π Z (E) Π Z (D) Π Z (E) Question 3.c: Question A B C D E F No matching query Q1 Q2 Q3 4 SQL I Question 4.a: query rows Question 4.b: A B C D E F

28 Legi-Nr: Question 4.c: gap block Question 4.d: gap block SQL II Question 5.a: Predicate produces desired result yes no (A) (B) (C) (D) (E) Question 5.b: Statement true false (A) (B) (C) (D) (E)

29 Legi-Nr: 6 SQL III Question 6: Equivalence class List of equivalent queries C1 C2 C3 C4 C5 C6 C7 7 Integrity Constraints Question 7.a: CREATE TABLE Book ( ); CREATE TABLE Copy ( );

30 Legi-Nr: Question 7.b: (i) (ii) Query INSERT INTO Reader VALUES (1, Huffman, David); DELETE FROM Reader WHERE ReaderNr = 1; Query INSERT INTO Borrows VALUES (2, 5); DELETE FROM Copy WHERE CopyNr = 5; Number of tuples in Reader Copy Borrows Number of tuples in Reader Copy Borrows (iii) (iv) Query INSERT INTO Reader VALUES (4, Hopper, Grace); UPDATE Reader SET ReaderNr = 7 WHERE FamilyName = Turing ; UPDATE Copy SET CopyNr = 4 WHERE Position = 8001; Query DELETE FROM Reader WHERE ReaderNr = 3; UPDATE Copy SET Position = 3002 WHERE CopyNr = 3; DELETE FROM Borrows WHERE ReaderNr = 1; Executable? Executable? Question 7.c: Statement True False Statement (A) Statement (B) Statement (C) 8 Normal Forms Question 8.a.i: Functional Dep. Candidate Keys F 1 F 2 F 3

31 Legi-Nr: Question 8.a.ii: Functional Dep. No NF 1NF 2NF 3NF BCNF F 1 F 2 F 3 Question 8.b.i: No NF 1NF 2NF 3NF BCNF 4NF Problematic functional dependency: A B Question 8.b.ii: Question 8.b.iii: Question 8.c.i: A B C D E F Question 8.c.ii: Question 8.c.iii: No NF 1NF 2NF 3NF BCNF 4NF 9 Join Processing Question 9.a:

32 Legi-Nr: Question 9.b: Question 9.c: 10 Transactions Question 10.a.i: Question 10.a.ii: Question 10.a.iii: Question 10.b: History Recoverablity S2PL SI 1. History 2. History 3. History 4. History 5. History 6. History

33 Legi-Nr: 11 Two-Phase Commit Question 11.a: Question 11.b:

34 Legi-Nr: Question 11.c: Statement true false Statement (A) Statement (B) Statement (C) Statement (D) Statement (E) Statement (F) Statement (G) Statement (H) Statement (I) Statement (J) Statement (K) Statement (L) Statement (M) Statement (N) Statement (O) Statement (P)

Exam. Question: Total Points: Score:

Exam. Question: Total Points: Score: FS 2016 Data Modelling and Databases Date: June 9, 2016 ETH Zurich Systems Group Prof. Gustavo Alonso Exam Name: Question: 1 2 3 4 5 6 7 8 9 10 11 Total Points: 15 20 15 10 10 15 10 15 10 10 20 150 Score:

More information

Assignment 3: Relational Algebra Solution

Assignment 3: Relational Algebra Solution Data Modelling and Databases Exercise dates: March 15/March 16, 2018 Ce Zhang, Gustavo Alonso Last update: April 13, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 3: Relational Algebra Solution

More information

Exercise 12: Commit Protocols and Replication

Exercise 12: Commit Protocols and Replication Data Modelling and Databases (DMDB) ETH Zurich Spring Semester 2017 Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: May 22, 2017 Assistant(s): Claude Barthels, Eleftherios Sidirourgos, Eliza

More information

Exercise 9: Normal Forms

Exercise 9: Normal Forms Data Modelling and Databases (DMDB) ETH Zurich Spring Semester 2017 Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: Assistant(s): Claude Barthels, Eleftherios Sidirourgos, Eliza Last update:

More information

Exercise 11: Transactions

Exercise 11: Transactions Data Modelling and Databases (DMDB) ETH Zurich Spring Semester 2017 Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: Assistant(s): Claude Barthels, Eleftherios Sidirourgos, Eliza Last update:

More information

Exercise 12: Commit Protocols and Replication

Exercise 12: Commit Protocols and Replication Data Modelling and Databases (DMDB) ETH Zurich Spring Semester 2017 Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: May 22, 2017 Assistant(s): Claude Barthels, Eleftherios Sidirourgos, Eliza

More information

Exam. Question: Total Points: Score:

Exam. Question: Total Points: Score: FS 2016 Data Modelling and Databases Date: August 17, 2016 ETH Zurich Systems Group Prof. Gustavo Alonso Exam Name: Question: 1 2 3 4 5 6 7 8 9 10 11 Total Points: 11 11 10 12 9 10 11 10 15 10 8 117 Score:

More information

L Information Systems for Engineers. Final exam. ETH Zurich, Autumn Semester 2017 Friday

L Information Systems for Engineers. Final exam. ETH Zurich, Autumn Semester 2017 Friday 252-0834-00L Information Systems for Engineers Final exam ETH Zurich, Autumn Semester 2017 Friday 09.02.2018 First name: Last name: Legi number: Signature: You can fill out the above fields immediately,

More information

Assignment 1: Entity-Relationship Model Solution

Assignment 1: Entity-Relationship Model Solution Data odelling and Databases Exercise dates: arch /arch 2, 208 Ce Zhang, Gustavo Alonso Last update: arch 08, 208 Spring Semester 208 Head TA: Ingo üller Assignment : Entity-Relationship odel Solution This

More information

Final Exam. December 5th, :00-4:00. CS425 - Database Organization Results

Final Exam. December 5th, :00-4:00. CS425 - Database Organization Results Name CWID Final Exam December 5th, 2016 2:00-4:00 CS425 - Database Organization Results Please leave this empty! 1.1 1.2 1.3 1.4 1.5 1.6 Sum Instructions Try to answer all the questions using what you

More information

Assignment 7: Integrity Constraints

Assignment 7: Integrity Constraints Data Modelling and Databases Exercise dates: April 19, 2018 Ce Zhang, Gustavo Alonso Last update: April 19, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 7: Integrity Constraints This assignment

More information

ETH Zurich Spring Semester Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: March 27/March 31, Exercise 5: SQL II.

ETH Zurich Spring Semester Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: March 27/March 31, Exercise 5: SQL II. Data Modelling and Databases (DMDB) ETH Zurich Spring Semester 2017 Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: March Assistant(s): Claude Barthels, Eleftherios Sidirourgos, Last update:

More information

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered

More information

CSE344 Final Exam Winter 2017

CSE344 Final Exam Winter 2017 CSE344 Final Exam Winter 2017 March 16, 2017 Please read all instructions (including these) carefully. This is a closed book exam. You are allowed two pages of note sheets that you can write on both sides.

More information

Assignment 2: Relational Model

Assignment 2: Relational Model Data Modelling and Databases Exercise dates: March 8/March 9, 208 Ce Zhang, Gustavo Alonso Last update: March 6, 208 Spring Semester 208 Head TA: Ingo Müller Assignment 2: Relational Model This assignment

More information

Database Management Systems Paper Solution

Database Management Systems Paper Solution Database Management Systems Paper Solution Following questions have been asked in GATE CS exam. 1. Given the relations employee (name, salary, deptno) and department (deptno, deptname, address) Which of

More information

Assignment 2: Relational Model Solution

Assignment 2: Relational Model Solution Data Modelling and Databases Exercise dates: March 8/March 9, 208 Ce Zhang, Gustavo Alonso Last update: March 6, 208 Spring Semester 208 Head TA: Ingo Müller Assignment 2: Relational Model Solution This

More information

Relational model continued. Understanding how to use the relational model. Summary of board example: with Copies as weak entity

Relational model continued. Understanding how to use the relational model. Summary of board example: with Copies as weak entity COS 597A: Principles of Database and Information Systems Relational model continued Understanding how to use the relational model 1 with as weak entity folded into folded into branches: (br_, librarian,

More information

CSE 344 Final Examination

CSE 344 Final Examination CSE 344 Final Examination December 12, 2012, 8:30am - 10:20am Name: Question Points Score 1 30 2 20 3 30 4 20 Total: 100 This exam is open book and open notes but NO laptops or other portable devices.

More information

Assignment 6: SQL III Solution

Assignment 6: SQL III Solution Data Modelling and Databases Exercise dates: April 12/April 13, 2018 Ce Zhang, Gustavo Alonso Last update: April 16, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 6: SQL III Solution This assignment

More information

Database Management

Database Management Database Management - 2011 Model Answers 1. a. A data model should comprise a structural part, an integrity part and a manipulative part. The relational model provides standard definitions for all three

More information

Midterm 2: CS186, Spring 2015

Midterm 2: CS186, Spring 2015 Midterm 2: CS186, Spring 2015 Prof. J. Hellerstein You should receive a double-sided answer sheet and an 8-page exam. Mark your name and login on both sides of the answer sheet, and in the blanks above.

More information

3 February 2011 CSE-3421M Test #1 p. 1 of 14. CSE-3421M Test #1. Design

3 February 2011 CSE-3421M Test #1 p. 1 of 14. CSE-3421M Test #1. Design 3 February 2011 CSE-3421M Test #1 p. 1 of 14 CSE-3421M Test #1 Design Sur / Last Name: Given / First Name: Student ID: Instructor: Parke Godfrey Exam Duration: 75 minutes Term: Winter 2011 Answer the following

More information

Midterm Exam (Version B) CS 122A Spring 2017

Midterm Exam (Version B) CS 122A Spring 2017 NAME: SOLUTION SEAT NO.: STUDENT ID: Midterm Exam (Version B) CS 122A Spring 2017 Max. Points: 100 (Please read the instructions carefully) Instructions: - The total time for the exam is 80 minutes; be

More information

SOLUTIONS TO THE FINAL EXAMINATION Introduction to Database Design Spring 2011

SOLUTIONS TO THE FINAL EXAMINATION Introduction to Database Design Spring 2011 SOLUTIONS TO THE FINAL EXAMINATION Introduction to Database Design Spring 2011 IT University of Copenhagen June 7, 2011 1 Database design (25 points) a) b) Figure 1 shows the ER diagram. create table rer

More information

Introduction. Examination, INF3100, No examination support material is allowed

Introduction. Examination, INF3100, No examination support material is allowed Introduction Examination, INF3100, 2017. No examination support material is allowed In this exam, you can get a maximum of 100 marks. Each problem is worth 5 or 10 marks (shown on the problem). Note that

More information

1 (10) 2 (8) 3 (12) 4 (14) 5 (6) Total (50)

1 (10) 2 (8) 3 (12) 4 (14) 5 (6) Total (50) Student number: Signature: UNIVERSITY OF VICTORIA Faculty of Engineering Department of Computer Science CSC 370 (Database Systems) Instructor: Daniel M. German Midterm Oct 21, 2004 Duration: 60 minutes

More information

Northern India Engineering College, New Delhi Question Bank Database Management System. B. Tech. Mechanical & Automation Engineering V Semester

Northern India Engineering College, New Delhi Question Bank Database Management System. B. Tech. Mechanical & Automation Engineering V Semester 1. List four significant differences between a file-processing system and a DBMS. 2. Explain the difference between physical and logical data independence. 3. What are five main functions of a database

More information

Mahathma Gandhi University

Mahathma Gandhi University Mahathma Gandhi University BSc Computer science III Semester BCS 303 OBJECTIVE TYPE QUESTIONS Choose the correct or best alternative in the following: Q.1 In the relational modes, cardinality is termed

More information

Examination paper for TDT4145 Data Modelling and Database Systems

Examination paper for TDT4145 Data Modelling and Database Systems Department of Computer and Information Science Examination paper for TDT4145 Data Modelling and Database Systems Academic contact during examination: Svein Erik Bratsberg: 99539963 Roger Midtstraum: 99572420

More information

Assignment 6: SQL III

Assignment 6: SQL III Data Modelling and Databases Exercise dates: April 12/April 13, 2018 Ce Zhang, Gustavo Alonso Last update: April 16, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 6: SQL III This assignment

More information

Sankalchand Patel College of Engineering, Visnagar B.E. Semester III (CE/IT) Database Management System Question Bank / Assignment

Sankalchand Patel College of Engineering, Visnagar B.E. Semester III (CE/IT) Database Management System Question Bank / Assignment Sankalchand Patel College of Engineering, Visnagar B.E. Semester III (CE/IT) Database Management System Question Bank / Assignment Introductory concepts of DBMS 1. Explain detailed 3-level architecture

More information

[18 marks] Consider the following schema for tracking customers ratings of books for a bookstore website.

[18 marks] Consider the following schema for tracking customers ratings of books for a bookstore website. Question 1. [18 marks] Consider the following schema for tracking customers ratings of books for a bookstore website. Books(ISBN, title, author, year, length). ISBN is a string used internationally for

More information

IMPORTANT: Circle the last two letters of your class account:

IMPORTANT: Circle the last two letters of your class account: Fall 2001 University of California, Berkeley College of Engineering Computer Science Division EECS Prof. Michael J. Franklin FINAL EXAM CS 186 Introduction to Database Systems NAME: STUDENT ID: IMPORTANT:

More information

CSE 344 Final Review. August 16 th

CSE 344 Final Review. August 16 th CSE 344 Final Review August 16 th Final In class on Friday One sheet of notes, front and back cost formulas also provided Practice exam on web site Good luck! Primary Topics Parallel DBs parallel join

More information

Bachelor in Information Technology (BIT) O Term-End Examination

Bachelor in Information Technology (BIT) O Term-End Examination No. of Printed Pages : 6 I CSI-14 I Bachelor in Information Technology (BIT) O Term-End Examination cn Cn1 June, 2010 CD cp CSI-14 : DATA ANALYSIS AND DATABASE DESIGN Time : 3 hours Maximum Marks : 75

More information

ETH Zurich Spring Semester Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: March 20/March 27, 2017.

ETH Zurich Spring Semester Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: March 20/March 27, 2017. Data Modelling and Databases (DMDB) ETH Zurich Spring Semester 2017 Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: March Assistant(s): Claude Barthels, Eleftherios Sidirourgos, Last update:

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2015 EXAMINATIONS CSC 343 H1S Instructor: Horton and Liu Duration 3 hours PLEASE HAND IN Examination Aids: None Student Number: Family

More information

COMP302. Database Systems

COMP302. Database Systems EXAMINATIONS 2006 MID-YEAR COMP 302 Database Systems Time allowed: Instructions: 3 Hours Answer all questions. Make sure that your answers are clear and to the point. Calculators and printed foreign language

More information

6 February 2014 CSE-3421M Test #1 w/ answers p. 1 of 14. CSE-3421M Test #1. Design

6 February 2014 CSE-3421M Test #1 w/ answers p. 1 of 14. CSE-3421M Test #1. Design 6 February 2014 CSE-3421M Test #1 w/ answers p. 1 of 14 CSE-3421M Test #1 Design Sur / Last Name: Given / First Name: Student ID: Instructor: Parke Godfrey Exam Duration: 75 minutes Term: Winter 2014 Answer

More information

Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web: Ph:

Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web:     Ph: Serial : 0. PT_CS_DBMS_02078 Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web: E-mail: info@madeeasy.in Ph: 0-5262 CLASS TEST 208-9 COMPUTER SCIENCE & IT Subject :

More information

DATABASE MANAGEMENT SYSTEMS

DATABASE MANAGEMENT SYSTEMS www..com Code No: N0321/R07 Set No. 1 1. a) What is a Superkey? With an example, describe the difference between a candidate key and the primary key for a given relation? b) With an example, briefly describe

More information

Introduction to Databases

Introduction to Databases Introduction to Databases IT University of Copenhagen January 16, 2006 This exam consists of 5 problems with a total of 16 questions. The weight of each problem is stated. You have 4 hours to answer all

More information

Database Systems. Basics of the Relational Data Model

Database Systems. Basics of the Relational Data Model Database Systems Relational Design Theory Jens Otten University of Oslo Jens Otten (UiO) Database Systems Relational Design Theory INF3100 Spring 18 1 / 30 Basics of the Relational Data Model title year

More information

CMSC 461 Final Exam Study Guide

CMSC 461 Final Exam Study Guide CMSC 461 Final Exam Study Guide Study Guide Key Symbol Significance * High likelihood it will be on the final + Expected to have deep knowledge of can convey knowledge by working through an example problem

More information

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601 Techno India Batanagar Computer Science and Engineering Model Questions Subject Name: Database Management System Subject Code: CS 601 Multiple Choice Type Questions 1. Data structure or the data stored

More information

CS348: INTRODUCTION TO DATABASE MANAGEMENT (Winter, 2011) FINAL EXAMINATION

CS348: INTRODUCTION TO DATABASE MANAGEMENT (Winter, 2011) FINAL EXAMINATION CS348: INTRODUCTION TO DATABASE MANAGEMENT (Winter, 2011) FINAL EXAMINATION INSTRUCTOR: Grant Weddell TIME: 150 minutes WRITE YOUR NAME AND ID HERE: NOTE 1: This is a closed book examination. For example,

More information

Database Management Systems (Classroom Practice Booklet Solutions)

Database Management Systems (Classroom Practice Booklet Solutions) Database Management Systems (Classroom Practice Booklet Solutions) 2. ER and Relational Model 4 ssn cid 01. Ans: (b) Professor Teaches course 02. Ans: (c) Sol: Because each patient is admitted into one

More information

1. (a) Explain the Transaction management in a database. (b) Discuss the Query Processor of Database system structure. [8+8]

1. (a) Explain the Transaction management in a database. (b) Discuss the Query Processor of Database system structure. [8+8] Code No: R059210506 Set No. 1 1. (a) Explain the Transaction management in a database. (b) Discuss the Query Processor of Database system structure. [8+8] 2. (a) What is an unsafe query? Give an example

More information

Relational Model and Relational Algebra. Rose-Hulman Institute of Technology Curt Clifton

Relational Model and Relational Algebra. Rose-Hulman Institute of Technology Curt Clifton Relational Model and Relational Algebra Rose-Hulman Institute of Technology Curt Clifton Administrative Notes Grading Weights Schedule Updated Review ER Design Techniques Avoid redundancy and don t duplicate

More information

DATABASE MANAGEMENT SYSTEM SHORT QUESTIONS. QUESTION 1: What is database?

DATABASE MANAGEMENT SYSTEM SHORT QUESTIONS. QUESTION 1: What is database? DATABASE MANAGEMENT SYSTEM SHORT QUESTIONS Complete book short Answer Question.. QUESTION 1: What is database? A database is a logically coherent collection of data with some inherent meaning, representing

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science DECEMBER 2011 EXAMINATIONS CSC 343 H1F Instructors: Horton and Papangelis Duration 3 hours PLEASE HAND IN Examination Aids: None Student

More information

Introduction to Database Systems. Announcements CSE 444. Review: Closure, Key, Superkey. Decomposition: Schema Design using FD

Introduction to Database Systems. Announcements CSE 444. Review: Closure, Key, Superkey. Decomposition: Schema Design using FD Introduction to Database Systems CSE 444 Lecture #9 Jan 29 2001 Announcements Mid Term on Monday (in class) Material in lectures Textbook Chapter 1.1, Chapter 2 (except 2.1 and ODL), Chapter 3 (except

More information

Applied Databases. Sebastian Maneth. Lecture 5 ER Model, Normal Forms. University of Edinburgh - January 30 th, 2017

Applied Databases. Sebastian Maneth. Lecture 5 ER Model, Normal Forms. University of Edinburgh - January 30 th, 2017 Applied Databases Lecture 5 ER Model, Normal Forms Sebastian Maneth University of Edinburgh - January 30 th, 2017 Outline 2 1. Entity Relationship Model 2. Normal Forms From Last Lecture 3 the Lecturer

More information

Solutions to Final Examination

Solutions to Final Examination Prof. Li-Yan Yuan CMPUT 391: Database Management Systems Solutions to Final Examination April 23, 2007 It is a close-book examination and the time for the test is 120 minutes. There are ten (10) questions

More information

Basant Group of Institution

Basant Group of Institution Basant Group of Institution Visual Basic 6.0 Objective Question Q.1 In the relational modes, cardinality is termed as: (A) Number of tuples. (B) Number of attributes. (C) Number of tables. (D) Number of

More information

CSE 444, Winter 2011, Midterm Examination 9 February 2011

CSE 444, Winter 2011, Midterm Examination 9 February 2011 Name: CSE 444, Winter 2011, Midterm Examination 9 February 2011 Rules: Open books and open notes. No laptops or other mobile devices. Please write clearly. Relax! You are here to learn. An extra page is

More information

Relational Database Design (II)

Relational Database Design (II) Relational Database Design (II) 1 Roadmap of This Lecture Algorithms for Functional Dependencies (cont d) Decomposition Using Multi-valued Dependencies More Normal Form Database-Design Process Modeling

More information

Database Systems SQL SL03

Database Systems SQL SL03 Checking... Informatik für Ökonomen II Fall 2010 Data Definition Language Database Systems SQL SL03 Table Expressions, Query Specifications, Query Expressions Subqueries, Duplicates, Null Values Modification

More information

CS/B.Tech/CSE/New/SEM-6/CS-601/2013 DATABASE MANAGEMENENT SYSTEM. Time Allotted : 3 Hours Full Marks : 70

CS/B.Tech/CSE/New/SEM-6/CS-601/2013 DATABASE MANAGEMENENT SYSTEM. Time Allotted : 3 Hours Full Marks : 70 CS/B.Tech/CSE/New/SEM-6/CS-601/2013 2013 DATABASE MANAGEMENENT SYSTEM Time Allotted : 3 Hours Full Marks : 70 The figures in the margin indicate full marks. Candidates are required to give their answers

More information

Applied Databases. Sebastian Maneth. Lecture 5 ER Model, normal forms. University of Edinburgh - January 25 th, 2016

Applied Databases. Sebastian Maneth. Lecture 5 ER Model, normal forms. University of Edinburgh - January 25 th, 2016 Applied Databases Lecture 5 ER Model, normal forms Sebastian Maneth University of Edinburgh - January 25 th, 2016 Outline 2 1. Entity Relationship Model 2. Normal Forms Keys and Superkeys 3 Superkey =

More information

CSEP 514 Midterm. Tuesday, Feb. 7, 2017, 5-6:20pm. Question Points Score Total: 150

CSEP 514 Midterm. Tuesday, Feb. 7, 2017, 5-6:20pm. Question Points Score Total: 150 CSEP 514 Midterm Tuesday, Feb. 7, 2017, 5-6:20pm Name: Question Points Score 1 50 2 25 3 50 4 25 Total: 150 This exam is CLOSED book and CLOSED devices. You are allowed ONE letter-size page with notes

More information

Solutions to Final Examination

Solutions to Final Examination Prof. Li-Yan Yuan CMPUT 391: Database Management Systems Solutions to Final Examination December 15, 2005 It is a close-book examination and the time for the test is 120 minutes. There are twelve (12)

More information

NAPIER UNIVERSITY SCHOOL OF COMPUTING FIRST DIET (SEMESTER TWO) EXAMINATION SESSION CS 71012: DATABASE SYSTEMS TIME ALLOWED: 2 HOURS

NAPIER UNIVERSITY SCHOOL OF COMPUTING FIRST DIET (SEMESTER TWO) EXAMINATION SESSION CS 71012: DATABASE SYSTEMS TIME ALLOWED: 2 HOURS NAPIER UNIVERSITY SCHOOL OF COMPUTING FIRST DIET (SEMESTER TWO) EXAMINATION SESSION 1999-2000 CS 71012: DATABASE SYSTEMS DATE: TIME ALLOWED: 2 HOURS START TIME: FINISH TIME: EXAMINER: A. CUMMING K. CHISHOLM

More information

Question 1. SQL and Relational Algebra [25 marks] Question 2. Enhanced Entity Relationship Data Model [25 marks]

Question 1. SQL and Relational Algebra [25 marks] Question 2. Enhanced Entity Relationship Data Model [25 marks] EXAMINATIONS 2003 MID-YEAR COMP 302 Database Systems Time allowed: Instructions: 3 Hours Answer all questions. Make sure that your answers are clear and to the point. Calculators and foreign language dictionaries

More information

CSCE 4523 Introduction to Database Management Systems Final Exam Fall I have neither given, nor received,unauthorized assistance on this exam.

CSCE 4523 Introduction to Database Management Systems Final Exam Fall I have neither given, nor received,unauthorized assistance on this exam. CSCE 4523 Introduction to Database Management Systems Final Exam Fall 2016 I have neither given, nor received,unauthorized assistance on this exam. Signature Printed Name: Attempt all of the following

More information

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered

More information

Database Systems SQL SL03

Database Systems SQL SL03 Inf4Oec10, SL03 1/52 M. Böhlen, ifi@uzh Informatik für Ökonomen II Fall 2010 Database Systems SQL SL03 Data Definition Language Table Expressions, Query Specifications, Query Expressions Subqueries, Duplicates,

More information

Exam code: Exam name: Database Fundamentals. Version 16.0

Exam code: Exam name: Database Fundamentals. Version 16.0 98-364 Number: 98-364 Passing Score: 800 Time Limit: 120 min File Version: 16.0 Exam code: 98-364 Exam name: Database Fundamentals Version 16.0 98-364 QUESTION 1 You have a table that contains the following

More information

DBS 2006: 1 st week. DBS 2006: Plan. DB Life-Cycle: Requirement analysis. Data modelling: Conceptual Design. Logical Schema Design

DBS 2006: 1 st week. DBS 2006: Plan. DB Life-Cycle: Requirement analysis. Data modelling: Conceptual Design. Logical Schema Design DBS 006: Plan DBS 006: 1 st week DB Life-Cycle: Data modelling: 1 systematic design of DB 3-3 weeks Physical Schema Design Database usage: access to the stored data using SQL interactively or via application

More information

Data about data is database Select correct option: True False Partially True None of the Above

Data about data is database Select correct option: True False Partially True None of the Above Within a table, each primary key value. is a minimal super key is always the first field in each table must be numeric must be unique Foreign Key is A field in a table that matches a key field in another

More information

CS145 Midterm Examination

CS145 Midterm Examination CS145 Midterm Examination Spring 2004, Prof. Widom Please read all instructions (including these) carefully. There are 9 problems on the exam, with a varying number of points for each problem and subproblem

More information

CSE 562 Final Exam Solutions

CSE 562 Final Exam Solutions CSE 562 Final Exam Solutions May 12, 2014 Question Points Possible Points Earned A.1 7 A.2 7 A.3 6 B.1 10 B.2 10 C.1 10 C.2 10 D.1 10 D.2 10 E 20 Bonus 5 Total 105 CSE 562 Final Exam 2014 Relational Algebra

More information

Fault Tolerance. o Basic Concepts o Process Resilience o Reliable Client-Server Communication o Reliable Group Communication. o Distributed Commit

Fault Tolerance. o Basic Concepts o Process Resilience o Reliable Client-Server Communication o Reliable Group Communication. o Distributed Commit Fault Tolerance o Basic Concepts o Process Resilience o Reliable Client-Server Communication o Reliable Group Communication o Distributed Commit -1 Distributed Commit o A more general problem of atomic

More information

The SQL data-definition language (DDL) allows defining :

The SQL data-definition language (DDL) allows defining : Introduction to SQL Introduction to SQL Overview of the SQL Query Language Data Definition Basic Query Structure Additional Basic Operations Set Operations Null Values Aggregate Functions Nested Subqueries

More information

CS 461: Database Systems. Final Review. Julia Stoyanovich

CS 461: Database Systems. Final Review. Julia Stoyanovich CS 461: Database Systems Final Review (stoyanovich@drexel.edu) Final exam logistics When: June 6, in class The same format as the midterm: open book, open notes 2 hours in length The exam is cumulative,

More information

CS 327E Lecture 2. Shirley Cohen. January 27, 2016

CS 327E Lecture 2. Shirley Cohen. January 27, 2016 CS 327E Lecture 2 Shirley Cohen January 27, 2016 Agenda Announcements Homework for today Reading Quiz Concept Questions Homework for next time Announcements Lecture slides and notes will be posted on the

More information

Attach extra pages as needed. Write your name and ID on any extra page that you attach. Please, write neatly.

Attach extra pages as needed. Write your name and ID on any extra page that you attach. Please, write neatly. UCLA Computer Science Department Fall 2003 Instructor: C. Zaniolo TA: Fusheng Wang Student Name and ID: CS143 Final EXAM: Closed Book, 3 Hours Attach extra pages as needed. Write your name and ID on any

More information

Final Review. May 9, 2018 May 11, 2018

Final Review. May 9, 2018 May 11, 2018 Final Review May 9, 2018 May 11, 2018 1 SQL 2 A Basic SQL Query (optional) keyword indicating that the answer should not contain duplicates SELECT [DISTINCT] target-list A list of attributes of relations

More information

Final Review. May 9, 2017

Final Review. May 9, 2017 Final Review May 9, 2017 1 SQL 2 A Basic SQL Query (optional) keyword indicating that the answer should not contain duplicates SELECT [DISTINCT] target-list A list of attributes of relations in relation-list

More information

Data Analysis. CPS352: Database Systems. Simon Miner Gordon College Last Revised: 12/13/12

Data Analysis. CPS352: Database Systems. Simon Miner Gordon College Last Revised: 12/13/12 Data Analysis CPS352: Database Systems Simon Miner Gordon College Last Revised: 12/13/12 Agenda Check-in NoSQL Database Presentations Online Analytical Processing Data Mining Course Review Exam II Course

More information

VIEW OTHER QUESTION PAPERS

VIEW OTHER QUESTION PAPERS VIEW OTHER QUESTION PAPERS E B4E0562 Reg No.: Name: Total Pages: 2 APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY FOURTH SEMESTER B.TECH DEGREE EXAMINATION, JULY 2017 Course Code: CS208 Course Name: PRINCIPLES

More information

Assignment 12: Commit Protocols and Replication Solution

Assignment 12: Commit Protocols and Replication Solution Data Modelling and Databases Exercise dates: May 24 / May 25, 2018 Ce Zhang, Gustavo Alonso Last update: June 04, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 12: Commit Protocols and Replication

More information

SAMPLE FINAL EXAM SPRING/2H SESSION 2017

SAMPLE FINAL EXAM SPRING/2H SESSION 2017 SAMPLE FINAL EXAM SPRING/2H SESSION 2017 School of Computing, Engineering and Mathematics Complete your details in this section when instructed by the Exam Supervisor at the start of the exam. You should

More information

DATABASE MANAGEMENT SYSTEM

DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM For COMPUTER SCIENCE DATABASE MANAGEMENT. SYSTEM SYLLABUS ER model. Relational model: relational algebra, tuple calculus, SQL. Integrity constraints, normal forms. File organization,

More information

Database Management

Database Management Database Management - 2013 Model Answers 1. a. A cyclic relationship type (also called recursive) is a relationship type between two occurrences of the same entity type. With each entity type in a cyclic

More information

UNIVERSITY OF CALIFORNIA College of Engineering Department of EECS, Computer Science Division

UNIVERSITY OF CALIFORNIA College of Engineering Department of EECS, Computer Science Division UNIVERSITY OF CALIFORNIA College of Engineering Department of EECS, Computer Science Division CS186 Eben Haber Fall 2003 Midterm Midterm Exam: Introduction to Database Systems This exam has seven problems,

More information

CSE-3421M Test #2. Queries

CSE-3421M Test #2. Queries 14 March 2013 CSE-3421M Test #2 w/ answers p. 1 of 16 CSE-3421M Test #2 Queries Family Name: Given Name: Student#: CS&E Account: Instructor: Parke Godfrey Exam Duration: 75 minutes Term: Winter 2013 Answer

More information

MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: Time: 60 min Marks: 38

MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: Time: 60 min Marks: 38 Student Info StudentID: Center: ExamDate: MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: 1356458 Time: 60 min Marks: 38 BC080402322 OPKST 5/28/2010 12:00:00 AM

More information

Question 1. Relational Data Model and Relational Algebra [26 marks] Question 2. SQL and [26 marks]

Question 1. Relational Data Model and Relational Algebra [26 marks] Question 2. SQL and [26 marks] EXAMINATIONS 2004 MID-YEAR COMP 302 Database Systems Time allowed: Instructions: 3 Hours Answer all questions. Make sure that your answers are clear and to the point. Calculators and printed foreign language

More information

; Spring 2008 Prof. Sang-goo Lee (14:30pm: Mon & Wed: Room ) ADVANCED DATABASES

; Spring 2008 Prof. Sang-goo Lee (14:30pm: Mon & Wed: Room ) ADVANCED DATABASES 4541.564; Spring 2008 Prof. Sang-goo Lee (14:30pm: Mon & Wed: Room 302-208) ADVANCED DATABASES Syllabus Text Books Exams (tentative dates) Database System Concepts, 5th Edition, A. Silberschatz, H. F.

More information

CSE 344 Final Examination

CSE 344 Final Examination CSE 344 Final Examination March 15, 2016, 2:30pm - 4:20pm Name: Question Points Score 1 47 2 17 3 36 4 54 5 46 Total: 200 This exam is CLOSED book and CLOSED devices. You are allowed TWO letter-size pages

More information

Name Class Account UNIVERISTY OF CALIFORNIA, BERKELEY College of Engineering Department of EECS, Computer Science Division J.

Name Class Account UNIVERISTY OF CALIFORNIA, BERKELEY College of Engineering Department of EECS, Computer Science Division J. Do not write in this space CS186 Spring 2001 Name Class Account UNIVERISTY OF CALIFORNIA, BERKELEY College of Engineering Department of EECS, Computer Science Division J. Hellerstein Final Exam Final Exam:

More information

Assignment 12: Commit Protocols and Replication

Assignment 12: Commit Protocols and Replication Data Modelling and Databases Exercise dates: May 24 / May 25, 2018 Ce Zhang, Gustavo Alonso Last update: June 04, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 12: Commit Protocols and Replication

More information

IMPORTANT: Circle the last two letters of your class account:

IMPORTANT: Circle the last two letters of your class account: Fall 2002 University of California, Berkeley College of Engineering Computer Science Division EECS Prof. Michael J. Franklin MIDTERM AND SOLUTIONS CS 186 Introduction to Database Systems NAME: Norm L.

More information

Relational Model, Relational Algebra, and SQL

Relational Model, Relational Algebra, and SQL Relational Model, Relational Algebra, and SQL August 29, 2007 1 Relational Model Data model. constraints. Set of conceptual tools for describing of data, data semantics, data relationships, and data integrity

More information

Chapter 3: Introduction to SQL

Chapter 3: Introduction to SQL Chapter 3: Introduction to SQL Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 3: Introduction to SQL Overview of the SQL Query Language Data Definition Basic Query

More information

Midterm Review. Winter Lecture 13

Midterm Review. Winter Lecture 13 Midterm Review Winter 2006-2007 Lecture 13 Midterm Overview 3 hours, single sitting Topics: Relational model relations, keys, relational algebra expressions SQL DDL commands CREATE TABLE, CREATE VIEW Specifying

More information

E-R diagrams and database schemas. Functional dependencies. Definition (tuple, attribute, value). A tuple has the form

E-R diagrams and database schemas. Functional dependencies. Definition (tuple, attribute, value). A tuple has the form E-R diagrams and database schemas Functional dependencies Definition (tuple, attribute, value). A tuple has the form {A 1 = v 1,..., A n = v n } where A 1,..., A n are attributes and v 1,..., v n are their

More information

Midterm Exam #1 Version A CS 122A Winter 2017

Midterm Exam #1 Version A CS 122A Winter 2017 NAME: SEAT NO.: STUDENT ID: Midterm Exam #1 Version A CS 122A Winter 2017 Max. Points: 100 (Please read the instructions carefully) Instructions: - The total time for the exam is 50 minutes; be sure to

More information