Introduction to Database Systems

Similar documents
The Relational Model

The Relational Model

CS275 Intro to Databases. File Systems vs. DBMS. Why is a DBMS so important? 4/6/2012. How does a DBMS work? -Chap. 1-2

Lecture 2 08/26/15. CMPSC431W: Database Management Systems. Instructor: Yu- San Lin

DATABASE MANAGEMENT SYSTEMS. UNIT I Introduction to Database Systems

Introduction to Data Management. Lecture #1 (The Course Trailer )

1/19/2012. Finish Chapter 1. Workers behind the Scene. CS 440: Database Management Systems

Big Data Processing Technologies. Chentao Wu Associate Professor Dept. of Computer Science and Engineering

The Relational Data Model. Data Model

Relational data model

The Relational Model. Database Management Systems

Introduction and Overview

Introduction and Overview

Introduction to Data Management. Lecture #4 (E-R Relational Translation)

The Relational Model. Relational Data Model Relational Query Language (DDL + DML) Integrity Constraints (IC)

Introduction to Data Management. Lecture #1 (Course Trailer ) Instructor: Chen Li

BBM371- Data Management. Lecture 1: Course policies, Introduction to DBMS

Introduction to Data Management. Lecture #1 (Course Trailer )

Database Management Systems. Chapter 3 Part 1

Database Management Systems. Chapter 1

Introduction to Data Management. Lecture #1 (Course Trailer )

The Relational Model. Chapter 3

Database Management Systems MIT Introduction By S. Sabraz Nawaz

The Relational Model. Why Study the Relational Model? Relational Database: Definitions

The Relational Model. Chapter 3. Database Management Systems, R. Ramakrishnan and J. Gehrke 1

Database Systems ( 資料庫系統 )

Database Applications (15-415)

Database Systems ( 資料庫系統 ) Practicum in Database Systems ( 資料庫系統實驗 ) 9/20 & 9/21, 2006 Lecture #1

Score. 1 (10) 2 (10) 3 (8) 4 (13) 5 (9) Total (50)

CS564: Database Management Systems. Lecture 1: Course Overview. Acks: Chris Ré 1

Data! CS 133: Databases. Goals for Today. So, what is a database? What is a database anyway? From the textbook:

Database Applications (15-415)

Why Study the Relational Model? The Relational Model. Relational Database: Definitions. The SQL Query Language. Relational Query Languages

The Relational Model of Data (ii)

CS145: Intro to Databases. Lecture 1: Course Overview

Announcements. PS 3 is out (see the usual place on the course web) Be sure to read my notes carefully Also read. Take a break around 10:15am

Page 1. Quiz 18.1: Flow-Control" Goals for Today" Quiz 18.1: Flow-Control" CS162 Operating Systems and Systems Programming Lecture 18 Transactions"

1 (10) 2 (8) 3 (12) 4 (14) 5 (6) Total (50)

DBMS. Relational Model. Module Title?

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

Relational Algebra Homework 0 Due Tonight, 5pm! R & G, Chapter 4 Room Swap for Tuesday Discussion Section Homework 1 will be posted Tomorrow

Overview of Data Management

Introduction to Data Management. Lecture #5 Relational Model (Cont.) & E-Rà Relational Mapping

Data Modeling. Yanlei Diao UMass Amherst. Slides Courtesy of R. Ramakrishnan and J. Gehrke

Page 1. Goals for Today" What is a Database " Key Concept: Structured Data" CS162 Operating Systems and Systems Programming Lecture 13.

Overview of Data Management

Database Systems. Course Administration

Review. The Relational Model. Glossary. Review. Data Models. Why Study the Relational Model? Why use a DBMS? OS provides RAM and disk

CS145: Intro to Databases. Lecture 1: Course Overview

Comp 5311 Database Management Systems. 4b. Structured Query Language 3

CSE 303: Database. Teaching Staff. Lecture 01. Lectures: 1 st half - from a user s perspective. Lectures: 2 nd half - understanding how it works

A Few Tips and Suggestions. Database System II Preliminaries. Applications (contd.) Applications

What is Data? ANSI definition: Volatile vs. persistent data. Data. Our concern is primarily with persistent data

What is Data? Volatile vs. persistent data Our concern is primarily with persistent data

Relational Model. Topics. Relational Model. Why Study the Relational Model? Linda Wu (CMPT )

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

Keys, SQL, and Views CMPSCI 645

CIS 330: Applied Database Systems

Database Systems. Lecture2:E-R model. Juan Huo( 霍娟 )

Chapter 1: Introduction

CS425 Fall 2016 Boris Glavic Chapter 1: Introduction

Introduction to Database Management Systems

CS430/630 Database Management Systems Spring, Betty O Neil University of Massachusetts at Boston

