Overview. Introduction to Database Systems. Motivation... Motivation: how do we store lots of data?



Similar documents
Topics. Introduction to Database Management System. What Is a DBMS? DBMS Types

Database Management Systems. Chapter 1

The Relational Model. Why Study the Relational Model?

There are five fields or columns, with names and types as shown above.

The Relational Model. Ramakrishnan&Gehrke, Chapter 3 CS4320 1

Database Systems. Lecture 1: Introduction

EECS 647: Introduction to Database Systems

CS2Bh: Current Technologies. Introduction to XML and Relational Databases. Introduction to Databases. Why databases? Why not use XML?

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

Logistics. Database Management Systems. Chapter 1. Project. Goals for This Course. Any Questions So Far? What This Course Cannot Do.

ECS 165A: Introduction to Database Systems

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

Week 1 Part 1: An Introduction to Database Systems. Databases and DBMSs. Why Use a DBMS? Why Study Databases??

Lecture 6. SQL, Logical DB Design

Outline. Data Modeling. Conceptual Design. ER Model Basics: Entities. ER Model Basics: Relationships. Ternary Relationships. Yanlei Diao UMass Amherst

Overview of Data Management

Chapter 1: Introduction. Database Management System (DBMS) University Database Example

Introduction to Database Systems. Module 1, Lecture 1. Instructor: Raghu Ramakrishnan UW-Madison

Overview of Database Management

INTRODUCTION TO DATABASE SYSTEMS

Introduction to Database Systems CS4320. Instructor: Christoph Koch CS

Chapter 1: Introduction

Chapter 1: Introduction

Chapter 1: Introduction. Database Management System (DBMS)

Introduction to database management systems

DATABASE MANAGEMENT SYSTEM

ICOM 6005 Database Management Systems Design. Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department Lecture 2 August 23, 2001

Introduction to Database Systems

1 File Processing Systems

Relational Database Basics Review

Introduction. Introduction: Database management system. Introduction: DBS concepts & architecture. Introduction: DBS versus File system

3. Relational Model and Relational Algebra

Introduction: Database management system

Review Entity-Relationship Diagrams and the Relational Model. Data Models. Review. Why Study the Relational Model? Steps in Database Design

CS2Bh: Current Technologies. Introduction to XML and Relational Databases. The Relational Model. The relational model

Database Design and Programming

COMP5138 Relational Database Management Systems. Databases are Everywhere!

BCA. Database Management System

David M. Kroenke and David J. Auer Database Processing 11 th Edition Fundamentals, Design, and Implementation. Chapter Objectives

Databases Model the Real World. The Entity- Relationship Model. Conceptual Design. Steps in Database Design. ER Model Basics. ER Model Basics (Contd.

Transaction Management Overview

ISM 318: Database Systems. Objectives. Database. Dr. Hamid R. Nemati

Winter Winter

2. Basic Relational Data Model

Introduction to Databases

Database Management. Chapter Objectives

Scope of this Course. Database System Environment. CSC 440 Database Management Systems Section 1

DBMS Questions. 3.) For which two constraints are indexes created when the constraint is added?

CSE 132A. Database Systems Principles

1/20/11. Outline. Database Management Systems. Prerequisites. Staff and Contact Information. Course Web Site. 645: Database Design and Implementation

Bridge from Entity Relationship modeling to creating SQL databases, tables, & relations

1. INTRODUCTION TO RDBMS

Database 2 Lecture I. Alessandro Artale

14 Databases. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

David M. Kroenke and David J. Auer Database Processing 12 th Edition

Transactions and Recovery. Database Systems Lecture 15 Natasha Alechina

CSE 544 Principles of Database Management Systems. Magdalena Balazinska (magda) Winter 2009 Lecture 1 - Class Introduction

Database Systems Introduction Dr P Sreenivasa Kumar

SQL Programming. CS145 Lecture Notes #10. Motivation. Oracle PL/SQL. Basics. Example schema:

A Brief Introduction to MySQL

Introduction to Object-Oriented and Object-Relational Database Systems

SQL, PL/SQL FALL Semester 2013

Data. Data and database. Aniel Nieves-González. Fall 2015

Overview of Database Management Systems

Database System Architecture & System Catalog Instructor: Mourad Benchikh Text Books: Elmasri & Navathe Chap. 17 Silberschatz & Korth Chap.

