1 Problem Session 5 Midterm Review Yusheng Yang Stanford University 10/29/2007 CS145 Autumn 2007.

Slides:



Advertisements
Similar presentations
Transactions - Concurrent access & System failures - Properties of Transactions - Isolation Levels 4/13/2015Databases21.
Advertisements

1 Lecture 10: Transactions. 2 The Setting uDatabase systems are normally being accessed by many users or processes at the same time. wBoth queries and.
1 Problem Session 1 Products and Joins. 2 Outline uAnnouncements uSynopsis of Last Week uProducts and Joins – formal expressions, examples uProducts and.
Notes on Chapter 8 Transactions from Chapter 6 Views and Indexes from Chapter 8.
Winter 2002Arthur Keller – CS 1806–1 Schedule Today: Jan. 22 (T) u SQL Queries. u Read Sections Assignment 2 due. Jan. 24 (TH) u Subqueries, Grouping.
1 Database Systems Relations as Bags Grouping and Aggregation Database Modification.
Transactions and Locking Rose-Hulman Institute of Technology Curt Clifton.
Winter 2002Arthur Keller – CS 1809–1 Schedule Today: Jan. 31 (TH) u Constraints. u Read Sections , Project Part 3 due. Feb. 5 (T) u Triggers,
1 Transactions Serializability Isolation Levels Atomicity.
Winter 2002Arthur Keller – CS 18013–1 Schedule Today: Feb. 21 (TH) u Transactions, Authorization. u Read Sections Project Part 5 due. Feb. 26.
Exam Duration: 10 minutes reading, 2 hours writing Total marks: 50 marks Authorised materials: CALCULATOR Reference documents will be given as part of.
CPSC-608 Database Systems Fall 2011 Instructor: Jianer Chen Office: HRBB 315C Phone: Notes #3.
Fall 2001Arthur Keller – CS 18012–1 Schedule Nov. 6 (T) Transactions, Authorization. u Read Sections Nov. 8 (TH) Object-Oriented Database Design.
Dec 15, 2003Murali Mani Transactions and Security B term 2004: lecture 17.
Cs3431 Transactions, Logging and Security. cs3431 Transactions: What and Why? A set of operations on a database must appear as one “unit”. Example: Consider.
1 Problem Session 4 Project 1 Help Yusheng Yang Stanford University 10/22/2007 CS145 Autumn 2007.
Fall 2001Arthur Keller – CS 1809–1 Schedule Today Oct. 23 (T) Constraints. u Read Sections Assignment 4 due. Project Part 3 due Oct. 24 (W). Oct.
CPSC-608 Database Systems Fall 2008 Instructor: Jianer Chen Office: HRBB 309B Phone: Notes #3.
Winter 2002Arthur Keller – CS 1807–1 Schedule Today: Jan. 24 (TH) u Subqueries, Grouping and Aggregation. u Read Sections Project Part 2 due.
Constraints on Relations Foreign Keys Local and Global Constraints Triggers Following lecture slides are modified from Jeff Ullman’s slides
Onsdag The concepts in a relation data model SQL DDL DML.
SCUJoAnne Holliday11–1 Schedule Today: u Transaction concepts. u Read Sections Next u Authorization and security.
Winter 2006Keller, Ullman, Cushing13–1 TRANSACTION MANAGEMENT Airline Reservationsmany updates Statistical Abstract of the USmany queries Atomicity – all.
Extended Operators in SQL and Relational Algebra Zaki Malik September 11, 2008.
COMP3030 Database Management System Final Review
Himanshu GuptaCSE 532-SQL-1 SQL. Himanshu GuptaCSE 532-SQL-2 Why SQL? SQL is a very-high-level language, in which the programmer is able to avoid specifying.
SCUHolliday - coen 1787–1 Schedule Today: u Subqueries, Grouping and Aggregation. u Read Sections Next u Modifications, Schemas, Views. u Read.
Transactions, Views, Indexes Introduction to Transactions: Controlling Concurrent Behavior Virtual and Materialized Views Indexes: Speeding Accesses to.
1 SQL Authorization (Chap. 8.7) Privileges Grant and Revoke Grant Diagrams.
1 Transactions Serializability Isolation Levels Atomicity.
More SQL (and Relational Algebra). More SQL Extended Relational Algebra Outerjoins, Grouping/Aggregation Insert/Delete/Update.
1 Transactions, Views, Indexes Controlling Concurrent Behavior Virtual and Materialized Views Speeding Accesses to Data This slides are from J. Ullman’s.
1 Transaction Processing Case Study. 2 Interaksi Proses There is table Sells(shop,beverage,price), and suppose that Joe’s Shop sells only Juice for $2.50.
Basic Web Application Development Instructor: Matthew Schurr.
CMPT 354 Database Management Systems Oliver Schulte
TRANSACTION PROCESSING 1. 2 Why Transactions? uDatabase systems are normally being accessed by many users or processes at the same time. wBoth queries.
1 Introduction to Database Systems, CS420 SQL JOIN, Aggregate, Grouping, HAVING and DML Clauses.
Transactions Introduction.
CS 440 Database Management Systems
Schedule Today: Jan. 28 (Mon) Jan. 30 (Wed) Next Week Assignments !!
Slides are reused by the approval of Jeffrey Ullman’s
Outerjoins, Grouping/Aggregation Insert/Delete/Update
CPSC-310 Database Systems
Schedule Today: Next After that Subqueries, Grouping and Aggregation.
Database Design: DBS CB, 2nd Edition
Introduction to Database Systems, CS420
Schedule Today Transactions, Authorization. Sections
CPSC-608 Database Systems
Transaction Processing
CPSC-310 Database Systems
Transactions Isolation Levels.
CPSC-310 Database Systems
Transactions Introduction.
2018, Fall Pusan National University Ki-Joune Li
Transactions Properties.
Introduction to Database Systems CSE 444 Lecture 23: Final Review
Transactions Isolation Levels.
Lecture 24: Final Review Friday, March 10, 2006.
CPSC-608 Database Systems
CPSC-608 Database Systems
More SQL Extended Relational Algebra Outerjoins, Grouping/Aggregation
CPSC-608 Database Systems
CMSC-461 Database Management Systems
Introduction to Database Systems CSE 444 Lecture 23: Final Review
Transactions, Views, Indexes
Final Review Friday, December 8, 2006.
Instructor: Zhe He Department of Computer Science
-Transactions in SQL -Constraints and Triggers
Advanced Topics: Indexes & Transactions
Select-From-Where Statements Multirelation Queries Subqueries
Presentation transcript:

