Data Environment

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 49

Chapter 2

Database Environment
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 © 2014 2


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 © 2014 3
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.

4
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.
5
The Three-Level ANSI-SPARC Architecture

 The ANSI-SPARC Architecture, often referred to as


the three-schema architecture, is a conceptual
framework for database management systems
(DBMS).

 It was developed by the American National


Standards Institute Standards Planning And
Requirements Committee (ANSI-SPARC) in the late
1970s.

 The architecture provides a clear separation


between the user interface, the logical view, and
the physical storage of data in a database system
The three main components of the ANSI-SPARC
Architecture are:

1.External Schema (User View):

 This schema represents how the data is


viewed by the end users or applications.

 It defines the views or user interfaces that


different users or applications see.

 The external schema is specific to each user or


application and focuses on their particular
data requirements.
2. Conceptual Schema (Logical View):

The conceptual schema represents the logical


structure of the entire database.

It provides an abstract view of the data model


without concerning itself with how the data is
physically stored or accessed.

The conceptual schema is independent of the


specific DBMS implementation and serves as a
bridge between the external and internal
schemas.
3. Internal Schema (Physical Storage
View):

The internal schema describes how data is


stored, indexed, and accessed at the physical
level.

It defines the storage structures, access


paths, and techniques for efficient retrieval
and modification of data.

The internal schema is specific to the


underlying hardware and storage
mechanisms
Key features and benefits of the ANSI-SPARC Architecture
include:

Data Independence: The architecture provides a clear


separation between different levels, allowing changes in one
level (e.g., physical storage) to be made without affecting the
other levels (e.g., user interfaces).

Modularity: Each schema level can be modified


independently, promoting flexibility in adapting to changing
requirements.
ANSI-SPARC Three-Level
Architecture

Pearson Education © 2014 12


ANSI-SPARC Three-Level
Architecture
External Level
Users’ view of the database.
Describes that part of database that is
relevant to a particular user.

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

Pearson Education © 2014 13


ANSI-SPARC Three-Level
Architecture
Internal Level
Physical representation of the database on
the computer.
Describes how the data is stored in the
database.

Pearson Education © 2014 14


Differences between Three
Levels of ANSI-SPARC
Architecture

Pearson Education © 2014 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).
Should not require changes to external
schema or rewrites of application programs.

Pearson Education © 2014 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 © 2014 17


Data Independence and the
ANSI-SPARC Three-Level
Architecture

Pearson Education © 2014 18


Database Languages
Data Definition Language (DDL)

DDL is used to describe and name entities (tables),


attributes (columns), and relationships between entities

plus any associated integrity and security constraints.

DDL (Data Definition Language) is a subset of SQL


(Structured Query Language) that allows database
administrators (DBAs) or users to define and manage
the structure of a database.

19
Here's how DDL achieves this:

1. Creating Tables (Entities):

The CREATE TABLE statement in DDL is used to define entities,


which are essentially tables in a relational database. This
statement allows users to specify the table name, columns
(attributes), and their data types.

CREATE TABLE
Employees ( EmployeeID INT PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(50),
DepartmentID INT,
FOREIGN KEY (DepartmentID) REFERENCES Departments(DepartmentID) );
In this example, a table named Employees is created with columns
Employee ID, FirstName, Last Name, and Department ID.
Relationships between tables can be established using foreign key
constraints.
2. Defining Attributes (Columns):

The columns in a table represent attributes. DDL allows users to


specify the name, data type, and constraints for each column.
CREATE TABLE
Products ( ProductID INT PRIMARY KEY,
ProductName VARCHAR(100),
Price DECIMAL(10, 2),
InStock INT );
In this example, the Products table has attributes like ProductID,
ProductName, Price, and InStock, each with its specified data type.

3. Establishing Relationships:

DDL allows users to define relationships between entities using foreign key
constraints. This is crucial for maintaining data integrity and enforcing
referential integrity rules.

CREATE TABLE Orders (


OrderID INT PRIMARY KEY,
CustomerID INT,
OrderDate DATE,
FOREIGN KEY (CustomerID) REFERENCES
Customers(CustomerID) );
Here, the Orders table has a foreign key constraint (CustomerID) that
references the CustomerID column in the Customers table.

Creating Indexes:

DDL allows the creation of indexes on columns to improve query


performance. Indexes can be created on single or multiple columns .

CREATE INDEX idx_EmployeeLastName ON Employees(LastName);


This statement creates an index on the LastName column in the Employees
table.
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)

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

Data Model comprises:


a structural part;
a manipulative part;
possibly a set of integrity rules.

Pearson Education © 2014 26


Data Model
Purpose
To represent data in an understandable way.

Categories of data models include:


Object-based
Record-based
Physical.

Pearson Education © 2014 27


Data Models
Object-Based Data Models
Entity-Relationship
Semantic
Functional
Object-Oriented.

Record-Based Data Models


Relational Data Model
Network Data Model
Hierarchical Data Model.

Physical Data Models


Pearson Education © 2014 28
Relational Data Model

Pearson Education © 2014 29


Network Data Model

Pearson Education © 2014 30


Hierarchical Data Model

Pearson Education © 2014 31


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.
Pearson Education © 2014 32
Functions of a DBMS
Data Storage, Retrieval, and Update.

A User-Accessible Catalog.

Transaction Support.

Concurrency Control Services.

Recovery Services.
Pearson Education © 2014 33
Functions of a DBMS
Authorization Services.

Support for Data Communication.

Integrity Services.

Services to Promote Data Independence.

Utility Services.
Pearson Education © 2014 34
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 © 2014 35


Components of a DBMS

Pearson Education © 2014 36


Components of Database
Manager

Pearson Education © 2014 37


Multi-User DBMS
Architectures
Teleprocessing

File-server

Client-server

Pearson Education © 2014 38


Teleprocessing
Traditional architecture.
Single mainframe with a number of
terminals attached.
Trend is now towards downsizing.

Pearson Education © 2014 39


File-Server
File-server is connected to several
workstations across a network.

Database resides on file-server.

DBMS and applications run on each


workstation.

Disadvantages include:
Significant network traffic.
Copy of DBMS on each workstation.
Concurrency, recovery and integrity control more
Pearson Education © 2014 40
complex.
File-Server Architecture

Pearson Education © 2014 41


Traditional Two-Tier Client-Server
Client (tier 1) manages user interface and
runs applications.
Server (tier 2) holds database and DBMS.

Advantages include:
wider access to existing databases;
increased performance;
possible reduction in hardware costs;
reduction in communication costs;
increased consistency.

Pearson Education © 2014 42


Traditional Two-Tier Client-
Server

Pearson Education © 2014 43


Traditional Two-Tier Client-
Server

Pearson Education © 2014 44


Three-Tier Client-Server
Client side presented two problems
preventing true scalability:
‘Fat’ client, requiring considerable resources on
client’s computer to run effectively.
Significant client side administration overhead.

By 1995, three layers proposed, each


potentially running on a different platform.

Pearson Education © 2014 45


Three-Tier Client-Server
Advantages:
‘Thin’ client, requiring less expensive hardware.
Application maintenance centralized.
Easier to modify or replace one tier without affecting
others.
Separating business logic from database functions
makes it easier to implement load balancing.
Maps quite naturally to Web environment.

Pearson Education © 2014 46


Three-Tier Client-Server

Pearson Education © 2014 47


Transaction Processing
Monitors
Program that controls data transfer
between clients and servers in order to
provide a consistent environment,
particularly for Online Transaction
Processing (OLTP).

Pearson Education © 2014 48


TPM as middle tier of 3-tier client-
server

Pearson Education © 2014 49

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy