CPSC-310 Database Systems

Slides:



Advertisements
Similar presentations
IiWAS2002, Bandung, Indonesia Teaching and Learning Databases Dr. Stéphane Bressan National University of Singapore.
Advertisements

CPSC 310/6031 CPSC 310 Database Systems CPSC 603 Database Systems and Applications Prof. Jennifer Welch.
CPSC-608 Database Systems Fall 2009 Instructor: Jianer Chen Office: HRBB 309B Phone: Notes #2.
CPSC-608 Database Systems Fall 2011 Instructor: Jianer Chen Office: HRBB 315C Phone: Notes #6.
CPSC-608 Database Systems Fall 2011 Instructor: Jianer Chen Office: HRBB 315C Phone: Notes #13.
ECE 569 Database System EngineeringFall 2004 ECE 569 Database System Engineering Fall 2004 Yanyong Zhang:
CPSC-608 Database Systems Fall 2010 Instructor: Jianer Chen Office: HRBB 315C Phone: Notes 1.
CPSC-608 Database Systems Fall 2010 Instructor: Jianer Chen Office: HRBB 315C Phone: Notes #6.
CPSC-608 Database Systems Fall 2011 Instructor: Jianer Chen Office: HRBB 315C Phone: Notes 1.
1 Course: Database Management Systems Credits: 3 Prepared by: Assoc. Prof. Dr. Duong Tuan Anh Faculty of Computer Science & Engineering HoChiMinh City.
Dr. Kalpakis CMSC 461, Database Management Systems Introduction.
Database Management Systems (DBMS)
Database Systems Chapter 1 The Worlds of Database Systems.
DATABASE MANAGEMENT SYSTEM ARCHITECTURE
Introduction to DBMS Purpose of Database Systems View of Data
Database System Concepts and Architecture Lecture # 3 22 June 2012 National University of Computer and Emerging Sciences.
© D. Wong 2002 © D. Wong CS610 / CS710 Database Systems I Daisy Wong.
Overview of a Database Management System
Introduction. 
The Worlds of Database Systems Chapter 1. Database Management Systems (DBMS) DBMS: Powerful tool for creating and managing large amounts of data efficiently.
CST203-2 Database Management Systems Lecture 2. One Tier Architecture Eg: In this scenario, a workgroup database is stored in a shared location on a single.
Introduction to Database Management Systems. Information Instructor: Csilla Farkas Office: Swearingen 3A43 Office Hours: Monday, Wednesday 4:15 pm – 5:30.
Chapter 1 : Introduction §Purpose of Database Systems §View of Data §Data Models §Data Definition Language §Data Manipulation Language §Transaction Management.
INFS614, Dr. Brodsky, GMU1 Database Management Systems INFS 614 Instructor: Professor Alex Brodsky
©Silberschatz, Korth and Sudarshan1.1Database System Concepts COMP319: Introduction Course Structure Course Assessment Review: DBMS Structure Review: Terminology.
©Silberschatz, Korth and Sudarshan1.1Database System Concepts Chapter 1: Introduction Purpose of Database Systems View of Data Data Models Data Definition.
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.
INTRODUCTION TO DBS Database: a collection of data describing the activities of one or more related organizations DBMS: software designed to assist in.
DATABASE MANAGEMENT SYSTEM ARCHITECTURE
Introduction.  Administration  Simple DBMS  CMPT 454 Topics John Edgar2.
ICS 321 Spring 2011 Introduction to Database Systems Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 1/12/20111Lipyeow.
1 CS462- Database Systems Sang H. Son
Database System Concepts Introduction Purpose of Database Systems View of Data Data Models Data Definition Language Data Manipulation Language Transaction.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 1.
CHAPTER 1: INTRODUCTION Purpose of Database Systems View of Data Data Models Data Definition Language Data Manipulation Language Storage Management Database.
Fundamental of Database Systems
Scholastic Dishonesty
CPSC 603 Database Systems Lecturer: Laurie Webster II, Ph.D., P.E.
CS 325 Spring ‘09 Chapter 1 Goals:
Introduction to DBMS Purpose of Database Systems View of Data
CS422 Principles of Database Systems Course Overview
Chapter 1: Introduction
Database Management System
CPSC-608 Database Systems
Introduction What is a Database?.
CPSC-310 Database Systems
CPSC-310 Database Systems
Introduction to Database Management System
Introduction to Database Systems
Chapter 2 Database Environment Pearson Education © 2009.
Chapter 2 Database Environment.
Data Base System Lecture : Database Environment
1.1 The Evolution of Database Systems
CPSC-310 Database Systems
Database System Architecture
Introduction to DBMS Purpose of Database Systems View of Data
Database management concepts
Scholastic Dishonesty
CPSC-608 Database Systems
CPSC-608 Database Systems
CPSC-608 Database Systems
CPSC-608 Database Systems
CPSC-608 Database Systems
CPSC-608 Database Systems
CPSC-608 Database Systems
CPSC-608 Database Systems
Chapter 2 Database Environment Pearson Education © 2009.
Chapter 2 Database Environment Pearson Education © 2009.
Presentation transcript:

CPSC-310 Database Systems Professor Jianer Chen Room 315C HRBB Lecture #1

Two parts about database

Two parts about database purpose Learn how to develop DB (database design) Understand how DB works (database principle)

Two parts about database purpose After the study Learn how to develop DB (database design) Be able to develop DB Understand how DB works (database principle)

Two parts about database purpose After the study Learn how to develop DB (database design) Be able to develop DB Understand how DB works (database principle) Know better about DB

Two parts about database purpose After the study Learn how to develop DB (database design) Be able to develop DB necessary Understand how DB works (database principle) Know better about DB

Two parts about database purpose After the study Learn how to develop DB (database design) Be able to develop DB Help develop better DB necessary Understand how DB works (database principle) Know better about DB

Two parts about database purpose After the study Learn how to develop DB (database design) Be able to develop DB Help develop better DB necessary This course covers Understand how DB works (database principle) Know better about DB

Computer for Information Processing

Computer for Information Processing General information processing: data are in computer (memory) and users run CPU to process the data.

Computer for Information Processing General information processing: data are in computer (memory) and users run CPU to process the data. CPU Data in memory

Computer for Information Processing General information processing: data are in computer (memory) and users run CPU to process the data. Information processing is involved in four components: CPU Data in memory

Computer for Information Processing General information processing: data are in computer (memory) and users run CPU to process the data. Information processing is involved in four components: data structure, Data structure

Computer for Information Processing General information processing: data are in computer (memory) and users run CPU to process the data. Information processing is involved in four components: data structure, basic operations Data structure +, –, ×, ⁄

Computer for Information Processing Algorithm (ideas) General information processing: data are in computer (memory) and users run CPU to process the data. Information processing is involved in four components: data structure, basic operations, algorithm Data structure +, –, ×, ⁄

Computer for Information Processing Algorithm (ideas) General information processing: data are in computer (memory) and users run CPU to process the data. Information processing is involved in four components: data structure, basic operations, algorithm, and programming language main(); { …… } Data structure +, –, ×, ⁄

Computer for Information Processing Algorithm (ideas) General information processing: data are in computer (memory) and users run CPU to process the data. Information processing is involved in four components: data structure, basic operations, algorithm, and programming language. Example: programming with Java, C++ etc. main(); { …… } Data structure +, –, ×, ⁄

Database is just another model of information processing

Database is just another model of information processing Then why study DB?

Database is just another model of information processing Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored?

Database is just another model of information processing Data in memory CPU Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored?

Database is just another model of information processing Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored?

Database is just another model of information processing (in disks) Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored?

Database is just another model of information processing (in disks) Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored? Operations are simpler & more specific: How do we take advantage of it? π, σ, ρ, set ops, joins

Database is just another model of information processing (in disks) Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored? Operations are simpler & more specific: How do we take advantage of it? New programming languages for the above. π, σ, ρ, set ops, joins SQL

Database is just another model of information processing (in disks) Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored? Operations are simpler & more specific: How do we take advantage of it? New programming languages for the above. (ACID) Reliability, security, consistency, currency π, σ, ρ, set ops, joins SQL

