0% found this document useful (0 votes)
16 views41 pages

DB WEEK 2

Uploaded by

abdullahzahidhp
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)
16 views41 pages

DB WEEK 2

Uploaded by

abdullahzahidhp
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/ 41

1

Database Systems
Week 2
Lecture 1& 2

Lahore Garrison University


2

Topics to Cover
• VIEWS OF DATA IN DBMS
• DATA ABSTRACTION
• DATA MODELS
• DBMS ARCHITECTURE.
• TYPES OF DBMS ARCHITECTURE.
• DATA INDEPENDENCE
• TYPES OF DATA INDEPENDENCE

Lahore Garrison University


3

Lahore Garrison University


 It refers that how data is stored in
database, what data and structure of
View of data used by database for data , so
describe all these database provide user
Data in with views, and these are
DBMS  Data abstraction
 Instances and Schemas
4
Data Abstraction in DBMS

Database systems are made-up of


complex data structures. To ease the
user interaction with database, the
developers hide internal irrelevant
details from users. This process of
hiding irrelevant details from user is
called data abstraction.

Lahore Garrison University


5
Three levels of abstraction

Physical level: This is the lowest level of data abstraction. It describes how
data is stored in database. You can get the complex data structure details at
this level.

Logical level: This is the middle level of 3-level data abstraction architecture.
It describes what data is stored in database.

View level: Highest level of data abstraction. This level describes the user
interaction with database system.

Lahore Garrison University


6

Lahore Garrison University


 Let’s say we are storing customer information in a
customer table. At physical level, these records can be
described as blocks of storage (bytes, gigabytes,
terabytes etc.) in memory. These details are often
hidden from the programmers
 At the logical level, these records can be described as
fields and attributes along with their data types, their
Example relationship among each other can be logically
implemented. The programmers generally work at this
level because they are aware of such things about
database systems.
 At view level, user just interact with system with the
help of GUI and enter the details at the screen, they are
not aware of how the data is stored and what data is
stored; such details are hidden from them.
7

Lahore Garrison University


 Design of a database is called the schema.
 It is basically a Skeleton structure that represents
Instance the logical view of entire Database

and schema  Schema is of three types:


 Physical schema
in DBMS  logical schema
 view schema.
8

Lahore Garrison University


 The design of a database at physical level is
called physical schema, how the data stored in
blocks of storage is described at this level.
 Design of database at logical level is called logical
schema, programmers and database administrators
work at this level, at this level data can be
described as certain types of data records gets
Cont’d stored in data structures, however the internal
details such as implementation of data structure is
hidden at this level (available at physical level).
 Design of database at view level is called view
schema. This generally describes end user
interaction with database systems.
9
For example:

 In the following diagram, we have a schema that shows the relationship between three tables:
Course, Student and Section. The diagram only shows the design of the database, it doesn’t
show the data present in those tables. Schema is only a structural view(design) of a database as
shown in the diagram below.

Lahore Garrison University


10

Lahore Garrison University


 The data stored in database at a particular
moment of time is called instance of database.
Database schema defines the variable
declarations in tables that belong to a
DBMS particular database; the value of these
Instance variables at a moment of time is called the
instance of that database.
 The schema is sometimes called the intension
of the database, while an instance is called an
extension (or state) of the database.
11

let's say we have a single table student in

Lahore Garrison University


the database, today the table has 100
records, so today the instance of the
database has 100 records. Let's say we
are going to add another 100 records in
For example this table by tomorrow so the instance of
database tomorrow will have 200 records
in table. In short, at a particular moment
the data stored in database is called the
instance, that changes over time when we
add or delete data from the database.
12

1. HIGH-LEVEL OR
CONCEPTUAL DATA MODELS
2. REPRESENTATIONAL OR
Data models IMPLEMENTATION
MODELS
DATA

3. LOW-LEVEL OR PHYSICAL
DATA MODELS

Lahore Garrison University


13

Lahore Garrison University


 A collection of concepts that can be used to
describe the structure of a database—provides
the necessary means to achieve this
abstraction.
 By structure of a database, we mean the data
