sample-test2-520-and-answer

sample-test2-520-and-answer - Name: TEST 2 CSCE 520 Fall...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Name: TEST 2 CSCE 520– Fall 2004 Name: Major SSN (last 4 digits): Answer the following questions. Be brief and precise, please. You have 1 hour 15 minutes to finish the exam. Undergraduate students : answer only question for a total of 85! (That is, you can drop any questions for a total of 15 points.) 1. 15 points (5) What are referential integrity constraints? Assert that a values appearing in one context also appears in another, related context. For example, by design of the database, we expect that the value of an attribute A1 of a relation R1 also appear as the value of the attribute A2 in R2. Relationship between R1 and R2 “makes sense.” (5) Describe an example of referential integrity. Given two relations: Owner(name, SSN, phone) and Dog(name, breed, owner), the “owner” attribute of a dog is expected to be the same value as the “name” attribute of the Owner relation. That is, the attribute “owner” refers to the name of the owner of the dog. (5) Give a simple SQL “CREATE TABLE” statement with referential integrity. CREATE TABLE Owner ( name CHAR (20) PRIMARY KEY, SSN INT, phone CHAR (20)); CREATE TABLE Dog ( name CHAR(20) PRIMARY KEY , breed CHAR(10), owner CHAR(20) REFERECES Owner(name) ); 2. Mma Consider the following two transactions: T1: r1[B] (if B <=100 then B:=B+100) w1[B] T2: r2[B] (if B <=100 then B:=B+100) w2[B] The consistency requirement is that (B<=200). Let B = 50 be the initial value. Show that every serial execution involving T1 and T2 preserves consistency of the database. Either T1 followed by T2 or T2 followed by T1 are the ONLY serial executions. With B=50 initial value, after either transaction executes, the B value becomes 150, thus the other transaction cannot be executed. The B <= 200 is always preserved. Show a concurrent execution of T1 and T2 that produces a nonserializable schedule. r1[B] r2[B] w1[B] w2[B] Value for B 50 50 150 150 T1 T2 precedence (serializability) graph 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Name: Is the final result of your nonserializable schedule satisfies the consistency requirement ? Is it correct? Why or why not? Although the final value is 150 (the constraint is not violated), both transactions executed
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/13/2011 for the course CSCE 520 taught by Professor Farkas during the Spring '11 term at South Carolina.

Page1 / 6

sample-test2-520-and-answer - Name: TEST 2 CSCE 520 Fall...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online