chapter 1: introductioncbitmca.herokuapp.com/pages/data/2ndyr/1sem/dbms/… ·  ·...

26
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-use Chapter 1: Introduction

Upload: dohanh

Post on 30-May-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

Database System Concepts, 6th Ed.©Silberschatz, Korth and Sudarshan

See www.db-book.com for conditions on re-use

Chapter 1: Introduction

Page 2: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.2Database System Concepts - 6th Edition

Data, Database, and DBMS

n Data [Elmasri and Navathe. Fundamentals of Database Systems]

l Known facts that can be recorded and that have implicit meaninge.g.) names, phone numbers, addresses, …

n Databasel Collection of interrelated data

n Database management system (DBMS)l Database + set of programs to access those datal An environment that is both convenient and efficient to use

Page 3: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.3Database System Concepts - 6th Edition

Database System Applications

n Databases touch all aspects of our lives

n Database Applications:l Banking: transactionsl Airlines: reservations, schedulesl Universities: registration, gradesl Sales: customers, products, purchasesl Online retailers: order tracking, customized recommendationsl Manufacturing: production, inventory, orders, supply chainl Human resources: employee records, salaries, tax deductions

Page 4: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.4Database System Concepts - 6th Edition

Drawbacks of Using File Systems to Store Data

n Data redundancy and inconsistencyl Multiple file formats, duplication of information in different files

n Difficulty in accessing data l Need to write a new program to carry out each new task

n Data isolationl Data are scattered in multiple files and formats

n Integrity problemsl Integrity constraints (e.g., account balance > 0) become “buried”

in program code rather than being stated explicitlyl Hard to add new constraints or change existing ones

Page 5: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.5Database System Concepts - 6th Edition

Drawbacks of Using File Systems to Store Data (Cont.)

n Atomicity of updatesl Failures may leave database in an inconsistent state with partial

updates carried outl Example: Transfer of funds from one account to another should either

complete or not happen at alln Concurrent access by multiple users

l Concurrent access needed for performancel Uncontrolled concurrent accesses can lead to inconsistencies

4 Example: Two people reading a balance (say 100) and updating it by withdrawing money (say 50 each) at the same time

n Security problemsl Hard to provide user access to some, but not all, data

Database systems offer solutions to all the above problems

Page 6: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.6Database System Concepts - 6th Edition

Levels of Abstraction

n View level: application programs hide details of data types. Views can also hide information (such as an employee’s salary) for security purposes.

n Logical level: describes data stored in database, and the relationships among the datatype instructor = record

ID : string; name : string;dept_name : string;salary : integer;

end;

n Physical level:describes how a record is stored

Page 7: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.7Database System Concepts - 6th Edition

Instances and Schemas

n Similar to types and variables in programming languages

n Schema – the logical structure of the database l Analogous to type information of a variable in a programl Example: The database consists of information about a set of customers

and accounts and the relationship between them

n Instance – the actual content of the database at a particular point in time l Analogous to the value of a variable

Page 8: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.8Database System Concepts - 6th Edition

Physical Data Independence

n Schemas according to the level of abstraction l Logical schema: database design at the logical levell Physical schema: database design at the physical level

n Physical Data Independence – the ability to modify the physical schema without changing the logical schemal Applications depend on the logical schemal In general, the interfaces between the various levels and components

should be well defined so that changes in some parts do not seriously influence others.

Page 9: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.9Database System Concepts - 6th Edition

Data Models

n A collection of tools for describing l Data l Data relationshipsl Data semanticsl Data constraints

n Relational modeln Entity-Relationship data model (mainly for database design) n Object-based data models (Object-oriented and Object-relational)n Semistructured data model (XML)n Other older models:

l Network model l Hierarchical model

Page 10: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.10Database System Concepts - 6th Edition

Relational Model

n Relational model (Chapter 2)n Example of tabular data in the relational model

Columns

Rows

Page 11: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.11Database System Concepts - 6th Edition

The Entity-Relationship Model

n Models an enterprise as a collection of entities and relationshipsl Entity: a “thing” or “object” in the enterprise that is distinguishable from

other objects4 Described by a set of attributes

l Relationship: an association among several entitiesn Represented diagrammatically by an entity-relationship diagram:

Page 12: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.12Database System Concepts - 6th Edition

n Supports complex types and inheritance

Object-Based Data Model

Page 13: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.13Database System Concepts - 6th Edition

n Supports extensible tags and nested structures

XML Data Model

<university><department>

<dept_name> Comp. Sci. </dept_name><building> Taylor </building><budget> 100000 </budget>

</department><course>

<course_id> CS-101 </course_id><title> Intro. to Computer Science </title><dept_name> Comp. Sci </dept_name><credits> 4 </credits>

</course></university>

<university><department>

<dept_name> Comp. Sci. </dept_name><building> Taylor </building><budget> 100000 </budget><course>

<course_id> CS-101 </course_id><title> Intro. to Computer Science </title><dept_name> Comp. Sci </dept_name><credits> 4 </credits>

</course></department>

</university>

Page 14: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.14Database System Concepts - 6th Edition

Data Definition Language (DDL)

n Language for defining the database schema

n DDL compiler generates a set of table templates stored in a data dictionaryn Data dictionary contains metadata (i.e., data about data)

l Database schema l Integrity constraints

4 Primary key (ID uniquely identifies instructors)4 Referential integrity (references constraint in SQL)– e.g. dept_name value in any instructor tuple must appear in

department relationl Authorization

Page 15: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.15Database System Concepts - 6th Edition

Data Manipulation Language (DML)

n Language for accessing and manipulating the data organized by the appropriate data modell Retrieval, insertion, deletion, modification

n Query language: part of DML that requests data retrievall Commonly used as a synonym for DML

n Two classes of languages l Procedural – user specifies what data is required and how to get those data l Declarative (nonprocedural) – user specifies only what data is required,

without specifying how to get those datan SQL is the most widely used query language

Page 16: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.16Database System Concepts - 6th Edition

SQL

n SQL: widely used non-procedural languagel Example: Find the name of the instructor with ID 22222

select namefrom instructorwhere instructor.ID = ‘22222’

l Example: Find the ID and building of instructors in the Physics dept.select instructor.ID, department.buildingfrom instructor, departmentwhere instructor.dept name = “physics”

n Application programs generally access databases through one ofl Language extensions to allow embedded SQLl Application program interface (e.g., ODBC/JDBC) which allow SQL

queries to be sent to a databasen Chapters 3, 4 and 5

Page 17: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.17Database System Concepts - 6th Edition

Query Processing

1. Parsing and translation2. Optimization3. Evaluation

Page 18: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.18Database System Concepts - 6th Edition

Storage Management

n DBMS must effectively and efficiently manage storage (disk) space

n Storage managerl Program module that provides the interface

between the low-level data stored in the database and the application programs and queries submitted to the system

l Efficient storing, retrieving and updating of datan Issues:

l Storage accessl File organizationl Indexing and hashing

Page 19: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.19Database System Concepts - 6th Edition

Transaction Management

n What if the system fails?n What if more than one user is concurrently updating the same data?

n Transaction – a collection of operations that performs a single logical function in a database application

n Transaction-management component ensures that the database remains in a consistent (correct) state despite system failures (e.g., power failures and operating system crashes) and transaction failures.

n Concurrency-control manager controls the interaction among the concurrent transactions, to ensure the consistency of the database

Page 20: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.20Database System Concepts - 6th Edition

Database Users

Users are differentiated by the way they expect to interact with the systemn Application programmers – interact with system through DML callsn Sophisticated users – form requests in a database query languagen Specialized users – write specialized database applications that do not fit into

the traditional data processing frameworkn Naïve users – invoke one of the permanent application programs that have

been written previouslyl Examples, people accessing database over the web, bank tellers, clerical

staff

Page 21: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.21Database System Concepts - 6th Edition

Database Administrator

n Coordinates all the activities of the database system; the database administrator has a good understanding of the enterprise’s information resources and needs.

n Database administrator's duties include:l Schema definitionl Storage structure and access method definitionl Schema and physical organization modificationl Granting user authority to access the databasel Specifying integrity constraintsl Acting as liaison with usersl Monitoring performance and responding to changes in requirements

Page 22: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.22Database System Concepts - 6th Edition

Overall Database System Structure

Page 23: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.23Database System Concepts - 6th Edition

Application Architecture

n Two-tier architecture: application programs communicate with DBMS using API standards (like ODBC/JDBC)

n Three-tier architecture: “middleware” (like WAS – Web application server) is used for accessing data

Page 24: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.24Database System Concepts - 6th Edition

History of Database Systems

n 1950s and early 1960s:l Data processing using magnetic tapes for storage

4 Tapes provided only sequential accessl Punched cards for input

n Late 1960s and 1970s:l Hard disks allowed direct access to datal Network and hierarchical data models in widespread usel E. F. “Ted” Codd defines the relational data model

4 Would win the ACM Turing Award for this work4 IBM Research begins System R prototype4 UC Berkeley begins Ingres prototype

l High-performance (for the era) transaction processing

Page 25: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.25Database System Concepts - 6th Edition

History of Database Systems (Cont.)

n 1980s:l Research relational prototypes evolve into commercial systems

4 SQL becomes industrial standardl Parallel and distributed database systemsl Object-oriented database systems

n 1990s:l Large decision support and data-mining applicationsl Large multi-terabyte data warehousesl Emergence of Web commerce

n Early 2000s:l XML and XQuery standardsl Automated database administration

n Later 2000s:l Giant data storage systems

4 Google BigTable, Yahoo PNuts, Amazon, ..

Page 26: Chapter 1: Introductioncbitmca.herokuapp.com/pages/Data/2ndyr/1sem/DBMS/… ·  · 2017-02-21Chapter 1: Introduction . ... duplication of information in different files ... Database

©Silberschatz, Korth and Sudarshan1.26Database System Concepts - 6th Edition

End of Chapter 1