1 Problem Session 5 Midterm Review Yusheng Yang Stanford University 10/29/2007 CS145 Autumn 2007

2 Outline uAnnouncements uSQL uTransactions uDTDs uQ&A CS145 Autumn 2007

3 Announcements uProject 1 due Wed 10/31 uGradiance – one due Fri 11/2, two due Wed 11/7 uMidterm Wed 10/31 11am-12:15pm Gates B01 wUp to and including 10/24 lecture on XPath wOpen notes/book/laptop. Closed Internet. CS145 Autumn 2007

4 SQL CS145 Autumn 2007 SQL Transactions DTDs SQL

5 From 2005 Midterm CS145 Autumn 2007 Consider a table Exams(student, score). Write a SQL query to find the student with the highest score differential, i.e. the student with the largest spread between his or her highest and lowest scores, among all students with scores in the table. Assume there is a unique student with the highest spread and return that student only once. SQL

6 Sample Solution CS145 Autumn 2007 SELECT student FROM Exams GROUP BY student HAVING MAX(score) - MIN(score) >= ALL( SELECT MAX(score) - MIN(score) FROM Exams WHERE score IS NOT NULL GROUP BY student ) SQL

7 Transactions CS145 Autumn 2007 Transactions SQL Transactions DTDs

8 From Lecture CS145 Autumn 2007 Joe_Sells(beer, price). Initially: (Bud, 2.50) and (Miller, 3). Sally: BEGIN TRANSACTION S1: SELECT MAX(price) FROM Joe_Sells S2: SELECT MIN(price) FROM Joe_Sells COMMIT Joe: BEGIN TRANSACTION S3: DELETE FROM Joe_Sells S4: INSERT INTO Joe_Sells VALUES(’Heineken’, 3.50); COMMIT Suppose S1,S3,S4,Joe commits,S2,Sally commits. Transactions

9 Solution CS145 Autumn 2007 a)Sally: SERIALIZABLE: MAX = $3.00, MIN = $2.50. b)Sally: REPEATABLE READ: MAX = $3.00, MIN = $2.50. Sally saw a phantom tuple: (‘Heineken’, $3.50). c)Sally: READ COMMITTED: MAX = $3.00, MIN = $3.50. Sally saw Joe’s committed deletion. d)Sally: READ UNCOMMITTED: MAX = $3.00, MIN = $3.50. Sally saw Joe’s uncommitted deletion. Question: What isolation level do you think Oracle supports as a default? Answer: REPEATABLE READ. Guarantees no loss of data. Transactions

10 DTDs CS145 Autumn 2007 DTDs SQL Transactions DTDs

11 From 2006 Midterm CS145 Autumn 2007 DTD1: <!DOCTYPE SP [ ]> 1)For each project, there is a) exactly one student; b) at least one student 2)For each student, there is a) exactly one project; b) at least one project Answer: 1b, 2a DTDs

12 From 2006 Midterm CS145 Autumn 2007 DTD2: <!DOCTYPE SP [ ]> 1)For each project, there is a) exactly one student; b) at least one student 2)For each student, there is a) exactly one project; b) at least one project Answer: 1a, 2a DTDs

13 From 2006 Midterm CS145 Autumn 2007 DTD3: <!DOCTYPE SP [ ]> 1)For each project, there is a) exactly one student; b) at least one student 2)For each student, there is a) exactly one project; b) at least zero projects Answer: 1a, 2b DTDs

14 From 2006 Midterm CS145 Autumn 2007 DTD4: <!DOCTYPE SP [ ]> 1)For each project, there is a) exactly one student; b) at least zero students 2)For each student, there is a) exactly one project; b) at least one project Answer: 1b, 2b DTDs

15 Midterm Topics CS145 Autumn 2007 * Relational Algebra: union/intersect/difference/select/project/product/join/rename * SQL: select/from/where * SQL: multirelational queries * SQL: subqueries * SQL: outerjoins * SQL: group by/having * SQL: insert/delete/update * SQL: constraints * SQL: triggers * SQL: transactions * SQL: views * SQL: indexes * XML: DTDs * XML: XML Schema * XML: XPath

16 Q & A CS145 Autumn 2007 Questions? 1.lecture notes 2.Coursework Discussion 3.Office Hours (Mon 1-2 Gates 433, Tue 1-4, 8-11pm Gates B24A)