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



Similar documents
Chapter 1: Introduction

1 File Processing Systems

Chapter 1: Introduction. Database Management System (DBMS)

Database System Concepts

ECS 165A: Introduction to Database Systems

Introduction to database management systems

Lesson 8: Introduction to Databases E-R Data Modeling

Database Concepts. Database & Database Management System. Application examples. Application examples

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

Chapter 1: Introduction


BCA. Database Management System

DATABASE MANAGEMENT SYSTEM

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

Chapter 2 Database System Concepts and Architecture

Core Syllabus. Version 2.6 B BUILD KNOWLEDGE AREA: DEVELOPMENT AND IMPLEMENTATION OF INFORMATION SYSTEMS. June 2006

DATABASE SYSTEM CONCEPTS AND ARCHITECTURE CHAPTER 2

Author: Abhishek Taneja

What is a database? COSC 304 Introduction to Database Systems. Database Introduction. Example Problem. Databases in the Real-World

B.Com(Computers) II Year RELATIONAL DATABASE MANAGEMENT SYSTEM Unit- I

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

? Database Management

Chapter 1 File Organization 1.0 OBJECTIVES 1.1 INTRODUCTION 1.2 STORAGE DEVICES CHARACTERISTICS

CSE 132A. Database Systems Principles

Chapter 1 Databases and Database Users

Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 1 Outline

Database Management Systems

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

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

Database Management System

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

Principles of Database. Management: Summary

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

Introduction to Database Systems

Overview of Data Management

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

CHAPTER 6 DATABASE MANAGEMENT SYSTEMS. Learning Objectives

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

Files. Files. Files. Files. Files. File Organisation. What s it all about? What s in a file?

Introduction: Database management system

Database Systems Introduction Dr P Sreenivasa Kumar

Chapter 9 Political Enterprise Database Management System (PDBHS or PEDBHS)

COMP5138 Relational Database Management Systems. Databases are Everywhere!

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

Overview of Database Management

COMPONENTS in a database environment

Chapter 13 File and Database Systems

Chapter 13 File and Database Systems

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

Foundations of Information Management

Databases What the Specification Says

Concepts of Database Management Seventh Edition. Chapter 7 DBMS Functions

B.Sc (Computer Science) Database Management Systems UNIT-V

Chapter 1. Database Systems. Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel

CHAPTER. Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTION. Database Planning and Database Architecture

2) What is the structure of an organization? Explain how IT support at different organizational levels.

IT2305 Database Systems I (Compulsory)

1. INTRODUCTION TO RDBMS

CSE 233. Database System Overview

DATABASE DESIGN AND IMPLEMENTATION USING VISUAL BASIC

CHAPTER 2 DATABASE MANAGEMENT SYSTEM AND SECURITY


Relational Database Systems 2 1. System Architecture

Foreign and Primary Keys in RDM Embedded SQL: Efficiently Implemented Using the Network Model

Introduction. Chapter 1. Introducing the Database. Data vs. Information

Database Management. Chapter Objectives

Foundations of Business Intelligence: Databases and Information Management

SQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases.

Relational Database Basics Review

Database Management. Technology Briefing. Modern organizations are said to be drowning in data but starving for information p.

Unit 2.1. Data Analysis 1 - V Data Analysis 1. Dr Gordon Russell, Napier University

Database Fundamentals: 1

not necessarily strictly sequential feedback loops exist, i.e. may need to revisit earlier stages during a later stage

Chapter 6: Physical Database Design and Performance. Database Development Process. Physical Design Process. Physical Database Design

MODULE 8 LOGICAL DATABASE DESIGN. Contents. 2. LEARNING UNIT 1 Entity-relationship(E-R) modelling of data elements of an application.

Chapter 1 - Database Systems

Study Notes for DB Design and Management Exam 1 (Chapters 1-2-3) record A collection of related (logically connected) fields.

IT2304: Database Systems 1 (DBS 1)

Course MIS. Foundations of Business Intelligence

Oracle Database 10g: Introduction to SQL

Data Analysis 1. SET08104 Database Systems. Napier University

Basic Concepts of Database Systems

Answers to Review Questions

Chapter 2. Data Model. Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel

Database Programming with PL/SQL: Learning Objectives

Chapter 6 FOUNDATIONS OF BUSINESS INTELLIGENCE: DATABASES AND INFORMATION MANAGEMENT Learning Objectives

Chapter 1. The Worlds of Database. Systems. Databases today are essential to every business. They are used to maintain

Maintaining Stored Procedures in Database Application

1.264 Lecture 15. SQL transactions, security, indexes

Types & Uses of Databases

Overview. Physical Database Design. Modern Database Management McFadden/Hoffer Chapter 7. Database Management Systems Ramakrishnan Chapter 16

Database System. Session 1 Main Theme Introduction to Database Systems Dr. Jean-Claude Franchitti

Contents RELATIONAL DATABASES

LOGICAL DATABASE DESIGN

CC414 Database Management Systems

1 Database Systems. Computers are now used in almost all aspects of human activity. One of their main. 1.1 The Main Principles

Availability Digest. Raima s High-Availability Embedded Database December 2011

Transcription:

CMPT-354-Han-95.3 Lecture Notes September 10, 1995 Chapter 1 Introduction 1.0 Database Management Systems 1. A database management system èdbmsè, or simply a database system èdbsè, consists of æ A collection of interrelated and persistent data èusually referred to as the database èdbèè. æ A set of application programs used to access, update and manage that data èwhich form the data management system èmsèè. 2. The goal of a DBMS is to provide an environment that is both convenient and eæcient to use in æ Retrieving information from the database. æ Storing information into the database. 3. Databases are usually designed to manage large bodies of information. This involves æ Deænition of structures for information storage èdata modelingè. æ Provision of mechanisms for the manipulation of information èæle and systems structure, query processingè. æ Providing for the safety of information in the database ècrash recovery and securityè. æ Concurrency control if the system is shared by users. 1.1 Purpose of Database Systems 1. To see why database management systems are necessary, let's look at a typical ëæle-processing system" supported by a conventional operating system. The application is a savings bank: æ Savings account and customer records are kept in permanent system æles. æ Application programs are written to manipulate æles to perform the following tasks: í Debit or credit an account. í Add a new account. í Find an account balance. í Generate monthly statements. 2. Development of the system proceeds as follows: æ New application programs must be written as the need arises. æ New permanent æles are created as required. 1

2 CHAPTER 1. INTRODUCTION æ but over a long period of time æles may be in diæerent formats, and æ Application programs may be in diæerent languages. 3. So we can see there are problems with the straight æle-processing approach: æ Data redundancy and inconsistency í Same information may be duplicated in several places. í All copies may not be updated properly. æ Diæculty in accessing data í May have to write a new application program to satisfy an unusual request. í E.g. ænd all customers with the same postal code. í Could generate this data manually, but a long job... æ Data isolation í Data in diæerent æles. í Data in diæerent formats. í Diæcult to write new application programs. æ Multiple users í Want concurrency for faster response time. í Need protection for concurrent updates. í E.g. two customers withdrawing funds from the same account at the same time account has $500 in it, and they withdraw $100 and $50. The result could be $350, $400 or $450 if no protection. æ Security problems í Every user of the system should be able to access only the data they are permitted to see. í E.g. payroll people only handle employee records, and cannot see customer accounts; tellers only access account data and cannot see payroll data. í Diæcult to enforce this with application programs. æ Integrity problems í Data may be required to satisfy constraints. í E.g. no account balance below $25.00. í Again, diæcult to enforce or to change constraints with the æle-processing approach. These problems and others led to the development of database management systems. 1.2 Data Abstraction 1. The major purpose of a database system is to provide users with an abstract view of the system. The system hides certain details of how data is stored and maintained Complexity should be hidden from database users. 2. There are several levels of abstraction: èaè Physical Level: æ How the data are stored. æ E.g. index, B-tree, hashing. æ Lowest level of abstraction. æ Complex low-level structures described in detail. èbè Conceptual Level: æ Next highest level of abstraction.

1.3. DATA MODELS 3... view 1 view 2 view n conceptual level physical level Figure 1.1: The three levels of data abstraction æ Describes what data are stored. æ Describes the relationships among data. æ Database administrator level. ècè View Level: æ Highest level. æ Describes part of the database for a particular group of users. æ Can be many diæerent views of a database. æ E.g. tellers in a bank get a view of customer accounts, but not of payroll data. Fig.?? èægure 1.1 in the textè illustrates the three levels. 1.3 Data Models 1. Data models are a collection of conceptual tools for describing data, data relationships, data semantics and data constraints. There are three diæerent groups: èaè Object-based Logical Models. èbè Record-based Logical Models. ècè Physical Data Models. We'll look at them in more detail now. 1.3.1 Object-based Logical Models 1. Object-based logical models: æ Describe data at the conceptual and view levels. æ Provide fairly æexible structuring capabilities. æ Allow one to specify data constraints explicitly. æ Over 30 such models, including í Entity-relationship model.

4 CHAPTER 1. INTRODUCTION street name city number balance customer CustAcct account Figure 1.2: A sample E-R diagram. í Object-oriented model. í Binary model. í Semantic data model. í Infological model. í Functional data model. 2. At this point, we'll take a closer look at the entity-relationship èe-rè and object-oriented models. The E-R Model 1. The entity-relationship model is based on a perception of the world as consisting of a collection of basic objects èentitiesè and relationships among these objects. æ An entity is a distinguishable object that exists. æ Each entity has associated with it a set of attributes describing it. æ E.g. number and balance for an account entity. æ A relationship is an association among several entities. æ e.g. A cust acct relationship associates a customer with each account he or she has. æ The set of all entities or relationships of the same type is called the entity set or relationship set. æ Another essential element of the E-R diagram is the mapping cardinalities, which express the number of entities to which another entity can be associated via a relationship set. We'll see later how well this model works to describe real world situations. 2. The overall logical structure of a database can be expressed graphically by an E-R diagram: æ rectangles: represent entity sets. æ ellipses: represent attributes. æ diamonds: represent relationships among entity sets. æ lines: link attributes to entity sets and entity sets to relationships. See ægure?? for an example. The Object-Oriented Model 1. The object-oriented model is based on a collection of objects, like the E-R model. æ An object contains values stored in instance variables within the object. æ Unlike the record-oriented models, these values are themselves objects.

1.3. DATA MODELS 5 æ Thus objects contain objects to an arbitrarily deep level of nesting. æ An object also contains bodies of code that operate on the the object. æ These bodies of code are called methods. æ Objects that contain the same types of values and the same methods are grouped into classes. æ A class may be viewed as a type deænition for objects. æ Analogy: the programming language concept of an abstract data type. æ The only way in which one object can access the data of another object is by invoking the method of that other object. æ This is called sending a message to the object. æ Internal parts of the object, the instance variables and method code, are not visible externally. æ Result is two levels of data abstraction. For example, consider an object representing a bank account. æ The object contains instance variables number and balance. æ The object contains a method pay-interest which adds interest to the balance. æ Under most data models, changing the interest rate entails changing code in application programs. æ In the object-oriented model, this only entails a change within the pay-interest method. 2. Unlike entities in the E-R model, each object has its own unique identity, independent of the values it contains: æ Two objects containing the same values are distinct. æ Distinction is maintained in physical level by assigning distinct object identiæers. 1.3.2 Record-based Logical Models 1. Record-based logical models: æ Also describe data at the conceptual and view levels. æ Unlike object-oriented models, are used to í Specify overall logical structure of the database, and í Provide a higher-level description of the implementation. æ Named so because the database is structured in æxed-format records of several types. æ Each record type deænes a æxed number of æelds, or attributes. æ Each æeld is usually of a æxed length èthis simpliæes the implementationè. æ Record-based models do not include a mechanism for direct representation of code in the database. æ Separate languages associated with the model are used to express database queries and updates. æ The three most widely-accepted models are the relational, network, and hierarchical. æ This course will concentrate on the relational model. æ The network and hierarchical models are covered in appendices in the text. The Relational Model æ Data and relationships are represented by a collection of tables. æ Each table hasanumber of columns with unique names, e.g. customer, account. æ Figure?? shows a sample relational database.

6 CHAPTER 1. INTRODUCTION name street city number Lowery Maple Queens 900 Shiver North Bronx 556 Shiver North Bronx 647 Hodges Sidehill Brooklyn 801 Hodges Sidehill Brooklyn 647 name balance 900 55 556 100000 647 105366 801 10533 Figure 1.3: A sample relational database. Lowery Maple Queens 900 55 Shiver North Bronx 556 647 100000 105366 Hodges Sidehill Brooklyn 801 10533 Figure 1.4: A sample network database The Network Model æ Data are represented by collections of records. æ Relationships among data are represented by links. æ Organization is that of an arbitrary graph. æ Figure?? shows a sample network database that is the equivalent of the relational database of Figure??. The Hierarchical Model æ Similar to the network model. æ Organization of the records is as a collection of trees, rather than arbitrary graphs. æ Figure?? shows a sample hierarchical database that is the equivalent of the relational database of Figure??. Lowery Maple Queens Hodges Sidehill Brooklyn Shiver North Bronx 900 55 647 105366 801 10533 556 100000 647 105366 Figure 1.5: A sample hierarchical database

1.4. INSTANCES AND SCHEMES 7 The relational model does not use pointers or links, but relates records by the values they contain. This allows a formal mathematical foundation to be deæned. 1.3.3 Physical Data Models 1. Are used to describe data at the lowest level. 2. Very few models, e.g. æ Unifying model. æ Frame memory. 3. We will not cover physical models. 1.4 Instances and Schemes 1. Databases change over time. 2. The information in a database at a particular point in time is called an instance of the database. 3. The overall design of the database is called the database scheme. 4. Analogy with programming languages: æ Data type deænition í scheme æ Value of a variable í instance 5. There are several schemes, corresponding to levels of abstraction: æ Physical scheme æ Conceptual scheme æ Subscheme ècan be manyè 1.5 Data Independence 1. The ability to modify a scheme deænition in one level without aæecting a scheme deænition in a higher level is called data independence. 2. There are two kinds: æ Physical data independence í The ability to modify the physical scheme without causing application programs to be rewritten í Modiæcations at this level are usually to improve performance æ Logical data independence í The ability to modify the conceptual scheme without causing application programs to be rewritten í Usually done when logical structure of database is altered 3. Logical data independence is harder to achieve as the application programs are usually heavily dependent on the logical structure of the data. An analogy is made to abstract data types in programming languages. 1.6 Data Deænition Language èddlè 1. Used to specify a database scheme as a set of deænitions expressed in a DDL 2. DDL statements are compiled, resulting in a set of tables stored in a special æle called a data dictionary or data directory.

8 CHAPTER 1. INTRODUCTION 3. The data directory contains metadata èdata about dataè 4. The storage structure and access methods used by the database system are speciæed by a set of deænitions in a special type of DDL called a data storage and deænition language 5. basic idea: hide implementation details of the database schemes from the users 1.7 Data Manipulation Language èdmlè 1. Data Manipulation is: æ retrieval of information from the database æ insertion of new information into the database æ deletion of information in the database æ modiæcation of information in the database 2. A DML is a language which enables users to access and manipulate data. The goal is to provide eæcient human interaction with the system. 3. There are two types of DML: æ procedural: the user speciæes what data is needed and how to get it æ nonprocedural: the user only speciæes what data is needed í Easier for user í May not generate code as eæcient as that produced by procedural languages 4. A query language is a portion of a DML involving information retrieval only. The terms DML and query language are often used synonymously. 1.8 Database Manager 1. The database manager is a program module which provides the interface between the low-level data stored in the database and the application programs and queries submitted to the system. 2. Databases typically require lots of storage space ègigabytesè. This must be stored on disks. Data is moved between disk and main memory èmmè as needed. 3. The goal of the database system is to simplify and facilitate access to data. Performance is important. Views provide simpliæcation. 4. So the database manager module is responsible for æ Interaction with the æle manager: Storing raw data on disk using the æle system usually provided by a conventional operating system. The database manager must translate DML statements into low-level æle system commands èfor storing, retrieving and updating data in the databaseè. æ Integrity enforcement: Checking that updates in the database do not violate consistency constraints èe.g. no bank account balance below $25è æ Security enforcement: Ensuring that users only have access to information they are permitted to see æ Backup and recovery: Detecting failures due to power failure, disk crash, software errors, etc., and restoring the database to its state before the failure æ Concurrency control: Preserving data consistency when there are concurrent users. 5. Some small database systems may miss some of these features, resulting in simpler database managers. èfor example, no concurrency is required on a PC running MS-DOS.è These features are necessary on larger systems.

