25
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems (Chapter 2: Database System Concepts and Architecture)

Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Embed Size (px)

DESCRIPTION

2 Data Models A collection of concepts that can be used to describe the structure of a database. Provides the means to achieve data abstraction by hiding unneeded details of data storage. Most data models include a set of basic operations for specifying retrievals and updates on the database. Some data models include concepts for specifying the dynamic aspects or behavior of a database application. Data model examples: hierarchical model, network model, relational model, object oriented model. Chapter 2: Database System Concepts and Architecture Data types, relationships and constraints

Citation preview

Page 1: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Riyadh Philanthropic Society For Science

Prince Sultan College For WomanDept. of Computer & Information Sciences

CS 340Introduction to Database Systems

(Chapter 2: Database System Concepts and Architecture)

Page 2: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture 1

Outline• Data Models• Categories of Data Models• Schemas,Instances, and Database State• Three-Schema Architecture & Data Independence• Database Languages• DBMS Interfaces• DBMS Component Modules• Database System Utilities• Tools, Application Environments, & Communication Facilities• Client/Server DBMS Architecture• Classification of Database Management Systems• Reading: Chapter 2

Page 3: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

2

Data Models• A collection of concepts that can be used to describe the structure of a database.

• Provides the means to achieve data abstraction by hiding unneeded details of data storage.

• Most data models include a set of basic operations for specifying retrievals and updates on the database.

• Some data models include concepts for specifying the dynamic aspects or behavior of a database application.

• Data model examples: hierarchical model, network model, relational model, object oriented model.

Chapter 2: Database System Concepts and Architecture

Data types, relationships and constraints

Page 4: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture 3

Categories of Data Models• Data models can be categorized according to the types of concepts they use to describe the database structure:

• Conceptual (High-level, semantic) data models:• Provide concepts close to the way users perceive data.

• Physical (Low-level, internal) data models:• Provide concepts that describe the details of how data is stored in the computer.

• Implementation (Representational) data models:• Provide concepts that fall between the above two, balancing user views with some computer storage details.

Page 5: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture 4

Categories of Data Models• Conceptual data models use concepts such as entities, attributes and relationships.

• An entity represents a real-world object or concept such as an employee or a project.• An attribute represents some property of interest that further describes an entity such as the employee’s name or salary.• A relationship among two or more entities represents an association among two or more entities such as a works-on relationship between an employee and a project.

Page 6: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture 5

Categories of Data Models• Physical data models describe how data is stored in the computer by representing information such as record formats, record ordering, and access paths.

• Implementation data model:• The most frequently used model in traditional commercial DBMSs.• Includes the widely used relational data model, as well as the network, and the hierarchical models.• Represents data by using record structures.

Page 7: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

6

Schemas, Instances, and Database State• It is important to distinguish between the description of a database and the database itself.

• The description of a database is called the database schema, which is specified during database design and is not expected to change frequently.

• A displayed schema is called a schema diagram.

• Each object in the schema is called a schema construct.

• Schema diagram does not display the actual instances of records.Chapter 2: Database System Concepts and Architecture

Name StudentNumber Class Major

CourseName CourseNumber CreditHours Department

STUDENT

COURSE

Page 8: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Schemas, Instances, and Database State• The data in a database at a particular moment is called the database state or the database instance.

STUDENT

• Every time we insert or delete a record we change the state of a database.

• The schema change is called schema evolution.

7Chapter 2: Database System Concepts and Architecture

Name StudentNumber Class MajorSmith 17 1 CSBrown 8 2 CS

Page 9: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture

Three-Schema Architecture & Data Independence • A three schema architecture is an architecture that is proposed to help in achieving & visualizing the following three important characteristics:

• Program-data independence.• Support of multiple user views.• Use of catalog to store the data description.

8

Page 10: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture

The Three-Schema Architecture• Schemas can be defined at the following three levels:

• The internal level internal schema• Describes the physical storage of the database (e.g. indexes).• Uses a physical data model.

• The conceptual level conceptual schema• Describes the structure of the whole database for users.• Hides the details of physical storage structure.• Concentrates on describing entities, data types, relationships, user operations, and constraints.• Uses a conceptual or an implementation data model.

• The external (view) level # of external schemas/user views

• Each describes the part of the database that a particular user group is interested in and hides the rest.• Uses the same data model as the conceptual level.

9

Page 11: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

The Three-Schema Architecture

END USERS

EXTERNAL LEVEL ...

external/conceptual mapping

CONCEPTUAL LEVEL

conceptual/internalmapping

INTERNAL LEVEL

10Chapter 2: Database System Concepts and Architecture

Externalview

Externalview

Conceptual schema

Internal schema

STORED DATABASE

Page 12: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture

Data Independence• The capacity to change the schema at one level of a database system without having to change the schema at the next higher level.

• There are two types of independence:• Logical data independence:

• The capacity to change the conceptual schema without having to change external schemas or application programs (expand or reduce).

• Physical data independence:• The capacity to change the internal schema without having to change the conceptual schema or external schemas.

• The two levels of mappings create an overhead during execution of a query, leading to inefficiencies in the DBMS Few DBMS have implemented the full three-schema architecture.

11

Page 13: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Database Languages• Data Definition Language (DDL) is used by the DBA and database designers to specify the conceptual schema of a database.

• In many DBMSs, the DDL is also used to define internal and external schemas (views).

• In some DBMS, separate Storage Definition Language (SDL) and View Definition Language (VDL) are used to define internal and external schemas.

12Chapter 2: Database System Concepts and Architecture

Page 14: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture

Database Languages• Once the database is populated with data a Data Manipulation Language (DML) is used to manipulate data.

• In current DBMSs, the preceding types of languages are usually not considered distinct languages; rather a comprehensive integrated language is used.

• The Structured Query Language (SQL) is a typical example of comprehensive relational database language.

13

Page 15: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture

DBMS Interfaces• Stand alone query language interface.

• Programmer interfaces for embedding DML in programming languages.

• User friendly interfaces provided by DBMS may include the following:

• Menu-Based interfaces for web clients or browsing:• Present the user with lists of options, called menus, that lead the user through the formulation of a request.

• Forms-based interfaces:• Users can fill out some of the form entries and the DBMS will retrieve matching data for the remaining entries.

14

Page 16: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture

DBMS Interfaces• Graphical user interfaces:

• Displays a schema to the user in a diagrammatic form.• The user can then specify a query by manipulating the diagram.

• Natural language interfaces:• These interfaces accept requests written in English.

• Speech Input and Output:• Limited use of speech as an input query and speech as an answer to a question or result of a request is becoming commonplace.

• Interfaces for parametric users:• Repeated work.

• Interfaces for the DBAs:• Privileged commands.

15

Page 17: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture

DBMS Component Modules• The database and DBMS catalog are usually stored on disk. Access to the disk is controlled by the operating system (OS).

• A higher-level, stored data manager module (component) controls access to DBMS information that is stored on disk.

• The DDL compiler processes schema definitions, specified in the DDL, and stores descriptions of schemas in the DBMS catalog which include information such as table names, data items, mapping into many schemas and constraints.

• The query compiler handles high-level queries that are entered interactively.

16

Page 18: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture

DBMS Component Modules• The query optimizer is concerned with rearrangement and possible reordering of operations, elimination of redundancies, and use of correct algorithms and indexes during execution.

• The precompiler extracts DML commands from an application program written in a host programming language. These commands are sent to the DML compiler for compilation into object code for database access. The rest of the program is sent to the host language compiler.

• The runtime database processor handles database access at runtime; it receives retrieval or update operations and carries them out on the database.

17

Page 19: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture

Component Modules of a DBMS & Their Interactions

18

Stored database

Stored datamanagerConcurrency control/

backup/recovery subsystems

Runtimedatabase processor

Querycompiler

DMLcompiler

DDLcompiler

Hostlanguage compiler

Privilegedcommands

DDLstatements

Interactivequery

Applicationprograms

Precompiler

Systemcatalog/

data dictionary

Compiledtransactions

DBA Commands, Queries, and Transactions

DBA staff Causal users Parametric usersApplication programmers

QueryOptimizer

Input/Output from Database

Page 20: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture

Database System Utilities• Most DBMSs have database utilities that help the DBA in managing the database:

• Loading:• Used to load existing data files into the database (e.g. Text files).• The source & target structure are specified to the utility which reformats & stores data.

• Backup:• Backup copy of the database, usually by dumping the entire data onto tape.• It can then be used to restore data in case of disaster.

• Database storage reorganization: • Reorganize a set of database files into a different file organization to improve performance.

19

Page 21: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture

Database System Utilities• Performance monitoring:

• Monitors database usage and provides statistics for decision making.

• Sorting files.• Handling data compression.• Monitoring access by users.• Interfacing with the network.

20

Page 22: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture

Tools, Application Environments, & Communication Facilities

• Tools available to database designers, users, and DBAs include:• CASE tools which are used in the design phase.• Data dictionary (data repository) to store catalog information and others such as design decisions, usage standards, application program descriptions, and user information.

• Application development environments:• PowerBuilder designer...etc are becoming quite popular because of their features in database design, GUI development, querying & updating, and application program development.

• Communication facilities:• Communications software, which allows users to access remote databases. 21

Page 23: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture

Client/Server DBMS Architecture• The architecture of DBMS packages has evolved.

DBMS software package was onetightly integrated

system

DBMS software packagesbecame modular in design, with a client/server system

architecture

Large centralized mainframecomputers

Hundreds of distributed workstations & PCs connected

via communications networks to various types of server machines

22

Page 24: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture

Client/Server DBMS Architecture• In a basic client/server DBMS architecture:

• The system functionality is distributed between two types of modules.• A client module is typically designed so that it will run on a user workstation or PC.• Application programs and user interfaces that access the database run in the client module.• A server module handles data storage, Access, search, and other functions.

23

Page 25: Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems

Chapter 2: Database System Concepts and Architecture

Classification of Database Management Systems• Several criteria are used to classify DBMSs:

• Data model on which DBMS is based. • Two types are currently used, the relational data model and the object oriented model.

• Number of users supported by the system.• Singular systems and multi-user systems

• Number of sites over which the database is distributed.• A DBMS is centralized if the data is stored at a single computer site.• A distributed DBMS (DDBMS) can have actual database and DBMS at multiple sites.

• The cost of the DBMS.• The type of access path for storing files.• General purpose or special purpose.

24