CSE 530A Database Management Systems. Introduction. Washington University Fall 2013

Introduction to Database Systems. Chapter 1 Introduction. Chapter 1 Introduction

Chapter 3. Database Environment - Objectives. Multi-user DBMS Architectures. Teleprocessing. File-Server

Database System Concepts


Chapter 6 The database Language SQL as a tutorial

Course: CSC 222 Database Design and Management I (3 credits Compulsory)

COMP 5138 Relational Database Management Systems. Week 5 : Basic SQL. Today s Agenda. Overview. Basic SQL Queries. Joins Queries

CSE 544 Principles of Database Management Systems. Magdalena Balazinska (magda) Fall 2007 Lecture 1 - Class Introduction

Storing Data: Disks and Files. Disks and Files. Why Not Store Everything in Main Memory? Chapter 7

Concepts of Database Management Seventh Edition. Chapter 7 DBMS Functions

SQL Simple Queries. Chapter 3.1 V3.0. Napier University Dr Gordon Russell

Basic Concepts of Database Systems

History of Database Systems

Using SQL Queries to Insert, Update, Delete, and View Data: Joining Multiple Tables. Lesson C Objectives. Joining Multiple Tables

Geodatabase Programming with SQL

Objectives of Lecture 1. Labs and TAs. Class and Office Hours. CMPUT 391: Introduction. Introduction

In This Lecture. Security and Integrity. Database Security. DBMS Security Support. Privileges in SQL. Permissions and Privilege.

Database Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB

Microsoft SQL Server for Oracle DBAs Course 40045; 4 Days, Instructor-led

SQL Tables, Keys, Views, Indexes

Database Management System

How To Manage Data In A Database System

The Classical Architecture. Storage 1 / 36

Lesson 8: Introduction to Databases E-R Data Modeling

CS 564: DATABASE MANAGEMENT SYSTEMS

Module 4 Creation and Management of Databases Using CDS/ISIS

Database Management Systems

Schema Mappings and Data Exchange

æ A collection of interrelated and persistent data èusually referred to as the database èdbèè.

1. SELECT DISTINCT f.fname FROM Faculty f, Class c WHERE f.fid = c.fid AND c.room = LWSN1106

DATABASE MANAGEMENT SYSTEMS SOLUTIONS MANUAL THIRD EDITION

Θεµελίωση Βάσεων εδοµένων

MySQL for Beginners Ed 3

Transcription:

Introduction to Database Systems UVic C SC 370 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? Dr. Daniel M. German Department of Computer Science May 5, 2004 Version: 1.1.1 1 1 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca 1 2 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca Motivation: how do we store lots of data? Motivation... 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) 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 1 3 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca 1 4 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca

Database What are we going to cover? 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. 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? 1 5 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca 1 6 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca A bit of history 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) 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. 1 7 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca 1 8 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca

Why do we use a DBMS? The Relational Data Model: introduction 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 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 ) 1 9 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca 1 10 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca Relational Data Model: example Relational Data Model: example A relation of students: Students(sid : string,name : string,age : integer,gpa : real) An instance of the students relation can be represented as: sid name login age gpa 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 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 1 11 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca 1 12 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca

Levels of Abstraction in a DBMS Conceptual Schema External Schema 1 External Schema 2 External Schema 3 Conceptual Schema Physical Schema Disk 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. 1 13 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca 1 14 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca Example of a Conceptual Schema Physical 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)... 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 1 15 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca 1 16 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca

Example of Physical Schema External 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... 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. 1 17 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca 1 18 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca Example of External Schema Data Independence CourseInfo(cid: string, fname: string, enrollment: integer) 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. 1 19 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca 1 20 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca

Queries in a DBMS Transaction Management Why do we need a DBMS? to answer queries A DBMS provides a specialized language, called query language to ask questions to the DBMS 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) 1 21 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca 1 22 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca Concurrent Execution of Transaction Incomplete Transactions and System Crashes 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 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 1 23 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca 1 24 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca

Structure of a DBMS 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 1 25 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca 1 26 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca 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) 1 27 Introduction to Database Systems (1.1.1) CSC 370 dmgerman@uvic.ca