Uppsala University Department of Information Technology Kjell Orsborn Final Exam 2010-04-07 DATABASE TECHNOLOGY - 1DL300 Date... Wednesday 7 April, 2010 Time... 08:00-13:00 Teacher on duty... Kjell Orsborn, phone 471 11 54 or 070 425 06 91 Exam aids... calculator Instructions: Read through the complete exam and note any unclear directives before you start solving the questions. The following guide lines hold: Write clear and neat answers! Answers that cannot be read can obviously not result in any points and unclear formulations can be misunderstood. Assumptions outside of what is stated in the question must be explained. Any assumptions made should not alter the given question. Write your answer on only one side of the paper and use a new paper for each new question to simplyfy the correction process and to avoid possible misunderstandings. A passing grade requires about 50% of the maximum number of points.
1. Database terminology: 6 pts Explain the following database concepts: (a) DBMS A database management system (DBMS) is one (or several) program that provides functionality for users to develop, use, and maintain a database. Thus, a DBMS is a general software system for dening, populating (constructing), manipulating and sharing databases for different types of users and applications. (b) view (in a relational database) A view may represent a subset of a database or virtual data that is derived from the database. In a relational database management system, a view is defined as a virtual table representing the result of a SQL database query. (c) multi-valued attribute Svar: Ett flervärt attribut är ett attribut som kan anta en mängd samtidiga värden såsom exempelvis telefonnummer eller vänner. A multivalued attribute is an attribute that can som kan anta en mängd samtidiga värden såsom exempelvis telefonnummer eller vänner. (d) transaction A transaction is a logical unit of database processing that is performed in its entirety or not at all. 2. Database system architecture: 5 pts Draw a figure and explain in text a typical two-tier database system architecture. Many traditional database applications use a two-tier architecture including client and database server. The client contain GUI interfaces and application program whereas the database server is responsible for handling the data management by responding to query and update expressions sent to the DBMS from the client. 3. Enhanced entity-relationship modeling: 7 pts (a) When specifying a specialization or generalization (sv. specialisering eller generalisering) one can specify different constraints. In this context, explain the following concepts: (4 pts) i. disjointness constraint ii. completeness constraint i. disjointness constraint innebär att subklasserna till en superklass kan specificeras till att vara disjunkta, dvs att en instans kan endast vara
Physical two-tier client-server architecture Kjell Orsborn - UDBL - IT - UU Figure 1: Physical two-tier client/server architecture 4/6/10 28 medlem av en av dessa subklasser, eller överlappande (eng. overlapping), dvs disjunkhetsvillkoret krävs så att instanser tillåts vara medlemmar till fler än en av subklasserna. ii. completeness constraint specificerar klassificeringen till att vara total eller partiell. Om klassificeringen är total så måste instanserna till superklasserna vara medlem i någon subklass och för en partiell klassificering behöver ej instanserna till superklassen vara medlem av någon subklass. Notera att villkoren a), b) är ortogonala, dvs de är oberoende av varann så att alla kombinationer av dessa kan existera. (b) Suggest a suitable representation of the EER-model in Figure 2 as a set of relational schemas. (3 pts) Figure 2: An EER-model for Problem 3b. vehicle(vid, license plate no, price),
car(vid, max speed, no of passengers), truck(vid, no of axels, tonnage) 4. Normalization: 5 pts Explain the following concepts: (a) functional dependency (sv. funktionellt beroende) and (b) full functional dependency (sv. fullt funktionellt beroende). Ett funktionellt beroende så att X bestämmer Y, X - Y, existerar då om för varje par av tupler t 1, t 2 r(r) och för alla r(r) följande gäller: om t 1 [X] = t 2 [X] så gäller att t 1 [Y ] = t 2 [Y ] Fullt funktionellt beroende anger att för ett funktionellt beroende gäller att det inte finns någon delmängd attribut A X så att (X {A})Y. Här gäller att R är ett relationsschema och r(r) är en instans av schemat R med attributen A 1,..., A n och X, Y {A 1,..., A n }. Alltså ett fullt funktionellt beroende är ett funktionellt beroende som inte innehåller något onödigt attribut i determinanten (vänsterledet i beroendet). 5. SQL: 4 pts We have the following relational schema: enterprise(eid, name, turnover), where Xid is a key. Express two variants of the following query in SQL: Find all enterprises (and their turnover) that have a higher turnover than the enterprise named MagicNumbersInc. (a) express the join condition in the where clause in the SQL-query (2 pts) (b) express the join condition in the from clause in the SQL-query (2 pts) select distinct T.name, T.turnover from enterprise as T, enterprise as S where T.turnover > S.turnover and S.name = "MagicNumbersInc" select t.name, t.turnover from enterprise t where t.turnover > some (select turnover from enterprise where name = "MagicNumbersInc")
6. Concurrency control (sv. samtidighetskontroll): 5 pts (a) Describe the principles for lock management (sv. låshantering) for transactions controlled by a two-phase locking protocol (sv. två-fas låsningsprotokoll). (3 pts) En transaktion sägs följa ett två-fas låsningsprotokoll om alla låsningsoperationer föregår den färsta upplåsningsoperationen (unlock) i transaktionen. Alltså en sådan transaktion genomgår en expanderande fas där nya lås kan utfärdas men inga lås kan släppas; och en krympande fas där existerande lås kan låsas upp men inga nya lås kan erhållas. (b) What important properties can be stated by transaction schedules controlled by two-phase locking protocols? (2 pts) Två-fas låsningsprotokoll garanterar serialiserbara transaktionsscheman men garanterar ej frihet från deadlocks. 7. Recovery: 8 pts (a) Describe the basic steps in the recovery procedure according to a multiuser version of the deferred update model (sv. uppskjuten uppdatering) with check points and where strict schedules is assumed. (3 pts) Recovery according to the deferred update model (no-undo/redo): 1. Start from the last record in the log file and traverse backwards. Create two lists: C transactions that have reached their commit points NC transactions that have not reached their commit points. 2. Start from the beginning of the log file and redo all (Write,T,...) for all transactions T in the list C. 3. Restart all transactions in the list NC. If the log file is long, step 2 will take long time. An improvement of this method is accomplished by introducing what s called check points. (b) Describe the basic steps in the recovery procedure according to a multiuser version of the immediate update model (sv. omedelbar uppdatering) with check points and where strict schedules is assumed. (3 pts) Recovery according to the immediate update model (undoredo): 1. Start from the last record in the log file and traverse backwards until a check point is reached. Create two lists: C transactions that have reached their commit points NC transactions that have not reached their commit points. 2. Start from the last record in the log file and apply the UNDO procedure to all (Write,T,...) where T NC. 3. Start from the check point and REDO all transactions (Write,T,...) such that T C. 4. Restart all failured transactions.
(c) What type of recovery operations have to be applied to the physical database in applying a recovery procedure after a non-catastrophic failure using the deferred and the immediate update models respectively (2 pts) deferred: redo, immediate, undo and redo Good Luck! / Kjell