Presentation is loading. Please wait.

Presentation is loading. Please wait.

©Sang Ho Lee1.1Database System Concepts - 5 th Edition Acknowledgement Fall 2010 Those slides are essentially based on the slides that come with “Database.

Similar presentations


Presentation on theme: "©Sang Ho Lee1.1Database System Concepts - 5 th Edition Acknowledgement Fall 2010 Those slides are essentially based on the slides that come with “Database."— Presentation transcript:

1 ©Sang Ho Lee1.1Database System Concepts - 5 th Edition Acknowledgement Fall 2010 Those slides are essentially based on the slides that come with “Database System Concepts (5th edition)” authored by A. Silberschatz, H. Korth and S. Sudarshan. Big thanks to them. Prof. Sang Ho Lee revises and updates the slides to accommodate his teaching materials.

2 ©Sang Ho Lee1.2Database System Concepts - 5 th Edition Chapter 1: Introduction

3 ©Sang Ho Lee1.3Database System Concepts - 5 th Edition Chapter 1: Introduction n History of Database Systems n Purpose of Database Systems n View of Data n Database Languages n Relational Databases n Database Design n Overall Structure n Object-based and semi-structured databases n Data Storage and Querying n Transaction Management n Database Architecture n Database Users and Administrators

4 ©Sang Ho Lee1.4Database System Concepts - 5 th Edition Databases, DBMS, DBS n Databases l Informally a collection of data l Stored at computers, too large to hold in main memory, subject to change constantly over time n DBMS (Database Management System) l A collection of software that not only allows us to define, construct, manipulate databases but also provides a number of desirable functionalities (data independence, data sharing, recovery, security, etc.) n DBS (Database System) = DB + DBMS n In practice, those terms are used interchangeably !!!

5 ©Sang Ho Lee1.5Database System Concepts - 5 th Edition Database System (DBS) n DBS contains information about a particular enterprise l Collection of interrelated data l Set of programs to access the data l An environment that is both convenient and efficient to use n Database Applications: l Banking: all transactions l Airlines: reservations, schedules l Universities: registration, grades l Sales: customers, products, purchases l Online retailers: order tracking, customized recommendations l Manufacturing: production, inventory, orders, supply chain l Human resources: employee records, salaries, tax deductions n Databases touch all aspects of our lives

6 ©Sang Ho Lee1.6Database System Concepts - 5 th Edition History of Database Systems (1/2) n 1950s and early 1960s: l Data processing using magnetic tapes for storage  Tapes provide only sequential access l Punched cards for input n Late 1960s and 1970s: l Hard disks allow direct access to data l Network and hierarchical data models in widespread use l Ted Codd defines the relational data model (1970)  Win the ACM Turing Award for this work  IBM Research begins System R prototype  UC Berkeley begins Ingres prototype l IBM IMS (hierarchical database system) is still in operation !!!

7 ©Sang Ho Lee1.7Database System Concepts - 5 th Edition History of Database Systems (2/2) n 1980s: l Research relational prototypes evolve into commercial systems  SQL becomes industrial standard l Parallel and distributed database systems l Object-oriented database systems n 1990s: l Large decision support and data-mining applications l Large multi-terabyte data warehouses l Emergence of Web commerce n 2000s: l Object-relational database systems dominate l XML and XQuery standards l Automated database administration

8 ©Sang Ho Lee1.8Database System Concepts - 5 th Edition Objectives of Database Systems (1/2) n A file system is usually a part of an operating system (for example, filesystem in Unix), and theoretically users can manage their data using a file system. l Users utilize systems calls such as open, close, read, write, and lseek in Unix l In the early days, database applications were built directly on top of file systems n Drawbacks of using file systems to store data: l Data redundancy and inconsistency  Multiple file formats, duplication of information in different files l Difficulty in accessing data  Need to write a new program to carry out each new task l Data isolation — multiple files and formats l Integrity problems  Integrity constraints (e.g. account balance > 0) become “buried” in program code rather than being stated explicitly  Hard to add new constraints or change existing ones