Data Models types, relationships, and constraints that apply
to the data.
 Most data models also include a set of basic
operations for specifying retrievals and
updates on the database.
14

Lahore Garrison University


1. High-level or conceptual data models:
 Provides concepts that are close to the way
many users perceive data.
 Use concepts such as entities, attributes and
Categories of relationships.

Data Models  Entities: represent real world object or


concept.
 Attributes: further describe an entity.
 Relationships: association among 2 or more
entities.
15

Lahore Garrison University


2. Low-level or physical data model:
 Describe how data is stored in the computer.
Low-level or  Access path (structure for efficient searching of
physical data database records]

model 3. Representation or implementation data model:


 Represent data using record structures [record-based
data models].
16

Lahore Garrison University


 Database Schema: Description of a
database.
 Schema Diagram: Displayed schema.
 Schema Construct: each object within
the schema.
 Database State: The data in the
database at a particular moment.
17
Database architecture uses
programming languages to design a
particular type of software for
businesses or organizations.

DBMS Database architecture focuses on the


design, development,
Architectu implementation and maintenance of
computer programs that store and
organize information for businesses,
re agencies and institutions.

A database architect develops and


implements software to meet the
needs of users.

Lahore Garrison University


18

Lahore Garrison University


 The logical DBMS architecture: The
logical architecture deals with the way
data is stored and presented to users.
Types of  The physical DBMS architecture: The
DBMS physical architecture is concerned with
the software components that make up a
Architectur DBMS.
e
 Note: we are only concerned with the
logical architecture
19

Lahore Garrison University


The main objective of this architecture is to have an
Three- effective separation between the user interface and the
physical database. So, the user never has to be
Schema concerned regarding the internal storage of the
Architecture database and it has a simplified interaction with the
database system.
20
Three Level Architecture

External/view Conceptual/Logical Internal/Physical


Level Level Level

Lahore Garrison University


Three Level Architecture 21

External User 1 User 2 User n


Level View 1 View 2 View n

Conceptual
Conceptual
Level Schema

Internal
Internal Schema
Level

Physical Data
Organization Database
22
External Schema

Instead, they need


This level is closest
Most of the users are only a part of the
to the users and is
not concerned with database relevant to
concerned with the
all the information them. The system
way in which the data
contained in the provides many views
is viewed by
database. for the same
individual users.
database.
Also, it should not
Includes allow the user to get
Virtual/calculated or retrieve data
data: that is not which is not allowed
actually stored in the to the user, so the
database but is user view should
created when needed both be a facilitator
e.g., age, statistical and also a barrier for
data etc. proper utilization of
the database system.

Lahore Garrison University


Employee Data
Workers
Saleema
First Name: Rana
Name: R. Aslam
Last Name: Aslam
Age: 25y,10d
Date of Birth:
Dept: Sales
12 Sep 1970

Saleem

External Layer

Lower Layers
24
Logical / Conceptual View

The users of
This level of this level are
not concerned Describes
abstraction with how these what data are
describes At this level, logical data stored in the
what data are the database structures will database
stored in the is described be implemented
(i.e,all the
database. It logically in at the physical
level, rather records and
also terms of
they just are relationships
describes the simple data-
concerned included in
relationships structures. about what the
existing information is database).
among data. to be kept in
the database.

Lahore Garrison University


25
Logical / Conceptual View

The conceptual view is a representation of the entire


information content of the database in a form that is
somewhat abstract in comparison with the way in which the
data is physically stored.

The conceptual view is defined by means of the conceptual


schema, which includes the definition of each of the various
types of conceptual records and the mapping between the
conceptual schema and the internal schema.

Lahore Garrison University


Saleema
Employee Data
Workers
First Name: Rana
Name: R. Aslam
Last Name: Aslam
Age: 24y,10d
Date of Birth:
Dept: Sales
12 Sep, 1970
Saleem

External Layer

Logical Record Interface

Conceptual Layer

Name DoB Deps DepId


Rana Aslam 12/09/70 5 D001
Marya Wasti 29/02/80 0 D005
27
Internal View

Concerns about the


Describes how the
physical Lowest level of
data are physically
implementation of the abstraction.
stored.
database

