1 Database Systems ( 資料庫系統 ) 9/16/2009 Lecture #1.

Slides:



Advertisements
Similar presentations
1 Introduction to Database Systems CSE444 Instructor: Scott Vandenberg University of Washington Winter 2000.
Advertisements

Database Management Systems 1 Ramakrishnan & Gehrke Introduction to Database Systems Chapter 1 Instructor: Mirsad Hadzikadic.
Chapter 1 Instructor: Murali Mani Database Management Systems.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Introduction to Database Systems Chapter 1 Instructor: Wang-Chien Lee
Database: A collection of related data [Elmasri]. A database represents some aspect of real world called “miniworld” [Elmasri] or “enterprise” [Ramakrishnan].
Mani-CS34311 CS3431 – Database Systems I Introduction Instructor: Murali Mani
Introduction to Database Systems Ch. 1, Ch. 2 Mr. John Ortiz Dept. of Computer Science University of Texas at San Antonio.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 1 Instructor: Deborah Strahman
H.Lu/HKUST L1: Course Overview & Review. L01: RDBMS REVIEW -- 2 H.Lu/HKUST The Teaching Staff  Instructor: Lu Hongjun  Office: 3543 (Lift 25-26), HKUST.
Murali Mani CS3431 – Database Systems I Introduction.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 1 Database Systems I Introduction.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 1.
On Database Systems.
1 Introduction to Database Systems Ref. Ramakrishnan & Gehrke Chapter 1.
1 CENG 302 Introduction to Database Management Systems Nihan Kesim Çiçekli URL:
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 1 Instructor: Ethan Jackson
CSCD34 - Data Management Systems,- A. Vaisman1 CSC D34 - Data Management Systems Instructor: Alejandro Vaisman University of Toronto.
CSC343H – Introduction to Databases
CS462: Introduction to Database Systems. ©Silberschatz, Korth and Sudarshan1.2Database System Concepts Course Information Instructor  Kyoung-Don (KD)
CSC2012 Database Technology & CSC2513 Database Systems.
Introduction. 
Database Management Systems 1 Introduction to Database Systems Instructor: Xintao Wu Ramakrishnan & Gehrke.
The Relational Model. Review Why use a DBMS? OS provides RAM and disk.
CS6530 Graduate-level Database Systems Prof. Feifei Li.
Database Management Systems 1 Ramakrishnan & Gehrke Introduction to Database Systems Chpt 1 Instructor: Xintao Wu.
1 Introduction to Operating Systems 9/16/2008 Lecture #1.
Introduction Example databases Overview of concepts Why use database systems.
Database Management Systems 1 Ramakrishnan & Gehrke Introduction to Database Systems Chpt 1 Instructor: Weichao Wang.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 1 Overview of Database Systems.
Database Organization and Design
Introduction to Database Management Systems. Information Instructor: Csilla Farkas Office: Swearingen 3A43 Office Hours: Monday, Wednesday 4:15 pm – 5:30.
INFS614, Dr. Brodsky, GMU1 Database Management Systems INFS 614 Instructor: Professor Alex Brodsky
Introduction to Database Systems1. 2 Basic Definitions Mini-world Some part of the real world about which data is stored in a database. Data Known facts.
Introduction to Database Management Systems. Information Instructor: Csilla Farkas Office: Swearingen 3A43 Office Hours: Monday, Wednesday 2:30 pm – 3:30.
1 Database Systems ( 資料庫系統 ) 9/15/2010 Lecture #1.
1 CS3431 – Database Systems I Introduction Instructor: Mohamed Eltabakh
INTRODUCTION TO DBS Database: a collection of data describing the activities of one or more related organizations DBMS: software designed to assist in.
1 What Is a DBMS?  A very large, integrated collection of data.  Models real-world enterprise.  Entities (e.g., students, courses)  Relationships (e.g.,
1 Database Systems ( 資料庫系統 ) Practicum in Database Systems ( 資料庫系統實驗 ) September 19, 2005 Lecture #1.
Database Systems Lecture 1. In this Lecture Course Information Databases and Database Systems Some History The Relational Model.
1 Database Systems ( 資料庫系統 ) Practicum in Database Systems ( 資料庫系統實驗 ) 9/20 & 9/21, 2006 Lecture #1.
-ebru a.s ATTRIBUTE: Description of entities For employee entity number, name, deptno, age, adr, salary..etc are attributes. RECORD: Stores whole.
Introduction to Database Management System 電機三 趙上鋒.
1 CS462- Database Systems Sang H. Son
Database Management Systems.  Instructor: Yrd. Doç. Dr. Cengiz Örencik   Course material.
CS3431: C-Term CS3431 – Database Systems I Introduction Instructor: Mohamed Eltabakh
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 1.
BBM 371 – Data Management Lecture 3: Basic Concepts of DBMS Prepared by: Ebru Akçapınar Sezer, Gönenç Ercan.
1 CENG 351 CENG 351 Introduction to Data Management and File Structures Department of Computer Engineering METU.
Database Management Systems 1 Ramakrishnan & Gehrke Introduction to Database Systems Chpt 1 Instructor: Xin Zhang.
CS522 Advanced database Systems Huiping Guo Department of Computer Science California State University, Los Angeles Course administration.
Introduction to Database Systems Chapter 1
CS4222 Principles of Database System
Introduction to Database Systems CSE 444
Chapter 1: Introduction
Introduction to Database Systems
Instructor: Elke Rundensteiner
Database Management Systems Chapter 1
Introduction to Database Systems
Overview of Database Systems Chpt 1
Instructor: Murali Mani
Database Management Systems Chapter 1
Database Management Systems
Database Management Systems CSE594
Introduction to Database Systems CSE 444
Database Systems (資料庫系統)
Sang H. Son CS6750: Database Systems The slides for this text are organized into chapters. This lecture covers Chapter 1. Chapter 1: Introduction.
Introduction to Database Systems
Database Management Systems Chapter 1
Introduction to Database Systems CSE 444
Presentation transcript:

1 Database Systems ( 資料庫系統 ) 9/16/2009 Lecture #1

2 Course Goals First course in database systems. Learning objective –Use a relational database –Build a relational database

3 Topics Fundamentals –ER (Entity-Relationship) Model –SQL (Structured Query Language) Storage and indexing –Disks & Files –Tree-structure indexing –Hash-based indexing Query evaluation –External sorting –Evaluating relational operators Transaction management: –Concurrency control –Crash recovery Other Topics

4 Prerequisite Data structure and algorithms English skill –Taught in English & Chinese –If I speak English too fast, please tell me to slow down. –You can ask questions in English or Chinese.

5 Textbook Required textbook: “ Database Management Systems, Third Edition ”, by Ramakrishnan and Gehrke. The textbook is available from 新月 and (and perhaps other) bookstores.

6 General Comments on Textbook Widely used among U.S. Universities 3~4 years ago. Bad –Ambiguous writing, inconsistent wording –“ More like an experience report from researchers rather than introductory textbooks for beginners ” Ask me & TAs for clarifications

7 Course Format 7 Assignments –Written (1), SQL(1), and Programming assignments (5) Midterm Exam –Fixed date: Nov 11, 2009 (Wed) in class –Offer once only! Final Exam –Fixed date: Jan 13, 2010 (Wed) during class time –Offer once only!

8 Grading Breakdown (Tentative) Tentative means that it may be changed later. –7 Assignments (30% of Grade) –Midterm Exam (35% of Grade) –Final Exam (35% of Grade)

9 Teaching Staff Winston Hsu ( 徐宏民 ) –Office hour: Room 512 – winston (at) csie.ntu.edu.tw Instructor: 朱浩華 “ Hao ” –Room 518 or by appointment – hchu (at) csie.ntu.edu.tw TAs –Kerry Chang, Room 219, b94007 (at) csie ntu edu tw –Ming-Kuang Tsai ( 蔡旻光 ), mingkuang.tsai (at) gmail com –Fang-Err Lin ( 林芳而 ), espblue (at) gmail com

10 Means of Communications Course homepage – BBS –ptt.cc, under “ CSIE_DBMS ” board –Post your questions on BBS. –Read posted messages before posting new questions. –No SPAM. –TAs respond to your questions as quickly as possible. Send to TAs or me. Come to office hours

11 Lecture Notes Available on the course homepage before each lecture –Complements, not replacement of attending lecture and reading textbook.

12 Any Question(s) on Administrative Things?

13 Introduce an interesting project in Ubiquitous Computing (Won ’ t be Tested) How many students were in my OS course (last year)?

14 Topobo (MIT media lab) Redefine programming –Create a program without “writing a program”.

15 Chapter 1: Overview of Database Systems

16 Outline Why do we need a DBMS (Database Management System)? What can a DBMS do for an application? Why study database systems? Data Models: Overview of a Relational Model Levels of Abstraction in a DBMS Sample Queries in DBMS Transaction Management Overview Structure of a DBMS

17 Why DBMS? Suppose that you want to build an university database. It must store the following information: –Entities: Students, Professors, Classes, Classrooms –Relationships: Who teaches what? Who teaches where? Who teaches whom?

18 What can DBMS do for applications? Store huge amount of data (e.g., TB+) over a long period of time Allow apps to query and update data –Query: what is Mary ’ s grade in the “ Operating System ” course? –Update: enroll Mary in the “ Database ” course Protect from unauthorized access. –Students cannot change their course grades. Protect from system crashes –When some system components fail (hard drive, network, etc.), database can be restored to a good state.

19 More on what can DBMS do for applications? Protect from incorrect inputs –Mary has registered for 100 courses Support concurrent access from multiple users –1000 students using the registration system at the same time Allow administrators to easily change data schema –At a later time, add TA info to courses. Efficient database operations –Search for students with 5 highest GPAs

20 Alternative to Using a DBMS Store data as files in operating systems. Applications have to deal with the following issues: –32-bit addressing (5GB) is insufficient to address 100GB+ data file –Write special code to support different queries –Write special code to protect data from concurrent access –Write special code to protect against system crashes –Optimize applications for efficient access and query –May often rewrite applications Easier to buy a DBMS to handle these issues

21 Database Management System (DBMS) DBMS is software to store and manage data, so applications don ’ t have to worry about them. What can a DBMS do for applications? –Can you think of them?

22 What can a DBMS do for applications? Define data: Data Definition Language (DDL) Access and operate on data: Data Manipulation Language (DML) –Query language Storage management Transaction Management –Concurrency control –Crash recovery Provide good security, efficiency, and scalability Abstraction & Interface (Database language: SQL) Applications System (DBMS) Perform dirty work that you don’t want applications to do

23 Why Study Database Systems? They are everywhere. –Online stores, real stores –Banks, credit card companies –Passport control –Police (criminal records) –Airlines and hotels (reservations) DBMS vendors & products –Oracle, Microsoft (Access and SQL server), IBM (DB2), Sybase, …

24 Data Models A data model is a collection of concepts for describing data. –Entity-relation (ER) model –Relational model (main focus of this course) A schema is a description of data. The relational model is the most widely used data model. – A relation is basically a table with rows and columns of records. – Every relation has a schema, which describes the columns, or fields.

25 Relational Model sidname agegpa The entire table shows an instance of the Students relation. The Students schema is the column heads –Students(Sid: String, Name: String, Login: String, age: Integer, … )

26 Levels of Abstractions in DBMS Many views, one conceptual schema and one physical schema. – Conceptual schema defines logical structure Relation tables – Physical schema describes the file and indexing used Sorted file with B+ tree index – Views describe how applications (users) see the data Relation tables but not store explicitly Physical Schema Conceptual Schema View 1View 2View 3 App1App2

27 Example: University Database Conceptual schema: – Students (sid: string, name: string, login: string, age: integer, gpa:real) – Courses (cid: string, cname:string, credits:integer) – Enrolled (sid:string, cid:string, grade:string) Physical schema: – Relations stored as unordered files. – Index on first column of Students. View (External Schema): – Course_info(cid:string, enrollment:integer) – Why?

28 Data Independence Three levels of abstraction provides data independence. –Changes in one layer only affect one upper layer. –E.g., applications are not affected by changes in conceptual & physical schema. Physical Schema Conceptual Schema View 1View 2View 3 App1App2

29 Queries in DBMS Sample queries on university database: –What is the name of the student with student ID ? The key benefits of using a relational database are –Easy to specify queries using a query language: Structured Query Language (SQL) SELECT S.name FROM Students S WHERE S.sid = –Efficient query processor to get answer

30 Transaction Management A transaction is an execution of a user program in a DBMS. Transaction management deals with two things: –Concurrent execution of transactions –Incomplete transactions and system crashes

31 Concurrency Control Example: two travel agents (A, B) are trying to book one remaining airline seat (two transactions), only one transaction can succeed in booking. // num_seats is 1 Transactions A and B: if num_seats > 0, book the seat & num_seat--; // overbook! How to solve this?

32 Concurrency Control (Solution) // num_seats is 1 Transactions A and B: if num_seats > 0, book the seat & num_seat--; // overbook! Solution: use locking protocol Transaction A: get exclusive lock on num_seats Transaction B: wait until A releases lock on num_seats Transaction A: if num_seats > 0, book & num_seat--; // book the seat, num_seat is set to 0 Transaction A: release exclusive lock on num_seats Transaction B: num_seats = 0, no booking; // does not book the seat

33 Crash Recovery Example: a bank transaction transfers $100 from account A to account B A = A - $100 // good for the bank! B = B + $100 How to solve this?

34 Crash Recovery (Solution) A = A - $100 // good for the bank! B = B + $100 Solution: use logging, meaning that all write operations are recorded in a log on a stable storage. A = A - $100 // recorded A value (checkpoint) in a log // start recovery: read the log from disk //analyze, undo, & redo

35 Layered Architecture Query Optimization and Execution Relational Operators Files and Access Methods Buffer Management Disk Space Management These layers must consider concurrency control and crash recovery Applications Queries

36 Administration Hao will be away at a conference on 9/30 –Please attend Winston’s lecture at CSIE 101 Reading assignments –Read Chapters 1 –Read Chapter 2 (except 2.7) for next lecture