1 Chapter 2 Database Environment Pearson Education 2009.

36
1 Chapter 2 Database Environment Pearson Education © 2009

description

3 Chapter 2 - Objectives u Purpose/importance of conceptual modeling. u Typical functions and services a DBMS should provide. u Function and importance of system catalog. u Software components of a DBMS. u Meaning of client–server architecture and advantages of this type of architecture for a DBMS. u Function and uses of Transaction Processing Monitors. Pearson Education © 2009

Transcript of 1 Chapter 2 Database Environment Pearson Education 2009.

Page 1: 1 Chapter 2 Database Environment Pearson Education  2009.

1

Chapter 2

Database Environment

Pearson Education © 2009

Page 2: 1 Chapter 2 Database Environment Pearson Education  2009.

2

Chapter 2 - Objectives

Purpose of three-level database architecture. Contents of external, conceptual, and internal levels. Purpose of external/conceptual and

conceptual/internal mappings. Meaning of logical and physical data independence. Distinction between DDL and DML. A classification of data models.

Pearson Education © 2009

Page 3: 1 Chapter 2 Database Environment Pearson Education  2009.

3

Chapter 2 - Objectives

Purpose/importance of conceptual modeling. Typical functions and services a DBMS should

provide. Function and importance of system catalog. Software components of a DBMS. Meaning of client–server architecture and

advantages of this type of architecture for a DBMS.

Function and uses of Transaction Processing Monitors.

Pearson Education © 2009

Page 4: 1 Chapter 2 Database Environment Pearson Education  2009.

4

Objectives of Three-Level Architecture

All users should be able to access same data.

A user’s view is immune to changes made in other views.

Users should not need to know physical database storage details.

Pearson Education © 2009

Page 5: 1 Chapter 2 Database Environment Pearson Education  2009.

5

Objectives of Three-Level Architecture

DBA should be able to change database storage structures without affecting the users’ views.

Internal structure of database should be unaffected by changes to physical aspects of storage.

DBA should be able to change conceptual structure of database without affecting all users.

Pearson Education © 2009

Page 6: 1 Chapter 2 Database Environment Pearson Education  2009.

6

ANSI-SPARC Three-Level Architecture

Pearson Education © 2009

Page 7: 1 Chapter 2 Database Environment Pearson Education  2009.

7

ANSI-SPARC Three-Level Architecture

External Level– Users’ view of the database. – Describes that part of database that is relevant to a particular

user.– Entities, attributes, relationships : user interested.

Conceptual Level– Community view of the database. – Describes what data is stored in database and relationships

among the data. – Complete view of the data requirements of the organization:

independentof any storage considerations– Supports external views

Pearson Education © 2009

Page 8: 1 Chapter 2 Database Environment Pearson Education  2009.

8

ANSI-SPARC Three-Level Architecture

Internal Level– Physical representation of the database on

the computer. – Describes how the data is stored in the

database. – Physical implementation of the database to

achieve optimal runtime performance and storage utilization.

Pearson Education © 2009

Page 9: 1 Chapter 2 Database Environment Pearson Education  2009.

9

Differences between Three Levels of ANSI-SPARC Architecture

Pearson Education © 2009

Page 10: 1 Chapter 2 Database Environment Pearson Education  2009.

10

Differences between Three Levels of ANSI-SPARC Architecture

Pearson Education © 2009

UNIVERSITY Conceptual SchemaSTUDENT (Name, Student Number, Class, Major)COURSE (Course Name, Course Number, Credit, Dept)PREREQUISITE (Course Number, Prerequisite Number)SECTION (Section Id, Course Number, Semester, Year, Instructor)GRADE_REPORT(Student Number, Section Id , Grade)

UNIVERSITY External SchemaTRANSCRIPT(Student Name, Course Number, Grade, Semester, Year, Section Id) derived from STUDENT, SECTION, GRADE_REPORT

PREREQUISITES(Course Name, Course Number, Prerequisites) derived from PREREQUISITE, COURSE

Page 11: 1 Chapter 2 Database Environment Pearson Education  2009.

ANSI-SPARC Three-Level Architecture: Schemas

Pearson Education © 2009

Overall description of the database: Database schema specified during database design

3 different types of schema:– External (subschemas) – Conceptual – Internal

Only 1 conceptual & internal schema

Page 12: 1 Chapter 2 Database Environment Pearson Education  2009.

12

ANSI-SPARC Three-Level Architecture: Schemas

Pearson Education © 2009

Page 13: 1 Chapter 2 Database Environment Pearson Education  2009.

13

ANSI-SPARC Three-Level Architecture: Mappings

DBMS: – responsible for mapping between these schemas.– Check the schemas for consistency

Mappings:– Conceptual/Internal mapping

» Enables DBMS to find the actual record/combinations of records in physical storage && any constraints

– External/Conceptual mapping» Enables DBMS to map names in the user’s view to the relevant

part of the conceptual schema

Pearson Education © 2009

Page 14: 1 Chapter 2 Database Environment Pearson Education  2009.

14

Data Independence

Major objective of the three-level architecture: provide data independence.

Two types:– Logical– Physical

Pearson Education © 2009

Page 15: 1 Chapter 2 Database Environment Pearson Education  2009.

15

Data Independence

Logical Data Independence– Refers to immunity of external schemas to

changes in conceptual schema.– Conceptual schema changes (e.g.

addition/removal of entities/attributes/relationships).

– Should not require changes to external schema or rewrites of application programs.

Pearson Education © 2009

Page 16: 1 Chapter 2 Database Environment Pearson Education  2009.

16

Data Independence

Physical Data Independence– Refers to immunity of conceptual schema to

changes in the internal schema.– Internal schema changes (e.g. using different

file organizations, storage structures/devices).– Should not require change to conceptual or

external schemas.

Pearson Education © 2009

Page 17: 1 Chapter 2 Database Environment Pearson Education  2009.

17

Data Independence and the ANSI-SPARC Three-Level Architecture

Pearson Education © 2009

Page 18: 1 Chapter 2 Database Environment Pearson Education  2009.

18

Database Languages

Data Definition Language (DDL)– Allows the DBA or user to describe and

name entities, attributes, and relationships required for the application

– plus any associated integrity and security constraints.

Pearson Education © 2009

Page 19: 1 Chapter 2 Database Environment Pearson Education  2009.

19

Database Languages Data Manipulation Language (DML)

– Provides basic data manipulation operations on data held in the database.

Procedural DML – allows user to tell system exactly how to

manipulate data. Non-Procedural DML

– allows user to state what data is needed rather than how it is to be retrieved.

Fourth Generation Languages (4GLs)– nonprocedural

Pearson Education © 2009

Page 20: 1 Chapter 2 Database Environment Pearson Education  2009.

20

Database Languages Fourth Generation Languages (4GLs)

– Nonprocedural– Includes:

» Presentation languages – query languages, report generators

» Speciality languages – spreadsheets, database languages

» Application generators that define insert, update, retrieve data from the database to build applications

» Very high-level languages that are used too generate application code

Pearson Education © 2009

Page 21: 1 Chapter 2 Database Environment Pearson Education  2009.

21

Data Model

Integrated collection of concepts for describing data, relationships between data, and constraints on the data in an organization.

Representation of real world objects and events and their association.

Represents the organization itself

Pearson Education © 2009

Page 22: 1 Chapter 2 Database Environment Pearson Education  2009.

22

Data ModelData Model comprises:– a structural part

» a collection of data structures which are used to create databases representing the entities or objects modeled by the database.

» A set of rules according to which databases can be constructed 

– a manipulative part» a collection of operators which can be applied to the data structures, to

update and query the data contained in the database.» Defining the types of operation that are allowed on the data.

– possibly a set of integrity rules» a collection of rules governing the constraints placed on these data

structures to ensure structural integrity.» Ensures that the data is accurate

Pearson Education © 2009

Page 23: 1 Chapter 2 Database Environment Pearson Education  2009.

23

Data Model

Purpose– To represent data in an understandable way.– Can be used to design a database.

Categories of data models include:– Object-based– Record-based– Physical

Pearson Education © 2009

Describe data at the conceptual & external levels

Describe data at the internal level

Page 24: 1 Chapter 2 Database Environment Pearson Education  2009.

24

Data Models: Object-Based Data Models

Use concept such as entities, attributes and relationships.

Some of the common types of object-based data model:– Entity-Relationship (ER)– Semantic – Functional– Object-Oriented.

Pearson Education © 2009

Page 25: 1 Chapter 2 Database Environment Pearson Education  2009.

25

Data Models: Record-Based Data Models

Database consists of a number of fixed-format records Each record type defines a fixed number of fields –

fixed length Three types:

– Relational Data Model– Network Data Model– Hierarchical Data Model.

Pearson Education © 2009

Page 26: 1 Chapter 2 Database Environment Pearson Education  2009.

26

Relational Data Model

Pearson Education © 2009

Page 27: 1 Chapter 2 Database Environment Pearson Education  2009.

27

Network Data Model

Pearson Education © 2009

Page 28: 1 Chapter 2 Database Environment Pearson Education  2009.

28

Hierarchical Data Model

Pearson Education © 2009

Page 29: 1 Chapter 2 Database Environment Pearson Education  2009.

29

Data Models: Physical Data Models

Describe how data is stored in the computer Representing information such as record structures,

record orderings and access paths.

Pearson Education © 2009

Page 30: 1 Chapter 2 Database Environment Pearson Education  2009.

30

Conceptual Modeling

Conceptual schema is the core of a system supporting all user views.

Should be complete and accurate representation of an organization’s data requirements.

Conceptual modeling is process of developing a model of information use that is independent of implementation details.

Result is a conceptual data model.– Also referred as logical model

Pearson Education © 2009

Page 31: 1 Chapter 2 Database Environment Pearson Education  2009.

31

Functions of a DBMS Data Storage, Retrieval, and Update.

– Fundamental capability of a DBMS– A DBMS must furnish users with the ability to store, retrieve and

update data in the database A User-Accessible Catalog.

– A DBMS must furnish a catalog in which descriptions of data items are stored and which is accessible to users

– System catalog stores:» Names, types and sizes of data items» Names of relationships» Integrity constraints» Names of authorized users» Data items that user can access and types of access allowed» External, conceptual and internal schemas and the mappings between the

schemas» Usage statistics

Pearson Education © 2009

Page 32: 1 Chapter 2 Database Environment Pearson Education  2009.

32

Functions of a DBMS Transaction Support.

– A DBMS must furnish a mechanism that will ensure either that all the updates corresponding to a given transaction are made or that none of them is made

Concurrency Control Services.– A DBMS must furnish a mechanism to ensure that the database is

updated correctly when multiple users are updating the database concurrently

Pearson Education © 2009

Page 33: 1 Chapter 2 Database Environment Pearson Education  2009.

33

Functions of a DBMS Recovery Services.

– A DBMS must furnish a mechanism for recovering the database in the event that the database is damaged in anyway.

– Database has to be returned to a consistent state. Authorization Services.

– A DBMS must furnish a mechanism to ensure that only authorized users can access the database.

Support for Data Communication.– A DBMS must be capable of integrating with communication

software.– DBMS should be capable to integrate with a variety of Data

Communication Manager (DCM).

Pearson Education © 2009

Page 34: 1 Chapter 2 Database Environment Pearson Education  2009.

34

Functions of a DBMS Integrity Services.

– A DBMS must furnish a means to ensure that both the data in the database and changes to the data follow certain rules.

– Database integrity: correctness and consistency of stored data.– Integrity:

» Concerned with the quality of data.» Expressed in terms of constraints.

Services to Promote Data Independence.– A DBMS must include facilities to support the independence of

programs from the actual structure of the database

Pearson Education © 2009

Page 35: 1 Chapter 2 Database Environment Pearson Education  2009.

35

Functions of a DBMS Utility Services.

– A DBMS should provide a set of utility services.– Help DBA administer the database effectively– Example:

» Import/export facilities» Monitoring facilities» Statistical analysis programs» Index reorganization facilities

Pearson Education © 2009

Page 36: 1 Chapter 2 Database Environment Pearson Education  2009.

36

System Catalog

Repository of information (metadata) describing the data in the database.

One of the fundamental components of DBMS. Typically stores:

– names, types, and sizes of data items;– constraints on the data;– names of authorized users;– data items accessible by a user and the type of

access;– usage statistics.

Pearson Education © 2009