0% found this document useful (0 votes)
11 views30 pages

DB - Lec - 3 and 4

Uploaded by

zohaibsaleem653
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views30 pages

DB - Lec - 3 and 4

Uploaded by

zohaibsaleem653
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 30

Database Design

Instructor: Muhammad Azeem


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

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
 Schema only change when requirement change called schema
evolution, E.g. we may decide another data item needed to be
stored for each record
Database Design/Model
 Database Design / Model
– The database design/model stores the structure of the data and the
links/relationships between data that should be stored to meet the users’
requirements.
– Database design is stored in the database schema, which is in turn stored
in the data dictionary.
 Database Modeling
– The process of creating the logical structure of the database is called
database modeling.
– If the database is not designed properly the implementation of the
system can not be done properly.
– Generally the design of the database is represented graphically because
it provides an ease in design and adds flexibility for the understanding of
the system easily.
Types of Data Models
 Therefore, there are following four data models used for
understanding the structure of the database:
Types of Data Models
Relational Data Model:
This type of model designs the data in the form of rows and columns
within a table. Thus, a relational model uses tables for
representing data and in-between relationships. Tables are also
called relations.
Entity Relationship Data Model:
An ER model is the logical representation of data as objects and
relationships among them. These objects are known as entities,
and relationship is an association among these entities. It was
widely used in database designing.
A set of attributes describe the entities. For example, student_name,
student_id describes the 'student' entity. A set of the same type of
entities is known as an 'Entity set', and the set of the same type of
relationships is known as 'relationship set'.
Types of Data Models
Object Oriented Data Model:
An extension of the ER model with notions of functions,
encapsulation, and object identity, as well. This model supports a
rich type system that includes structured and collection types

Semistructed Data Model:


Semi-structured data is a form of structured data that does not
obey the tabular structure of data models associated with
relational databases or other forms of data tables, but nonetheless
contains tags or other markers to separate semantic elements and
enforce hierarchies of records and fields within the data.
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
17
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…
Data Independance

Data Independence
– The data independence achieved as a result of the three level
architecture proves to be very useful.
– The database and data applications independent of each other we can
easily make changes to any of the components of the system
– The Change not effecting the functionality and operation of other
interrelated components

Types of Data independence


– Logical Data Independence
– Physical Data Independence
Data Independance

Logical Data Independence


– Logical data independence provides the independence in
a way that changes in conceptual model do not affect the
external views.

– Although we have data independence at different levels,


but we should be careful before making a change to
anything in database.

– The changes which can be done transparently may


include the following:

• Adding a file to database


• Adding a new file in a file
• Changing the type of the specific field
Data Independance

Physical Data Independence


– Physical data independence is that type of independence
the changes made to internal level shall not affect the
conceptual level.
– the changes made should belong to a specific domain and
should not exceed the liberty offered by the physical data
independence.
– For example the changes made to the file organization by
implementing indexed, changing the storage media, or
simply implement a different technique for managing file
indexes or hashes
DBMS Environments

Single User

Multi User

– Teleprocessing

– File Servers

– Client Servers
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)
Database Languages
 Data Definition Language (DDL)
 Data manipulation Language (DML)
 Data Control language (DCL)
 Transaction Control Language (TCL)
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