Answers to Midterm - Exam. Feb. 27, 2006

Slides:



Advertisements
Similar presentations
Exercise 2 Relational Calculus
Advertisements

The Relational Calculus
Database System - Assignment #3 Sept. 2012Yangjun Chen ACS Assignment #3 due Wed., Nov. 14, (30) Exercise 7.17 on Page 235 Show the result.
IDA / ADIT Lecture 10: Database recovery Jose M. Peña
Defined by Edgar Codd in 1970 Defined by Edgar Codd in 1970 Considered ingenious but impractical Considered ingenious but impractical Conceptually simple.
Transactions and Recovery Checkpointing Souhad Daraghma.
COMPANY schema EMPLOYEE
OUTLINE OF THE LECTURE PART I GOAL: Understand the Data Definition Statements in Fig 4.1 Step1: Columns of the Tables and Data types. Step2: Single column.
Company Database. CREATE TABLE DEPARMENT ( DNAME VARCHAR(10) NOT NULL, DNUMBER INTEGER NOT NULL, MGRSSN CHAR(9), MGRSTARTDATE CHAR(9), PRIMARY KEY (DNUMBER),
Exploring Microsoft Access 2003 Chapter 4 Proficiency: Relational Databases, External Data, Charts, Pivot, and the Switchboard.
Jan. 2014ACS Transaction processing concepts (Ch. 19, 3 rd ed. – Ch 17, 4 th ed., 5 th ed. – Ch 21, 6 th ed.)
Transaction Processing: September 27, Database Access For TP, represent database as a collection of named items. Read(X) - read database item X.
Review Database Application Development Access Database Development ER-diagram Forms Reports Queries.
Analysis of Midterm-Examination Jan. 2010ACS-7102 Yangjun Chen1 1.(15) Draw an ER-diagram to describe the following real world problem. (a)A university.
ICS (072)Concurrency Control1 Transaction Processing and Concurrency Control Dr. Muhammad Shafique Chapter March 2008.
1 Introduction to Transaction Processing (1)
관계 연산자 & SQL. Selection SELECT * FROM r WHERE A=B AND D>5.
Review: Application of Database Systems
Relational Algebra - Chapter (7th ed )
Retrieve the names of all employees in department 5 who work more than 10 hours per week on the ‘ProductX’ project. p10ssn ← (Π essn (σ hours > 10 (works-on.
ICS (072)Concurrency Control Techniques1 Concurrency Control Techniques Chapter 18 Dr. Muhammad Shafique.
Concurrency Control Techniques Chapter 18
 Employee (fname, minit, lname, ssn, bdate, address, sex, salary, superssn, dno)  Department (dname, dnumber, mgrssn, mgrstartdate) 
Database Management Systems. NESTING OF QUERIES  Some queries require that existing values in the database be retrieved and then used in a comparison.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Logical Design database design. Dr. Mohamed Osman Hegaz2 Conceptual Database Designing –Provides concepts that are close to the way many users perceive.
CSCI Transaction Processing Concepts 1 TRANSACTION PROCESSING CONCEPTS Dr. Awad Khalil Computer Science Department AUC.
Analysis of Midterm-Examination Oct. 22, 2014ACS-7102 Yangjun Chen1 1.(15) Draw an ER-diagram to describe the following real world problem. (a)A university.
Transaction Processing The main reference of this presentation is the textbook and PPT from : Elmasri & Navathe, Fundamental of Database Systems, 4th edition,
1 CSE 480: Database Systems Lecture 24: Concurrency Control.
1Fundamentals of Database Systems 기본키에 밑줄을 그은 COMPANY 관계 데이타베이스 스키마 FNAMEMINITLNAMESSNBDATEADDRESSSEXSALARYSUPERSSNDNO EMPLOYEE DNAMEDNUMBERMGRSSNMGRSTARTDATE.
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 16 A First Course in Database Systems.
Analysis of Midterm-Examination Oct. 21, 2013ACS-7102 Yangjun Chen1 1.(15) Draw an ER-diagram to describe the following real world problem. (a)A university.
Big Data Yuan Xue CS 292 Special topics on.
Enterprise Database Systems Transaction Processing Dr. Georgia Garani Dr. Theodoros Mitakos Technological Educational Institution of Larissa.
Database recovery techniques
The SQL Database Grammar
Database System Implementation CSE 507
Database System Implementation CSE 507
Enterprise Database Systems Transaction Processing
CS580 Advanced Database Topics
Transaction processing concepts
6/22/2018.
Database Design The Relational Model Text Ch5
1 Introduction to Transaction Processing (1)
Chap 20 – Transaction Processing
Database System Implementation CSE 507
376a. Database Design Dept. of Computer Science Vassar College
Mapping ER Diagrams to Tables
Joining Tables ضم الجداول وإستخراج مناظر views منها الهدف : 1- استخراج المعلومات من جدولين أو اكثر بالإستفادة من الرابط بينهما وبإستخدام SQL 2- شروط قواعد.
Introduction to Transaction Processing Concepts and Theory
Introduction to Transaction Processing Concepts and Theory
Company Requirements.
12/4/2018.
Introduction to Transaction Processing Concepts and Theory
Query Processing and Optimization, Concurrency Control
1 Introduction to Transaction Processing (1)
(a) A university is organized into faculties.
2/23/2019.
Introduction to Transaction Processing Concepts and Theory
Lec 9: Introduction to Transaction Processing Concepts and Theory
1. Explain the following concepts: (a) superkey (b) key
1.(5) Describe the working process with a database system.
ISC321 Database Systems I Chapter 4: SQL: Data definition, Constraints, and Basic Queries and Updates Fall 2015 Dr. Abdullah Almutairi.
(a) A university is organized into faculties.
1. Explain the following concepts of the ER data model:
SQL Grouping, Ordering & Arithmetics Presented by: Dr. Samir Tartir
SQL: Set Operations & Nested Queries. Presented by: Dr. Samir Tartir
Outline Introduction Background Distributed DBMS Architecture
Answers to Midterm - Exam. Feb. 28, 2018
Presentation transcript:

Answers to Midterm - Exam. Feb. 27, 2006 1.(20) Apply the quick sorting algorithm to the following sequence:   1, 10, 9, 8, 5, 7, 6, 2, 4, 3, and trace the sequence change step by step. 12/3/2019

The center element is 5. j i i = j = 5 main idea: 1st step: 1 9 8 5 7 6 2 4 2nd step: 1 3 8 5 7 6 2 10 3rd step: 1 3 4 5 7 6 9 10 4rd step: 1 3 4 2 5 7 6 8 9 10 from center to 10 3 i j 9 4 8 2 i = j = 5 Smaller than 5 greater than 5 12/3/2019

8 2 i = 3 j = 2 5th step: 1 4 5 7 6 9 9 10 3 6th step: 1 2 3 4 from center to 5th step: 1 4 5 7 6 9 9 10 6th step: 1 2 3 4 from center to 8 3 2 i = 3 j = 2 12/3/2019

center 7th step: 1 2 from to i = 1 j = 1 8th step: 2 12/3/2019

(b) When the system crashes as shown in Fig. 1, how do we undo 2.(20) (a) Tell the difference between commit points and checking points. (10) (b) When the system crashes as shown in Fig. 1, how do we undo or redo the transactions? Here, we assume that all these transactions are not interferenced and at a checking point all the made by the transactions will be stored in the database. (10) Time T1 T2 T3 T4 T5 Time of checkpoint failure Fig. 1 12/3/2019

The DBMS force-writes all changes/updates made by a 2. (a) A transaction has committed when it has finished all this work. At this point: The DBMS force-writes all changes/updates made by a transaction to the log Then the DBMS force-writes a commit record for the Transaction 12/3/2019

A DBMS will execute a checkpoint in order to simplify the recovery process. At a checkpoint any committed transactions will have their database writes (updates/changes) physically written to the database. (The changes made by unaccomplished transactions may also be written to the database.) This is a four-step process Suspend transaction execution temporarily The DBMS force-writes all database changes to the database The DBMS writes a checkpoint record to the log and force-writes the log to disk Transaction execution is resumed 12/3/2019

2. (b) T1 – redone T2 – no redo, no undo T3 – no redo, no undo T5 – undone 12/3/2019

3.(20)Given the relation schemas shown below, generate an optimal query tree for the following query: SELECT fname, lname FROM EMPLOYEE, DEPARTMENT, PROJECT, WORKS_ON WHERE salary > 50000 and Pname = ‘Web Database’ and Pnumber = PNO and hours > 30 and dno = dnumber and Dname = ‘CS’ and ssn = ESSN 12/3/2019

Dname, dnumber, mgrssn, mgrstartdate DEPARTMENT Dname, dnumber, mgrssn, mgrstartdate EMPLOYEE fname, minit, lname, ssn, bdate, address, sex, salary, superssn, dno PROJECT Pname, Pnumber, Plocation, Dnum WORKS_ON ESSN, PNO, HOURS 12/3/2019

fname, lname((salary >50000(Employee) Dname=’CC’(Department) dno=Dnumber ((hours >30( Works_on) Pname=’web database’(Project)) ssn=ESSN PNO=Pnumber 12/3/2019

Question 3 fname, lname fname, lname PNO Pnumber ssn=ESSN Pname= ‘web database’ fname, lname ssn ESSN, PNO Project Dnumber=dno Dept. Dname=’BC’ dnumber fname, lname, ssn, dno hours > 30 salary > 50000 Employee Works_on 12/3/2019

Answers to Midterm - Exam. Feb. 27, 2006 4.(30) (i) Explain the difference among the recoverable, cascadeless and strict schedules. (10)   (ii) Given the following schedules, show which is recoverable, non-recoverable, cascadeless or strict. (20) (a) R1(X), W1(X), R2(Z), W2(Z), R1(Y), W1(Y), R2(Y), C1, R2(X), W2(X), C2. (b) R1(X), W1(X), R2(X), R1(Y), W2(X), C2, W1(Y), C1. (c) R1(X), R2(X), W1(X), R2(Y), W2(Y), W2(X), C2, R1(Y), W1(Y), C1. (d) R1(X), W1(X), R2(Y), W2(Y), C1, R2(X), W2(X), C2. (e) R1(X), R2(X), W1(X), R2(Y), W2(X), C2, A1. 12/3/2019

Recoverable: A schedule S is recoverable if no transaction T in S commits until all transactions T’ that have written an item that T reads have committed. cascadeless: Every transaction in the schedule reads only items that were written by committed transaction. Strict: a transaction can neither read nor write an item X until the last transaction that wrote X has committed or aborted. (ii) Recoverable Non-recoverable Cascadeless Strict cascadeless 12/3/2019

Answers to Midterm - Exam. Feb. 27, 2006 5.(5) (i)Consider the following transactions T1 and T2, which execute concurrently. Is the result of this execution correct? Explain your answer and try this for X = 10, Y = 20, N = 5 and M = 8. T1 Read(X) X := X - N Write(X) Read(Y) Y := Y + N Write(Y) Commit T2 Read(X) X := X + M Write(X) Commit 12/3/2019

The result produced by the interleaved transaction is not correct. Answer: The result produced by the interleaved transaction is not correct. It suffers the so-called lost-update problem. After this interleaved execution, X becomes 5 and Y becomes 25. The result of the serial execution is X = 13 and Y = 25. 12/3/2019

(ii) If the two transactions are executed interleavingly as follows and the initial values for X and Y are 20 and 30, respectively, what are the values of X and Y after the execution. Explain why the results are not correct. (5) T1 read_lock(Y) read_item(Y) unlock Write_lock(X) Read_item(X) X :=X+Y Write_item(X) Unlock(X) T2 read_lock(X) read_item(X) unlock(X) write_lock(Y) read_item(Y) Y:=X+Y write_item(Y) unlock(Y) 12/3/2019

The result produced by the interleaved transaction is not correct. Answer: The result produced by the interleaved transaction is not correct. It is because both the transaction use the data before the transactions’ execution. The changes made by the transactions are not accumulated. The result is not to the serial execution. After this interleaved execution, both X and Y are equal to 50. Serial executions T1 before T2: X = 50, Y = 80 T2 before T1: X = 70, Y = 50 12/3/2019