Database is just another model of information processing (in disks) Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored? Operations are simpler & more specific: How do we take advantage of it? New programming languages for the above. (ACID) Reliability, security, consistency, currency π, σ, ρ, set ops, joins SQL

How Should Data be Stored? Large volume: cannot fit in memory, thus in general stored in disks;

How Should Data be Stored? Large volume: cannot fit in memory, thus in general stored in disks; Regular files are not organized enough;

How Should Data be Stored? Large volume: cannot fit in memory, thus in general stored in disks; Regular files are not organized enough; Hierarchical structure and network structure were considered, but became less popular;

How Should Data be Stored? Large volume: cannot fit in memory, thus in general stored in disks; Regular files are not organized enough; Hierarchical structure and network structure were considered, but became less popular; Table structures (2-dimensional arrays) are currently the most popular model (relational model);

How Should Data be Stored? How can everything be given by tables?

How Should Data be Stored? How can everything be given by tables? Well, information consists of objects/items and relationships among items;

How Should Data be Stored? How can everything be given by tables? Well, information consists of objects/items and relationships among items; An item has certain properties, which can be listed in a row. Thus, a collection of similar items can be given as a table, one row for an item;

How Should Data be Stored? How can everything be given by tables? Well, information consists of objects/items and relationships among items; An item has certain properties, which can be listed in a row. Thus, a collection of similar items can be given as a table, one row for an item; A relationship can be given by listing each item group that satisfies the relationship;

How Should Data be Stored? How can everything be given by tables? Well, information consists of objects/items and relationships among items; An item has certain properties, which can be listed in a row. Thus, a collection of similar items can be given as a table, one row for an item; A relationship can be given by listing each item group that satisfies the relationship; We will study how to represent real world things by tables

Table structures (terminologies) Information is stored in tables (≡ relations); Each column of a table is an attribute, with an attribute name;

Table structures (terminologies) Information is stored in tables (≡ relations); Each column of a table is an attribute, with an attribute name; A database is a collection of relations;

Table structures (terminologies) Information is stored in tables (≡ relations); Each column of a table is an attribute, with an attribute name; A database is a collection of relations; An example table (Account): Account No. Balance Type 12345 20,520 checking 23456 1,000,000 CD 34567 26 savings 45678 7,023

Table structures (terminologies) A relation schema gives the name of the relation and its attributes;

Table structures (terminologies) A relation schema gives the name of the relation and its attributes; A database schema gives the schemas for all relations in the database;

Table structures (terminologies) A relation schema gives the name of the relation and its attributes; A database schema gives the schemas for all relations in the database; Schemas affects how the data is stored;

Table structures (terminologies) A relation schema gives the name of the relation and its attributes; A database schema gives the schemas for all relations in the database; Schemas affects how the data is stored; Database schemas are given and altered using database definition language (DDL);

Table structures (terminologies) A relation schema gives the name of the relation and its attributes; A database schema gives the schemas for all relations in the database; Schemas affects how the data is stored; Database schemas are given and altered using database definition language (DDL); Only database administrator can use DDL.

What is a good DB schema?

What is a good DB schema? What is a good table structure? Fat or thin?

What is a good DB schema? What is a good table structure? Fat or thin? More important: how can tables guarantee information consistency?

What is a good DB schema? What is a good table structure? Fat or thin? More important: how can tables guarantee information consistency? There is a beautiful theory (functional dependency) for constructing a good database schema;

What is a good DB schema? What is a good table structure? Fat or thin? More important: how can tables guarantee information consistency? There is a beautiful theory (functional dependency) for constructing a good database schema; We will study the theory.

Database is just another model of information processing (in disks) Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored? Operations are simpler & more specific: How do we take advantage of it? New programming languages for the above. (ACID) Reliability, security, consistency, currency π, σ, ρ, set ops, joins SQL

Database is just another model of information processing (in disks) Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored? Operations are simpler & more specific: How do we take advantage of it? New programming languages for the above. (ACID) Reliability, security, consistency, currency π, σ, ρ, set ops, joins SQL

What are the operations?

What are the operations? Most DB operations are queries, e.g., “what is the balance of the account 12345?” which is involved in