9 ©Sang Ho Lee1.9Database System Concepts - 5 th Edition Objectives of Database Systems (2/2) n Drawbacks of using file systems (cont.) l Atomicity of updates  Failures may leave database in an inconsistent state with partial updates carried out  Example: Transfer of funds from one account to another should either complete or not happen at all l Concurrent access by multiple users  Concurrent accessed needed for performance  Uncontrolled concurrent accesses can lead to inconsistencies –Example: Two people reading a balance and updating it at the same time l Security problems  Hard to provide user access to some, but not all, data n Database systems offer solutions to all the above problems

10 ©Sang Ho Lee1.10Database System Concepts - 5 th Edition Abstraction n In computer science, abstraction is a mechanism and practice to reduce and factor out details so that one can focus on a few concepts at a time n DBMS should support some level of data abstraction by hiding details of internal data organization (particularly, physical data storage structure)

11 ©Sang Ho Lee1.11Database System Concepts - 5 th Edition Levels of Abstraction n Physical level: describes how a record (e.g., customer) is stored. n Logical level: describes data stored in database, and the relationships among the data. type customer = record customer_id : string; customer_name : string; customer_street : string; customer_city : integer; customer_SSN : decimal; end; n View level: application programs hide details of data types. Views can also hide information (such as customer’s SSN) for security purposes.

12 ©Sang Ho Lee1.12Database System Concepts - 5 th Edition View of Data An architecture for a database system

13 ©Sang Ho Lee1.13Database System Concepts - 5 th Edition Instances and Schemas n Similar to types and variables in programming languages n Schema – the logical structure of the database l Example: The database consists of information about a set of customers and accounts and the relationship between them l Analogous to type information of a variable in a program l Physical schema: database design at the physical level l Logical schema: database design at the logical level n Instance – the actual content of the database at a particular point in time l Analogous to the value of a variable

14 ©Sang Ho Lee1.14Database System Concepts - 5 th Edition Data independence n Physical Data Independence – the ability to modify the physical schema without changing the logical schema l Applications depend on the logical schema l 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.

15 ©Sang Ho Lee1.15Database System Concepts - 5 th Edition Data Models n A collection of tools for describing l Data l Data relationships l Data semantics l Data constraints n Data models provide data abstraction to users !!! n Relational model n Entity-Relationship data model (mainly for database design) n Object-based data models (Object-oriented and Object-relational) n Semi-structured data model (XML) n Other older models: l Network model l Hierarchical model

16 ©Sang Ho Lee1.16Database System Concepts - 5 th Edition Relational Model n Example of tabular data in the relational model Attributes

17 ©Sang Ho Lee1.17Database System Concepts - 5 th Edition A Sample Relational Database

18 ©Sang Ho Lee1.18Database System Concepts - 5 th Edition The Entity-Relationship Model n Models an enterprise as a collection of entities and relationships l Entity: a “thing” or “object” in the enterprise that is distinguishable from other objects  Described by a set of attributes l Relationship: an association among several entities n Represents graphically by an entity-relationship diagram:

19 ©Sang Ho Lee1.19Database System Concepts - 5 th Edition Object-Relational Data Models n Extend the relational data model by including object orientation and constructs to deal with added data types. n Allow attributes of tuples to have complex types, including non-atomic values such as nested relations. n Preserve relational foundations, in particular the declarative access to data, while extending modeling power. n Provide upward compatibility with existing relational languages.

20 ©Sang Ho Lee1.20Database System Concepts - 5 th Edition XML: Extensible Markup Language n Defined by the WWW Consortium (W3C) n Originally intended as a document markup language not a database language n The ability to specify new tags, and to create nested tag structures made XML a great way to exchange data, not just documents n XML has become the basis for all new generation data interchange formats. n A wide variety of tools is available for parsing, browsing and querying XML documents/data

21 ©Sang Ho Lee1.21Database System Concepts - 5 th Edition Database Languages n In terms of functionalities, languages can be divided into: DDL, DML, DCL (database control language) n Languages in use l SQL l Query-by-example l Datalog l OQL (object query language) l Relational algebra, etc.