Introduction to Data Management. Lecture #4 E-R Model, Still Going

Relational Databases BORROWED WITH MINOR ADAPTATION FROM PROF. CHRISTOS FALOUTSOS, CMU /615

Administration Naive DBMS CMPT 454 Topics. John Edgar 2

A Few Tips and Suggestions. Database System I Preliminaries. Applications (contd.) Applications

A Few Tips and Suggestions. Database System II Preliminaries. Applications (contd.) Applications

The Relational Model. Week 2

Database Management Systems MIT Lesson 01 - Introduction By S. Sabraz Nawaz

Introduction to Data Management. Lecture #4 (E-R à Relational Design)

MIT Database Management Systems Lesson 01: Introduction

John Edgar 2

Introduction to Data Management. Lecture #2 Intro II & Data Models I

Introduction to Database Systems. Chapter 1. Instructor: . Database Management Systems, R. Ramakrishnan and J. Gehrke 1

Week 1 Part 1: An Introduction to Database Systems

Modern Database Systems CS-E4610

Lecture 1: Introduction

Relational Query Languages

CS425 Midterm Exam Summer C 2012

Introduction to Database Systems CS432. CS432/433: Introduction to Database Systems. CS432/433: Introduction to Database Systems

Database Management Systems. Session 2. Instructor: Vinnie Costa

Introduction. Example Databases

Database Management Systems Chapter 1 Instructor: Oliver Schulte Database Management Systems 3ed, R. Ramakrishnan and J.

Database Technology Introduction. Heiko Paulheim

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION. Ch. 1 :- Introduction Database Management System - 1

The Relational Model 2. Week 3

Lecture 16. The Relational Model

CS5300 Database Systems

CMPSCI 645 Database Design & Implementation

Database Applications (15-415)

Standard stuff. Class webpage: cs.rhodes.edu/db Textbook: get it somewhere; used is fine. Prerequisite: CS 241 Coursework:

Outline. Database Management Systems (DBMS) Database Management and Organization. IT420: Database Management and Organization

Introduction to Data Management. Lecture #3 (E-R Design, Cont d.)

Introduction. Who wants to study databases?

Lecture 2 SQL. Instructor: Sudeepa Roy. CompSci 516: Data Intensive Computing Systems

Administrivia. The Relational Model. Review. Review. Review. Some useful terms

COURSE OVERVIEW THE RELATIONAL MODEL. CS121: Relational Databases Fall 2017 Lecture 1

Lecture 2 SQL. Announcements. Recap: Lecture 1. Today s topic. Semi-structured Data and XML. XML: an overview 8/30/17. Instructor: Sudeepa Roy

COWLEY COLLEGE & Area Vocational Technical School

Transcription:

Introduction to Database Systems UVic C SC 370 Daniel M German Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.1/27

Overview What is a DBMS? what is a relational DBMS? Why do we need them? How do we represent and store data in a DBMS? How does it support concurrent access and system failures? Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.2/27

Motivation: how do we store lots of data? Assume you work for Walmart (and database management systems have not been invented) and you are asked to write a collection of programs that can store and retrieve every single sell in every store of the chain (could be a Tbyte of info) Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.3/27

Motivation... How do you do it? How do you find and retrieve data? How many files do you need? How many disks do you need? And if we add complexity: How do you operate on the data? How do you allow concurrent access and modifications to the data? The problems are not trivial Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.4/27

Database A database is a collection of data, typically describing the activities of one or more related organizations. A database is composed of: Entities Relations A Database Management System or DBMS is software designed to assist in maintaining and utilizing large collections of data. Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.5/27

What are we going to cover? Database design and application development: how do we represent the world with a database? Data analysis: how can we answer questions about the enterprise using this data? Concurrency and robustness: How does a DBMS allow many users to access data concurrently, and how does it protect against failures? Efficiency and Scalability: How does the database cope with large amounts of data? Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.6/27

A bit of history Early 1960s: Charles Bachman at GE creates the first general purpose DBMS Integrated Data Store. It creates the basis for the network model (standardized by CODASYL) Late 1960s: IBM develops the Information Management System (IMS). It uses an alternate model, called the hierarchical data model. SABRE is created around IMS. 1970: Edgar Codd, from IBM creates the relational data model. In 1981 Codd receives the Turing Award for his contributions to database theory. Codd passed away 2 weeks ago (April 2003) Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.7/27

A bit of history... 1980s SQL, developed by IBM, becomes the standard query language for databases. SQL is standardized by ISO. 1980s and 1990s, IBM, Oracle, Informix and others develop powerful DBMS. In the Internet Age, DBMS are showing how useful they can be. Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.8/27

Why do we use a DBMS? Data independence Efficient data access Data integrity and security Data administration Concurrent access and crash recovery Reduced application development time See textbook, section 1.4 Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.9/27

