Databases. Jörg Endrullis. VU University Amsterdam

Similar documents
Introduction to DBMS

CAS CS 460/660 Introduction to Database Systems. Fall

DATABASES SQL INFOTEK SOLUTIONS TEAM

CSCI1270 Introduction to Database Systems

UNIT I. Introduction

D.Hemavathi & R.Venkatalakshmi, Assistant Professor, SRM University, Kattankulathur

Introduction. Example Databases

Database Systems. Sven Helmer. Database Systems p. 1/567

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

Administration Naive DBMS CMPT 454 Topics. John Edgar 2

CMSC 424 Database design Lecture 4: Relational Model ER to Relational model. Book: Chap. 2 and 6. Mihai Pop

A database can be modeled as: + a collection of entities, + a set of relationships among entities.

Database Management System. Fundamental Database Concepts

John Edgar 2

CPSC 421 Database Management Systems. Lecture 19: Physical Database Design Concurrency Control and Recovery

COURSE 1. Database Management Systems

Quick Facts about the course. CS 2550 / Spring 2006 Principles of Database Systems. Administrative. What is a Database Management System?

Overview of db design Requirement analysis Data to be stored Applications to be built Operations (most frequent) subject to performance requirement

Relational model continued. Understanding how to use the relational model. Summary of board example: with Copies as weak entity

Introduction to Transaction Management

Database Management Systems (CPTR 312)

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data.

G64DBS Database Systems. G64DBS Module. Recommended Textbook. Assessment. Recommended Textbook. Recommended Textbook.

Topics. History. Architecture. MongoDB, Mongoose - RDBMS - SQL. - NoSQL

Database Management Systems MIT Introduction By S. Sabraz Nawaz

Database Management Systems Introduction to DBMS

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

Chapter 1 Chapter-1

CMSC 424 Database design Lecture 2: Design, Modeling, Entity-Relationship. Book: Chap. 1 and 6. Mihai Pop

Databases. Jörg Endrullis. VU University Amsterdam

Relational Database Systems Part 01. Karine Reis Ferreira

Introduction to Databases, Fall 2005 IT University of Copenhagen. Lecture 10: Transaction processing. November 14, Lecturer: Rasmus Pagh

CSCI1270 Introduction to Database Systems

Database Technology. Topic 8: Introduction to Transaction Processing

Database Technology Introduction. Heiko Paulheim

DATABASE MANAGEMENT SYSTEMS. UNIT I Introduction to Database Systems

U1. Data Base Management System (DBMS) Unit -1. MCA 203, Data Base Management System

Weak Levels of Consistency

MIS Database Systems.

BIS Database Management Systems.

Background. vanilladb.org

1. Considering functional dependency, one in which removal from some attributes must affect dependency is called

Chapter 1: Introduction. Chapter 1: Introduction

Using a DBMS. Shan-Hung Wu & DataLab CS, NTHU

Fundamentals of Physical Design: State of Art

Data Modeling using ER Model

Chapter 2: Relational Model

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

Chapter 1: Introduction

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

Conceptual Design. The Entity-Relationship (ER) Model

CS425 Fall 2016 Boris Glavic Chapter 1: Introduction

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

Chapter 1: Introduction

Database Systems Relational Model. A.R. Hurson 323 CS Building

4/28/2014. File-based Systems. Arose because: Result

II B.Sc(IT) [ BATCH] IV SEMESTER CORE: RELATIONAL DATABASE MANAGEMENT SYSTEM - 412A Multiple Choice Questions.

Database Management Systems. Chapter 1

Chapter 1: Introduction

Introduction to Information Systems

A REVIEW OF BASIC KNOWLEDGE OF DATABASE SYSTEM

Introduction: Database Concepts Slides by: Ms. Shree Jaswal

CT13 DATABASE MANAGEMENT SYSTEMS DEC 2015

Intro to Transaction Management

DATABASE MANAGEMENT SYSTEM COURSE CONTENT

DATABASE TECHNOLOGY - 1MB025

SQL DATA DEFINITION: KEY CONSTRAINTS. CS121: Relational Databases Fall 2017 Lecture 7

DATABASTEKNIK - 1DL116

Course Logistics & Chapter 1 Introduction

Foundations of Databases

UVA. Database Systems. Need for information

Chapter 1: Introduction

DB Creation with SQL DDL

Databases: Introduction

Transactions. Juliana Freire. Some slides adapted from L. Delcambre, R. Ramakrishnan, G. Lindstrom, J. Ullman and Silberschatz, Korth and Sudarshan

CSE 544 Principles of Database Management Systems

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

Database Environment. Pearson Education 2009

Chapter 4. The Relational Model

Where Are We? Next Few Lectures. Integrity Constraints Motivation. Constraints in E/R Diagrams. Keys in E/R Diagrams

DATABASE TECHNOLOGY - 1MB025

Informatics 1: Data & Analysis

CSE 344 MAY 14 TH ENTITIES

Bases de Dades: introduction to SQL (indexes and transactions)

Chapter Five Physical Database Design

Transactions. Kathleen Durant PhD Northeastern University CS3200 Lesson 9

DATABASE DESIGN - 1DL400

CSE 3241: Database Systems I Databases Introduction (Ch. 1-2) Jeremy Morris

Chapter 1: Introduction

Database Systems Overview. Truong Tuan Anh CSE-HCMUT

Data, Databases, and DBMSs

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

COSC 304 Introduction to Database Systems. Advanced SQL. Dr. Ramon Lawrence University of British Columbia Okanagan

CSCD43: Database Systems Technology. Lecture 4

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

CSE 190D Database System Implementation

Course Introduction & Foundational Concepts

Chapter 8: Working With Databases & Tables

DBMS and its Architecture

Lecture 02. Fall 2017 Borough of Manhattan Community College

Transcription:

Databases Jörg Endrullis VU University Amsterdam

Databases A database (DB) is a collection of data with a certain logical structure a specific semantics a specific group of users

Databases A database (DB) is a collection of data with a certain logical structure a specific semantics a specific group of users A database management system (DBMS) allows to create, modify and manipulate a database query (retrieve) the data using a query language support persistent storage of large amounts of data enable durability and recovery from failure control access to the data by many users in parallel without unexpected interactions among users (isolation) actions on the data should never be partial (atomicity)

Why not just store data in files? Why not just store data in files? no query language weak logical structure (limited to directories) no efficient access searching through a large file can take hours no or limited protection from data loss no access control for parallel manipulation of data So we need database management systems...

Motivation for Database Management Systems Motivation for database management systems data independence logical view on the data independent of physical storage user interacts with a simple view on the data behind the scenes (invisible for the user) are complex storage structures that allow rapid access and manipulation avoidance of duplication different views on the same database for different users or different applications hiding parts of the data for privacy or security

Motivation for Database Management Systems Motivation for database management systems data independence logical view on the data independent of physical storage user interacts with a simple view on the data behind the scenes (invisible for the user) are complex storage structures that allow rapid access and manipulation avoidance of duplication different views on the same database for different users or different applications hiding parts of the data for privacy or security This is achieved by the ANSI SPARC Architecture...

View of Data ANSI SPARC Architecture: 3 levels view 1 view 2... view n External logical level Conceptual physical level Internal Different applications might use different views Data is stored only once at the physical level good for consistency

View of Data ANSI SPARC Architecture: 3 levels View level: application programs hide details of data types hide information (e.g. exam grade) for privacy or security Logical level: also called conceptual schema describes data stored in the database, and relations among the data Physical level: how the data is stored disk pages, index structures, byte layout, record order

View of Data ANSI SPARC Architecture: 3 levels View level: application programs hide details of data types hide information (e.g. exam grade) for privacy or security Logical level: also called conceptual schema describes data stored in the database, and relations among the data Physical level: how the data is stored disk pages, index structures, byte layout, record order This ensures logical and physical data independence...

Data Independence Logical data independence Logical data independence is the ability to modify the logical schema without breaking existing applications applications access the views, not the logical database Physical data independence Physical data independence is the ability to modify the physical schema without changing the logical schema e.g. a change in workload might cause the need for different indexing structures different database engine distributing the database on multiple machines...

Relational Model In this course, we work with relational databases. Their view and logical level represented data as relations/tables. Example relational database instance customer id name street city 1928374 Johnson 12 Alma Palo Alto 3211231 Jones 34 Main Harisson 0192837 Smith 7 South Rye account depositor accountnr 1928374 101343 3211231 217343 0192837 201762 row = tuple record: (3211231, Jones, 34 Main, Harisson) In the pure relational model, a table is a set of tuples: has no duplicate tuples (rows) no order on the tuples

Motivation for Database Management Systems Motivation for database management systems high-level declarative query languages query tells what you want, independent of storage structure efficient data access (automatic query optimisation) Declarative Query Languages Queries should: describe what information is sought not prescribe how to retrieve the desired information

Motivation for Database Management Systems Motivation for database management systems high-level declarative query languages query tells what you want, independent of storage structure efficient data access (automatic query optimisation) Declarative Query Languages Queries should: describe what information is sought not prescribe how to retrieve the desired information Relational databases usually use SQL as query language...

Imperative vs. Declarative Languages Kowalski Algorithm = Logic + Control Imperative/procedural languages: explicit control implicit logic Declarative/non-procedural languages: implicit control explicit logic Examples of declarative languages logic programming (e.g. Prolog), functional programming (e.g. Haskell), markup languages (e.g. HTML),...

SQL = Structure Query Language SQL is a declarative data manipulation language. The user describes conditions the requested data is required to fulfil. SQL Query SELECT ID FROM CUSTOMER WHERE NAME = 'Jones' AND CITY = 'Harisson'

SQL = Structure Query Language SQL is a declarative data manipulation language. The user describes conditions the requested data is required to fulfil. SQL Query SELECT ID FROM CUSTOMER WHERE NAME = 'Jones' AND CITY = 'Harisson' More concise than imperative languages: less expensive program development easier maintenance Database system will optimise the query: decides how to execute the query as fast as possible Users (usually) do not need to think about efficiency.

Motivation for Database Management Systems Motivation for database management systems well-defined data models & data integrity constraints relational model meta language for describing data data relationships data constraints

Motivation for Database Management Systems Motivation for database management systems well-defined data models & data integrity constraints relational model meta language for describing data data relationships data constraints SQL can be used for table and constraint definitions...

Relational Model: Schema Database schema = structure of the database = relations + constraints Example schema customer(id, name, street, city) account(depositor customer, accountnr) Database instance = actual content ( state ) of the database at some moment Example instance customer id name street city 1928374 Johnson 12 Alma Palo Alto 0192837 Smith 4 North Rye account depositor accountnr 1928374 101343 0192837 215569

Integrity Constraints Example schema with key constraints customer(id, name, street, city) Primary key constraint on id account(depositor customer, accountnr) Foreign key constraint on depositor Various types of constraints: data types, constrained data types (domains) columns constraints (e.g. unique, nullability, counter,... ) check constraints (logical expression for domain integrity) (e.g. age >= 18 AND age <= 150)

SQL DDL (Data Definition Language) Creating a table with constraints CREATE TABLE solved ( id INT AUTO_INCREMENT, name VARCHAR(40) NOT NULL, homework NUMERIC(2) NOT NULL, points NUMERIC(2) NOT NULL CHECK (points <= 10), PRIMARY KEY (id) ); Note the data types and constraints! solved id name homework points

SQL DDL (Data Definition Language) Creating a table with constraints CREATE TABLE solved ( id INT AUTO_INCREMENT, name VARCHAR(40) NOT NULL, homework NUMERIC(2) NOT NULL, points NUMERIC(2) NOT NULL CHECK (points <= 10), PRIMARY KEY (id) ); Note the data types and constraints! solved id name homework points Creating a view CREATE VIEW solved_homework AS SELECT id, name, homework FROM solved;

How to Design Database Schemes? How to design database schemes? Entity-relationship models (ER models) UML class diagrams They are widely used for database design usually converted to the relational model

Entity Relationship Model Entity relationship model entities = objects e.g. customers, accounts, bank branches relationship between entities e.g. account 101343 is held by customer Johnson relationship set descriptor links customers with accounts id name account-number street customer depositor account city balance

UML Class Diagram UML class diagrams frequently used in database design similar to E/R diagrams: Entities/Relationships = Classes/Associations Example Schema as UML Class diagram customer +id +name +street +city 1 deposits 0..* depositor account +account-number +balance

Motivation for Database Management Systems Motivation for database management systems multiple users, concurrent access transactions with ACID properties A transaction is a collection of operations that performs a single logical function in a database application. Database management system ensures ACID properties Atomicity: transaction executes fully (commit) or not at all (abort) Consistency: database remains in a consistent state where all integrity constraints hold Isolation: multiple users can modify the database at the same time but will not see each others partial actions Durability: once a transaction is committed successfully, the modified data is persistent, regardless of disk crashes

Summary Why Database Management Systems? data independence logical view on the data independent of physical storage avoidance of duplication different views on the same database high-level declarative query languages (what, not how) efficient data access, automatic query optimisation data models & data integrity (consistency) multiple users, concurrent access transactions with ACID properties persistent storage, safety and high availability safety against failure (backup/restore) scalability (data could by much larger than main memory) security indexing, scalable algorithms