1.9. DATABASE ADMINISTRATOR 9 1.9 Database Administrator 1. The database administrator is a person having central control over data and programs accessing that data. Duties of the database administrator include: æ Scheme deænition: the creation of the original database scheme. This involves writing a set of deænitions in a DDL èdata storage and deænition languageè, compiled by the DDL compiler into a set of tables stored in the data dictionary. æ Storage structure and access method deænition: writing a set of deænitions translated by the data storage and deænition language compiler æ Scheme and physical organization modiæcation: writing a set of deænitions used by the DDL compiler to generate modiæcations to appropriate internal system tables èe.g. data dictionaryè. This is done rarely, but sometimes the database scheme or physical organization must be modiæed. æ Granting of authorization for data access: granting diæerent types of authorization for data access to various users æ Integrity constraint speciæcation: generating integrity constraints. database manager module whenever updates occur. These are consulted by the 1.10 Database Users 1. The database users fall into several categories: æ Application programmers are computer professionals interacting with the system through DML calls embedded in a program written in a host language èe.g. C, PLè1, Pascalè. í These programs are called application programs. í The DML precompiler converts DML calls èprefaced by a special character like $, è, etc.è to normal procedure calls in a host language. í The host language compiler then generates the object code. í Some special types of programming languages combine Pascal-like control structures with control structures for the manipulation of a database. í These are sometimes called fourth-generation languages. í They often include features to help generate forms and display data. æ Sophisticated users interact with the system without writing programs. í They form requests by writing queries in a database query language. í These are submitted to a query processor that breaks a DML statement down into instructions for the database manager module. æ Specialized users are sophisticated users writing special database application programs. These may be CADD systems, knowledge-based and expert systems, complex data systems èaudioèvideoè, etc. æ Naive users are unsophisticated users who interact with the system by using permanent application programs èe.g. automated teller machineè. 1.11 Overall System Structure 1. Database systems are partitioned into modules for diæerent functions. Some functions èe.g. æle systemsè may be provided by the operating system. 2. Components include: æ File manager manages allocation of disk space and data structures used to represent information on disk.

10 CHAPTER 1. INTRODUCTION naive application sophisticated database users programmers users administrator application interfaces application program query database scheme DML query DDL precompiler processor compiler application program object code database manager file manager data files disk storage data dictionary Figure 1.6: Database system structure. æ Database manager: The interface between low-level data and application programs and queries. æ Query processor translates statements in a query language into low-level instructions the database manager understands. èmay also attempt to ænd an equivalent but more eæcient form.è æ DML precompiler converts DML statements embedded in an application program to normal procedure calls in a host language. The precompiler interacts with the query processor. æ DDL compiler converts DDL statements to a set of tables containing metadata stored in a data dictionary. In addition, several data structures are required for physical system implementation: æ Data æles: store the database itself. æ Data dictionary: stores information about the structure of the database. It is used heavily. Great emphasis should be placed on developing a good design and eæcient implementation of the dictionary. æ Indices: provide fast access to data items holding particular values. 3. Figure?? shows these components.