The Relational Data Model: introduction A data model is a collection of high level description constructs that hide many low-level storage details Most current DBMS use the relational data model The central data description in this model is the relation (a set of tuples same as in set theory mathematics) For convenience, we refer to each tuple as a row A schema is a description of the data in terms of the data model. In the relational model the schema looks like: RelationName(field 1 : type 1,...,field n : type n ) Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.10/27

Relational Data Model: example Students(sid : string,name : string,age : integer,gpa : real) A relation of students: An instance of the students relation can be represented as: sid name login age gpa 53666 Jones Jonescs 18 7.4 53668 Smith smithee 18 7.8 53650 Smith smithmath 19 6.4 53831 Madayan madayan@music 11 8.0 53832 Guldy guldu@music 12 2.0 Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.11/27

Relational Data Model: example Each row is a tuple in the relation (a record in the DBMS) We can add integrity constraints (assertions on the data) such as every student has a different sid Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.12/27

Levels of Abstraction in a DBMS External Schema 1 External Schema 2 External Schema 3 Conceptual Schema Physical Schema Disk Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.13/27

Conceptual Schema The the conceptual schema describes the data stored in the database In a relational database it describes all the relations stored in the database Creating a good conceptual schema is not a simple task, and it is called conceptual database design. It involves: Determining the different relations needed The number of fields per relation The type of each field etc. Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.14/27

Example of a Conceptual Schema Students(sid:string, name: string, login: string, age: integer, gpa: integer,gpa: real) Faculty(fid: string, fname: string, sal: real) Courses(cid: string, cname: string, credits: integer) Teaches(fid: string, cid: string) Enrolled(sid: string, cid: string, grade: string)... Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.15/27

Physical Schema The physical schema specifies how the relations are actually stored in secondary storage devices It also specifies auxiliary data structures (indexes) used to speed up the access to the relations Decisions about the physical schema depend upon: Understanding how the data is going to be accessed The facilities provided by the DBMS Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.16/27

Example of Physical Schema Store all relations in unsorted files of records Create indexes in the first column of every relation, and in the sal column of faculty... Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.17/27

External Schema The external schema is a refinement of the conceptual schema Allows customized and authorized access to individual users or groups of users Every database has one conceptual and one physical schema, but it can have many external schemas Each external schema: users is tailored to a particular group of users consists of one or more views and relations of the conceptual schema A view is conceptually a relation, but its records are not stored in the database; instead, they are computed from other relations. Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.18/27

Example of External Schema CourseInfo(cid: string, fname: string, enrollment: integer) Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.19/27

Data Independence Data Independence means that programs are isolated from changes in the way the data is structured and stored. As long as we maintain the external schema, we can modify the other 2 schemas of an application Logical Data Independence: users are shielded from the logical structure of the data (e.g. a relation is split into 2 or more) Physical Data Independence: As long as the conceptual schema remains the same, we can change the storage details of the application without affecting the user. Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.20/27

Queries in a DBMS Why do we need a DBMS? to answer queries A DBMS provides a specialized language, called query language to ask questions to the DBMS Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.21/27

Transaction Management What happens when a DBMS has more than one concurrent user? When several users access (and possibly modify) a database concurrently, the DBMS must order their request carefully to avoid conflicts DBMS should also protect users from system failures: it should make sure data is not lost it should deal with crashes in the middle of a transaction Transaction: a transaction is a conceptually indivisible group of operations that a user wants to perform (for example, getting transferring money from one account to another) Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.22/27

Concurrent Execution of Transaction An important task of a DBMS is to schedule concurrent accesses in a way that every user can ignore the fact that others are accessing the data at the same time A DBMS allows user to think that their programs are executed in isolation Locking has to be implemented to allow transactions to be interleaved Shared Locks: allow several transactions to hold (and access) an object at the same time Exclusive Locks: only one transaction can hold the object Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.23/27

Incomplete Transactions and System Crashes What happens if a DBMS crashes in the middle of a transaction? When the DBMS recovers, the incomplete transaction should be undone. The DBMS maintains a log of everything it writes The log is created before the operation is done: write-ahead log Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.24/27

Structure of a DBMS Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.25/27

People who deal with databases End user (maybe through a program): Wide range of skills and needs Programmers: Usually combine code with DBMS commands Database administrator: responsible for: Design of the conceptual and physical schemas Security and Authorization Data availability and failure recovery Database tuning Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.26/27

What we are going to learn here How to be a programmer: effectively write code that is combined with DBMS commands How to be a (junior) DBMS administrator: we are going to explore some of the issues related to running a DBMS. And we are going to do it using a SQL DBMS (postgresql) Introduction to Database Systems (1.2.0) CSC 370 4/5/2005 14:51 p.27/27