22 ©Sang Ho Lee1.22Database System Concepts - 5 th Edition Data Definition Language (DDL) n Specification notation for defining the database schema Example:create table account ( account-number char(10), balance integer) n DDL compiler generates a set of tables stored in a data dictionary n Data dictionary contains metadata (i.e., data about data) l Database schema l Data storage and definition language  Specifies the storage structure and access methods used l Integrity constraints  Domain constraints  Referential integrity (references constraint in SQL)  Assertions l Authorization

23 ©Sang Ho Lee1.23Database System Concepts - 5 th Edition Data Manipulation Language (DML) n Language for accessing and manipulating the data organized by the appropriate data model l DML also known as query language n Two classes of languages l Procedural – user specifies what data is required and how to get those data l Declarative (nonprocedural) – user specifies what data is required without specifying how to get those data

24 ©Sang Ho Lee1.24Database System Concepts - 5 th Edition SQL n SQL: widely used non-procedural language l Example: Find the name of the customer with customer-id 192-83- 7465 selectcustomer.customer_name fromcustomer wherecustomer.customer_id = ‘192-83-7465’ l Example: Find the balances of all accounts held by the customer with customer-id 192-83-7465 selectaccount.balance from depositor, account where depositor.customer_id = ‘192-83-7465’ and depositor.account_number = account.account_number n Application programs generally access databases through one of l Language extensions to allow embedded SQL l Application program interface (e.g., ODBC/JDBC) which allows SQL queries to be sent to a database

25 ©Sang Ho Lee1.25Database System Concepts - 5 th Edition Database Design n The process of designing the general structure of the database (not DBMS software) from given system requirements n Logical Design – Deciding on the database schema. Database design requires that we find a “good” collection of relation schemas. l Business decision – What attributes should we record in the database? l Computer Science decision – What relation schemas should we have and how should the attributes be distributed among the various relation schemas? n Physical Design – Deciding on the physical layout of the database

26 ©Sang Ho Lee1.26Database System Concepts - 5 th Edition Overall Database System Structure

27 ©Sang Ho Lee1.27Database System Concepts - 5 th Edition Storage Management n Storage manager is a 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. n The storage manager is responsible to the following tasks: l Interaction with the file manager l Efficient storing, retrieving and updating of data n Issues: l Storage access l File organization l Indexing and hashing

28 ©Sang Ho Lee1.28Database System Concepts - 5 th Edition Query Processing (1/2) n Parsing and translation n Optimization n Evaluation

29 ©Sang Ho Lee1.29Database System Concepts - 5 th Edition Query Processing (2/2) n Alternative ways of evaluating a given query l Equivalent expressions l Different algorithms for each operation n Cost difference between a good and a bad way of evaluating a query can be enormous n Need to estimate the cost of operations l Depends critically on statistical information about relations which the database must maintain l Need to estimate statistics for intermediate results to compute cost of complex expressions

30 ©Sang Ho Lee1.30Database System Concepts - 5 th Edition Transaction Management n A transaction is 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.

31 ©Sang Ho Lee1.31Database System Concepts - 5 th Edition Database System Architecture The architecture of a database systems is greatly influenced by the underlying computer system on which the database is running: n Centralized n Client-server n Parallel (multi-processor) n Distributed

32 ©Sang Ho Lee1.32Database System Concepts - 5 th Edition Database Users Users are differentiated by the way they expect to interact with the system n Application programmers – interact with system through DML calls n Naïve users – invoke one of the permanent application programs that have been written previously l Examples, people accessing database over the web, bank tellers, clerical staff

33 ©Sang Ho Lee1.33Database System Concepts - 5 th 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 definition l Storage structure and access method definition l Schema and physical organization modification l Granting user authority to access the database n Specifying integrity constraints l Acting as liaison with users l Monitoring performance and responding to changes in requirements

34 ©Sang Ho Lee1.34Database System Concepts - 5 th Edition End of Chapter 1


Download ppt "©Sang Ho Lee1.1Database System Concepts - 5 th Edition Acknowledgement Fall 2010 Those slides are essentially based on the slides that come with “Database."

Similar presentations


Ads by Google