Internal view – internal


schema (not only
defines the various
The internal level is
types of stored record
closest to physical
but also specifies what
storage.
indexes exists, how
files are represented,
etc.)

Lahore Garrison University


28
Generally same as Internal

Actual representation of data on


the storage device
Physical
Level
In the binary format

OS responsibility

Lahore Garrison University


 The overall description of the database is
called the database schema. There are
three different types of schema in the
database, and these are defined according to
the levels of abstraction of the three-level.
 At the highest level, we have multiple
external schemas (also called
Schemas, subschemas) that correspond to different
views of the data.
Mappings,  At the conceptual level, we have the
conceptual schema, which describes all the
and entities, attributes, and relationships
together with integrity constraints.
Instances  At the lowest level of abstraction, we have
the internal schema, which is a complete
description of the internal model, containing
the definitions of stored records, the methods
of representation, the data fields, and the
indexes and storage structures used. There is
only one conceptual schema and one internal
schema per database.

Lahore Garrison University 29


 The data in the database at any point
in time is called a database
instance. Therefore, many database
instances can correspond to the same
database schema.
Instances,  An instance of the database is a
snapshot of the actual content at any
Intension and given time, including the data itself
extension and its relationship to other data in
the database.
 The schema is sometimes called the
intension of the database, while an
instance is called an extension (or
state) of the database.

Lahore Garrison University 30


31

Also, a part of 3- External/conceptual


Conceptual/Internal
level architecture mapping

Inter Schema Mapping


Lahore Garrison University
32
Mapping

External – Conceptual Specifies mapping between


objects in the external view to
Mapping those in the logical model

Specifies mapping between


Conceptual – Internal objects in the logical model to
those in the physical model-
Mapping data independence

Lahore Garrison University


User User User
External 1View 1 2View 2 n
View n
Level
Ext/Con Mapping
Conceptual Level Conceptual
Schema
Con/Int Mapping
Internal
Internal Level
Schema

Physical Data
Organization Database
First Name: Rana Name: R. Aslam
Last Name: Aslam Saleema Age: 24y,10d
Date of Birth: Dept: Sales
12 Sep, 1970
Saleem

Name DoB Deps DepId

Rana Aslam 12/09/70 5 D001


Marya 29/02/80 0 D005

BH RH Rana Aslam 120970 5 D001 RH Marya …

01110011010011100101001010100101010010101…..
35
Data Independence
and Its Types

The ability to modify a schema


definition in one level without
affecting a scheme definition
in the next higher level is
called DATA INDEPENDENCE. It
has two types:
 Physical Data Independence
 Logical Data Independence

Lahore Garrison University


36
Physical Data Independence

01 02 03
It refers to the The application Modifications at
ability to modify programs remain the physical level
the scheme the same even are occasionally
followed at the though the necessary in
physical level
without affecting scheme at the order to improve
the scheme physical level performance of
followed at the gets modified. the system.
conceptual level.
Lahore Garrison University
37

 Changes to the internal


schema, such as using
different file organizations
Physical Data or storage structures, using
different storage devices,
Independenc modifying indexes, or
e hashing algorithms, should
be possible without having
to change the conceptual or
external schemas.

Lahore Garrison University


38
Logical Data Independence

It refers to the ability to modify the


conceptual scheme without causing any
changes in the schemes followed at
view levels.
The logical data independence ensures that
the application programs remain the same.
Modifications at the conceptual level are
necessary whenever logical structures of the
database get altered because of some
unavoidable reasons.
Lahore Garrison University
39
 Changes to the
conceptual schema, such
as the addition or
removal of new entities,
Logical Data attributes, or
Independenc relationships, should be
e possible without having
to change existing
external schemas or
having to rewrite
application programs.

Lahore Garrison University


40
 It is more difficult to
achieve logical data
independence than the
Physical & physical data
Logical Data independence.
Independenc  The reason being that
e the application programs
are heavily dependent on
the logical structure of
the database.

Lahore Garrison University


41
Next lecture

DB Query Data models Data Flow


Language Diagrams

Lahore Garrison University

You might also like