What are the operations? Most DB operations are queries, e.g., “what is the balance of the account 12345?” which is involved in * identify relations that are related to the queried information;

What are the operations? Most DB operations are queries, e.g., “what is the balance of the account 12345?” which is involved in * identify relations that are related to the queried information; * search/organize the relations and collect the related information;

What are the operations? Most DB operations are queries, e.g., “what is the balance of the account 12345?” which is involved in * identify relations that are related to the queried information; * search/organize the relations and collect the related information; * edit and output the queried information.

What are the operations? Most DB operations are queries, e.g., “what is the balance of the account 12345?” which is involved in * identify relations that are related to the queried information; * search/organize the relations and collect the related information; * edit and output the queried information. Less often: modifications on relations;

What are the operations? Most DB operations are queries, e.g., “what is the balance of the account 12345?” which is involved in * identify relations that are related to the queried information; * search/organize the relations and collect the related information; * edit and output the queried information. Less often: modifications on relations; These operations are given by data manipulation language (DML)

What are the operations? The DML operations on relations can be implemented by the basic operations: * projection π and selection σ * set operations * joins * renaming ρ

What are the operations? The DML operations on relations can be implemented by the basic operations: * projection π and selection σ * set operations * joins * renaming ρ There is a beautiful (mathematical) theory (relational algebra) that sets the foundation for these basic operations;

What are the operations? The DML operations on relations can be implemented by the basic operations: * projection π and selection σ * set operations * joins * renaming ρ There is a beautiful (mathematical) theory (relational algebra) that sets the foundation for these basic operations; We will study this mathematical theory.

Database is just another model of information processing (in disks) Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored? Operations are simpler & more specific: How do we take advantage of it? New programming languages for the above. (ACID) Reliability, security, consistency, currency π, σ, ρ, set ops, joins SQL

Database is just another model of information processing (in disks) Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored? Operations are simpler & more specific: How do we take advantage of it? New programming languages for the above. (ACID) Reliability, security, consistency, currency π, σ, ρ, set ops, joins SQL

Structured Query Language (SQL)

Structured Query Language (SQL) SQL provides both DDL and DML.

Structured Query Language (SQL) SQL provides both DDL and DML. CREAT TABLE Accounts { accountNo INT, balance REAL, type CHAR(10) }

Structured Query Language (SQL) SQL provides both DDL and DML. accountNo balance type Accounts CREAT TABLE Accounts { accountNo INT, balance REAL, type CHAR(10) }

Structured Query Language (SQL) SQL provides both DDL and DML. accountNo balance type 12345 20,520 checking 23456 1,000,000 savings 34567 -26 Accounts CREAT TABLE Accounts { accountNo INT, balance REAL, type CHAR(10) }

Structured Query Language (SQL) SQL provides both DDL and DML. accountNo balance type 12345 20,520 checking 23456 1,000,000 savings 34567 -26 Accounts CREAT TABLE Accounts { accountNo INT, balance REAL, type CHAR(10) } SELECT accountNo FROM Accounts WHERE type = 'savings' AND balance < 0;

Structured Query Language (SQL) SQL provides both DDL and DML. accountNo balance type 12345 20,520 checking 23456 1,000,000 savings 34567 -26 Accounts CREAT TABLE Accounts { accountNo INT, balance REAL, type CHAR(10) } SELECT accountNo FROM Accounts WHERE type = 'savings' AND balance < 0; Output: 34567 

Database is just another model of information processing (in disks) Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored? Operations are simpler & more specific: How do we take advantage of it? New programming languages for the above. (ACID) Reliability, security, consistency, currency π, σ, ρ, set ops, joins SQL

Database is just another model of information processing (in disks) Then why study DB? Much more data, regular data techs would be very inefficient: How should data be stored? Operations are simpler & more specific: How do we take advantage of it? New programming languages for the above. (ACID) Reliability, security, consistency, currency π, σ, ρ, set ops, joins SQL

Two parts about database purpose After the study Learn how to develop DB (database design) Be able to develop DB Help develop better DB necessary This course covers Understand how DB works (database principle) Know better about DB

Querying the Database The query compiler translates query into query plan (sequence of operations to be performed). Query compilation includes query optimization, to choose best sequence of operations Execution engine performs the operations, interacting with…

Storage and Buffer Management Data usually is stored on disk, in units called blocks Storage manager controls movement of data between disk and main memory Buffer manager controls partitioning of main memory into block-sized regions Relies on info about data, schema, statistics, and indexes (special data structures for efficient access)

Transactions Usually database queries are grouped into transactions A transaction must satisfy ACID properties: Atomicity: either all the changes or none of them are made to the database Consistency: transaction must preserve consistency constraints of the database Isolation: the result must be "as if" the transaction ran alone Durability: once transaction has completed, changes must not be lost

Transaction Processing Every change is logged separately on disk by log manager After a system failure, recovery manager uses log on disk to reconstruct a consistent state Scheduler ensures that concurrently executing transactions do not interfere with each other

Outline of Course Representing things by tables E-R model (Ch. 4) Good table structures Functional Dependencies (Ch. 3) Basic operations on relations Relational Algebra (Ch. 2) Storage management (Chs. 13-14) SQL languages in DDL/DML (Ch. 6) Query processing (Chs. 15-16) More on SQL (Chs. 7-9) Transition processing (Chs. 17-19)

Outline of Course Representing things by tables E-R model (Ch. 4) Good table structures Functional Dependencies (Ch. 3) Basic operations on relations Relational Algebra (Ch. 2) Storage management (Chs. 13-14) SQL languages in DDL/DML (Ch. 6) Query processing (Chs. 15-16) More on SQL (Chs. 7-9) Transition processing (Chs. 17-19)

Outline of Course Representing things by tables E-R model (Ch. 4) Good table structures Functional Dependencies (Ch. 3) Basic operations on relations Relational Algebra (Ch. 2) Storage management (Chs. 13-14) SQL languages in DDL/DML (Ch. 6) Query processing (Chs. 15-16) More on SQL (Chs. 7-9) Transition processing (Chs. 17-19)

Outline of Course Representing things by tables E-R model (Ch. 4) Good table structures Functional Dependencies (Ch. 3) Basic operations on relations Relational Algebra (Ch. 2) Storage management (Chs. 13-14) SQL languages in DDL/DML (Ch. 6) Query processing (Chs. 15-16) More on SQL (Chs. 7-9) Transition processing (Chs. 17-19)

Outline of Course Representing things by tables E-R model (Ch. 4) Good table structures Functional Dependencies (Ch. 3) Basic operations on relations Relational Algebra (Ch. 2) Storage management (Chs. 13-14) SQL languages in DDL/DML (Ch. 6) Query processing (Chs. 15-16) More on SQL (Chs. 7-9) Transition processing (Chs. 17-19)

Outline of Course Representing things by tables E-R model (Ch. 4) Good table structures Functional Dependencies (Ch. 3) Basic operations on relations Relational Algebra (Ch. 2) Storage management (Chs. 13-14) SQL languages in DDL/DML (Ch. 6) Query processing (Chs. 15-16) More on SQL (Chs. 7-9) Transition processing (Chs. 17-19)

Outline of Course Representing things by tables E-R model (Ch. 4) Good table structures Functional Dependencies (Ch. 3) Basic operations on relations Relational Algebra (Ch. 2) Storage management (Chs. 13-14) SQL languages in DDL/DML (Ch. 6) Query processing (Chs. 15-16) More on SQL (Chs. 7-9) Transition processing (Chs. 17-19)

Outline of Course Representing things by tables E-R model (Ch. 4) Good table structures Functional Dependencies (Ch. 3) Basic operations on relations Relational Algebra (Ch. 2) Storage management (Chs. 13-14) SQL languages in DDL/DML (Ch. 6) Query processing (Chs. 15-16) More on SQL (Chs. 7-9) Transition processing (Chs. 17-19)

Outline of Course Representing things by tables E-R model (Ch. 4) Good table structures Functional Dependencies (Ch. 3) Basic operations on relations Relational Algebra (Ch. 2) Storage management (Chs. 13-14) SQL languages in DDL/DML (Ch. 6) Query processing (Chs. 15-16) More on SQL (Chs. 7-9) Transition processing (Chs. 17-19)