Database Lecture2

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 25

Database Design

Dr. M. Bilal Qureshi


Overview of Databases
Languages and Architectures
Chapter 2: Outline

 Data Models, Schemas, and Instances


 Three-Schema Architecture and Data
Independence
 Database Languages and Interfaces
 The Database System Environment
 Centralized and Client/Server Architectures
for DBMSs
Data Models
 A Data Model is:
– A collection of concepts that can be used to describe the structure
of a database.
 By structure it means data-types, relationships and
constraints that should hold on the data.
– It provides the means to achieve data abstraction by hiding
unneeded details of data storage.
 Data abstraction is suppression of details of data organization and
storage, highlighting of the essential features for an improved
understanding of data
– Most data models include a set of basic operations
for specifying retrieval and updates on the database
and dynamic operation e.g. Calculate Gpa, Update
Inventory.
Categories of Data Models
 Data models can be categorized according to
the types of concepts they use to describe the
database structure
– High Level (Conceptual) data Models provide concepts
close to the way users perceive data

– Low Level (Physical) data Models provide concepts that


describe the details of how data is stored in the computer

– Between the two extremes is a class of representational


data Models, which provide concepts that may be
understood by end user and how data organized within the
computer
– It hides some details but can be directly implemented
Categories of Data Models (cont..)
1. Conceptual data Models use concepts such as entities,
attributes and relationships.
1. An entity represents a real world object or concept (employee, project).
2. An attribute represents some property of interest that further describes
an entity (employee name).
3. A relationship among two entities represents an interaction among
them.
2. Representational Data Models are the models used most
frequently and they include a widely used relational data
model, network and hierarchal models that been widely used
in the past. It represent data by using record structures
3. Physical Data Models describe how data is stored as file in
the computer by representing information such as record
formats, record ordering and access path
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/Intension, which is specified during the
database design and is not expected to change
frequently.
– Data model has conventions to display schema called
Schema Diagram
– We call each object in the Schema -Such as Student
or Course- a Schema Construct
Schemas, Instances and Database
State
 Database itself is called Database
State/Extension/Instance:

– It is the data in a database at a particular


moment
– Every time we insert or delete a record we
change the state of a database
– Schema change is called Schema Evolution
Example: University Database
DB Schema

Schema Constructs

A DB State/Instance/Extension

9
Schema versus DB state
 Important to distinguish between DB schema and state:
– When we define a new database, specify its database schema
only to the DBMs
 The corresponding database state is the empty state
– Initial state of database when database is first Populated or
loaded with initial data
 Every time when a basic operation is applied we get another
database state
 At any point in time database has a current state
– DBMS ensures that every state of database is Valid State
 i.e. satisfies structure and constraints specified in schema
 Schema only change when requirement change called schema
evolution, E.g. we may decide another data item needed to be
stored for each record
Three-Schema Architecture
 Three of four important characteristics of the
database approach, listed are:
1. Self-describing of a DB (Schema)
2. Insulation between programs and data
3. Support of multiple views of the data

 Three-Schema Architecture : It was proposed to


help achieve and visualize these characteristics
The Three-Schema Architecture
 Internal level: has internal schema, describes the physical
storage structure of the database.
 Uses physical data model to describe the complete detail of data
storage
 Conceptual level: has conceptual schema, describes the
structure of the whole database for users.
 It describes what data is stored in the database, the
relationships among the data and complete view of the
user’s requirements without any concern for the physical
implementation.
 The External or View level: includes a number of external
schemas or user views.
– Each external schema describes the part that a particular user
group is interested in and hides the rest.
– Each schema is implemented using representational data
model based on external schema design in high level data
model.
Visualization of Three-Schema
Architecture
END USER

USER 1
... USER 2

EXTERNAL
EXTERNAL VIEW 1 EXTERNAL VIEW 2
LEVEL

External/conceptual mapping

CONCEPTUAL CONCEPTUAL
LEVEL SCHEMA

Conceptual/internal mapping

INTERNAL INTERNAL SCHEMA


LEVEL

Data Data Data

STORED DATABASE
13
Three Schema: Example
Employee Data Conceptual Model Workers
External First Name: Fatima Name: F. Abdullah
Level/View Last Name: Abdullah Age: 34 Y, 10 d
DOB: 12th Sept. 1980 Department: Sales
Ext/conceptual mapping External Layer
Representational Model
Name DOB Dependent Dep. Id
Conceptual
Fatima Abdullah 12-08-1980 5 D019
Level/View
Ahmad Ali 10-03-1990 0 D012
Conceptual/int mapping Internal Layer

Internal/Physical Model
Internal RH Fatima Abdullah 12081980 5 D019 RH Ahmad Ali…
Level/View
OS Layer

100011001111000011100001110000111000011100101010…
Database Languages

1. Data Definition Language (DDL):


– Used to define schemas.

2. Data Manipulation Language (DML):


– Used to retrieve, insert, delete, and modify data.

3. Structured Query Language (SQL):


– A comprehensive language that combines both
DDL and DML.
DBMS Component Modules

 A DBMS is a complex software system

 The figure showed in next slide is divide into two


halves.
 The top half refers to the various users of the
database system
 The lower half shows the internals of the DBMS
responsible for storage of data and processing of
transactions
Typical DBMS Component
Modules

Users of the
database
system

Internals
of the
DBMS
Centralized and Client/Server
Architectures for DBMSs
 Centralized DBMSs Architecture
– All DBMS functionality, application program execution, and
user interface processing carried out on one machine
Basic Client/Server Architectures

 The client/server architecture was developed


to deal with computer environment in which
a large number of PCs, workstation, file
server…

 A client in this framework is typically a user


machine that provides user interface
capabilities and local processing
 A server is a system containing both
hardware and software that can provide
services to the client machines.
Logical two-tier client server
architecture
Two-tier Architecture
 This is called two-tire architectures because
the software components are distributed over
two systems: client and server

 The emergence of the Web changed the roles


of client and server, leading to the three-tier
architecture
Three-tier Architecture
 The intermediate layer or middle layer is
sometimes called the application server or Web
server

Three-tier Architecture Can Enhance Security:


1. Database server only accessible via middle tier
2. Clients cannot directly access database server
Three-tier Client-Server Architecture
Three-tier architecture
 The presentation layer displays information to
the user.

 The business logic layer handles intermediate


rules and constrains before data is passed up to
the user or down to the DBMS

 If the bottom layer is split into two layers (a


web server and a database server), then it is a
4-tire architecture (possible to the n-tier)
Summary
 Concepts used in database systems
 Main categories of data models
 Three Schema Architecture
 Interfaces provided by the DBMS
 DBMS Architecture
 DBMS classification criteria:

You might also like