2. Database System Concepts and Architecture Chapter 2.

23
2. Database System Concepts and Architecture Chapter 2

Transcript of 2. Database System Concepts and Architecture Chapter 2.

Page 1: 2. Database System Concepts and Architecture Chapter 2.

2. Database System Concepts and Architecture

Chapter 2

Page 2: 2. Database System Concepts and Architecture Chapter 2.

2.1 Data Models, Schemas, and Instances

Data Model: A collection of concepts used to describe the structure of a database

Database Structure: Data types, relationships, and constraints on data

Database Schema: The description of the database (intension)

Schema Diagram: Diagrammatic representation of the DB schema

Schema Construct: An object in the schema

Database State/Instance: The data in the database at a particular moment in time (extension)

Page 3: 2. Database System Concepts and Architecture Chapter 2.

2.1 Data Models, Schemas, and Instances

Database schema Database Instance

Page 4: 2. Database System Concepts and Architecture Chapter 2.

2.1 Data Models, Schemas, and Instances

Schema diagram displays some aspects of the schema Data types and relationships are not evident

Define a new DB? Specify the DB schema DB state is the empty state

Populate DB with initial data? No changes in the schema DB state is the initial state

Subsequent update operations? No changes in the schema DB state changes into a new state

Page 5: 2. Database System Concepts and Architecture Chapter 2.

2.1 Data Models, Schemas, and Instances

DBMS ensures that every DB state is a valid state A state that satisfies the structure and constraints

specified in the schema

Special care must be taken when designing a DB schema A schema is not supposed to change frequently

A DBMS stores the meta-data Schema constructs and constraints

Page 6: 2. Database System Concepts and Architecture Chapter 2.

2.2 DBMS Architecture and Data Independence

DB architecture is specified using a three-schema architecture

Used to achieve the first 3 characteristics of DB approach

1. Separation between programs and data

2. Support of multiple user views

3. Use of catalog to store DB schema

Provides only a description of data

Page 7: 2. Database System Concepts and Architecture Chapter 2.

2.2.1 The Three-Schema Architecture

1. Physical (Internal) Level Has an internal schema Describes the physical storage structure of the DB

2. Logical (Conceptual) Level Has a conceptual schema Describes the structure of the whole DB (entities, data types,

relationships, user operations, and constraints) Hides details of the physical level

3. External (View) Level Has several external schemas or user views Each describes the part of the DB that a particular user is

interested in

Page 8: 2. Database System Concepts and Architecture Chapter 2.

2.2.1 The Three-Schema Architecture

Internal Schema

Conceptual Schema

ExternalView

ExternalView

mapping

mapping

mapping

Page 9: 2. Database System Concepts and Architecture Chapter 2.

2.2.2 Data Independence Data Independence

Ability to change the schema at one level of a DB system without having to change the schema at the next higher level

Result?1. Logical data independence

2. Physical data independence

Page 10: 2. Database System Concepts and Architecture Chapter 2.

2.2.2 Data Independence

1. Logical data independence Ability to change the conceptual schema without

having to change the external schemas or application programs

Changes? Expand the DB (add a record or data item) Reduce the DB (remove a record or data item) Changes to constraints

Page 11: 2. Database System Concepts and Architecture Chapter 2.

2.2.2 Data Independence

2. Physical data independence Ability to change the internal schema without

having to change the conceptual or external schemas

Changes? Reorganization of physical files

Page 12: 2. Database System Concepts and Architecture Chapter 2.

2.3.1 DBMS Languages

Data Definition Language (DDL) 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 DBMSs, separate storage definition language (SDL)andview definition language (VDL) are used to define internal and external schemas SDL is typically realized via DBMS commands provided to the DBA

and database designers

Page 13: 2. Database System Concepts and Architecture Chapter 2.

2.3.1 DBMS Languages

Data Manipulation Language (DML) Used to specify database retrievals and updates

DML commands (data sublanguage) can be embedded in a general-purpose programming language (host language), such as COBOL, C, C++, or Java. A library of functions can also be provided to access the DBMS from

a programming language

Alternatively, stand-alone DML commands can be applied directly (called a query language).

Page 14: 2. Database System Concepts and Architecture Chapter 2.

2.3.1 DBMS Languages

Data Manipulation Language (DML) DML Types:

High Level or Non-procedural Language For example, the SQL relational language Are “set”-oriented and specify what data to retrieve rather than

how to retrieve it. Also called declarative languages.

Low Level or Procedural Language Retrieve data one record-at-a-time; Constructs such as looping are needed to retrieve multiple records,

along with positioning pointers

Page 15: 2. Database System Concepts and Architecture Chapter 2.

2.3.2 DBMS Interfaces Menu-Based Interfaces

Popular for browsing the Web Forms-Based Interfaces

Designed for naïve users Graphical User Interfaces (GUI)

Point and Click, Drag and Drop, etc. Natural Language Interfaces

Requests are written in English Speech Input and Output

Speech used as input query and/or as query result Interfaces for Parametric Users

Ex: bank tellers using function keys Interfaces for the DBA

Commands used for Creating user accounts, granting authorizations, setting system parameters, changing schemas or access paths

Page 16: 2. Database System Concepts and Architecture Chapter 2.

2.4 The Database System Environment

Page 17: 2. Database System Concepts and Architecture Chapter 2.

2.5 DBMS Architectures1. Centralized DBMSs Architecture

Combines everything into single system including- DBMS software, hardware, application programs, and user interface processing software

User can still connect through a remote terminal – however, all processing is done at centralized site

Page 18: 2. Database System Concepts and Architecture Chapter 2.

2.5 DBMS Architectures2. Basic Client/Server Architectures

Specialized Servers with Specialized functions (Print server, File server, DBMS server, Web server, Email server)

Clients can access the specialized servers as needed

Page 19: 2. Database System Concepts and Architecture Chapter 2.

2.5 DBMS Architectures3. Two-Tier Client/Server Architectures

A client program may connect to several DBMSs, sometimes called the data sources

Data sources can be files or other non-DBMS software that manages data Other variations of clients are possible

Page 20: 2. Database System Concepts and Architecture Chapter 2.

2.5 DBMS Architectures4. Three-Tier and n-tier Architectures

Common for Web applications Intermediate Layer called Application Server or Web Server: Such an architecture can enhance security:

Database server only accessible via middle tier Clients cannot directly access database server

Page 21: 2. Database System Concepts and Architecture Chapter 2.

2.6 Classification of Database Management Systems

Several criteria are used Data Model

Traditional1. Relational data model

2. Network data model

3. Hierarchical data model Emerging

4. Object data model

5. Object-relational data model

Number of Users1. Single-user systems

2. Multi-user systems

Page 22: 2. Database System Concepts and Architecture Chapter 2.

2.6 Classification of Database Management Systems

Number of Sites1. Centralized DBMS

2. Distributed DBMS Homogeneous DDBMS Heterogeneous DDBMS Federated DBMS (multidatabase system)

Page 23: 2. Database System Concepts and Architecture Chapter 2.

Any Questions?