0% found this document useful (0 votes)
3 views

Chapt 02-Lect 04

Uploaded by

mubarizmughal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Chapt 02-Lect 04

Uploaded by

mubarizmughal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

1

Chapter 02
Database Design: An Architecture for a Database System
Architecture: Structural design means what are different components in a system and how
these are interconnected with each other.
We have two types of architecture present in Database Management systems:
1)Three level Architecture
2)N- Tier Architecture (Client /Server )

Three Level Architecture


In 1978 a three level architecture was proposed under the title as ANSI/SPARC Architecture.
where ANSI-SPARC stands for American National Standards Institute, Standards Planning
And Requirements Committee, is an abstract design standard for a Database Management
System (DBMS).
2

Following are the three levels of database architecture:

1. Physical Level
2. Conceptual Level
3. External Level

Views

Tables (DDLs)
3

Files/stored structures
4

Figure 1: ANIS-SPARC Three Level Architecture of DBMS

 Above diagram shows three level architecture of DBMS.


 Reasons for using three level architecture :
1. To achieve Data independence via interaction between “The way
user understands the data” and the way data is actually stored
2. Different users accesses same data but with customized view
according to their requirement or their level of understanding of data.
 Mapping is the process of transforming request response between various
database levels of architecture.
5

 Mapping is not good for small database, because it takes more time.
 The external/conceptual mapping defines the correspondence between a
particular external view and conceptual view. It relates
each external schema with conceptual schema.
 The conceptual/internal mapping defines the correspondence between
the conceptual view and the store database. It specifies
how conceptual record and fields are represented at the internal level. It
relates conceptual schema with internal schema.

1. Physical Level/Internal Schema


 Physical level describes the physical storage structure of data in database.
 It is also known as Internal Level.
 This level is very close to physical storage of data.
6

 At lowest level, it is stored in the form of bits with the physical addresses on
the secondary storage device.
 At highest level, it can be viewed in the form of files.
 The internal schema defines the various stored data types. It uses a physical
data model.

Practical Example: For example a DBMS has selected a specific File organization for the
storage of data on disk, to implement that specific file system the DBMS needs to
create specific indexes. Now whenever the DBMS will attempt to retrieve the data back form the file
organization system it will use the same indexes information for data retrieval. This index information
is one example of additional information which DBMS places in the data when storing it on the disk.

At the same level storage space utilization is performed so that the data can be stored by consuming
minimum space, for this purpose the data compression can be performed, this space optimization is
achieved in such a way that the performance of retrieval and storage process is not compromised.

2. Conceptual Level
7

 Conceptual level describes the structure of the whole database for a group
of users.
 It is also called as the data model.
 Conceptual schema is a representation of the entire content of the database.
 These schema contains all the information to build relevant external records.
 It hides the internal details of physical storage.
 There will be precisely one conceptual view of a database. Conceptual view
consist of occurrences of particular record (row) of all tables.

2.1 Conceptual Schema


Conceptual schema is a detail specification of overall structure of a
data
Conceptual schema includes:
All entities , their relationships with their attributes
8

It also includes definition of all entities (Tables) along with data


types of each attribute.
It includes Integrity constrains, security and integrity information.

2.2 Presentation of Conceptual Schema:


2.2.1 ER MODEL

Dept name ename dob


Loc Emp no
Deptno job

Dept Emp
DE

Department to employee relationship


One Many
9

2.2.2 USING DDL:


CREATE TABLE EMP
(
EMPNO NUMBER(4) PRIMARY KEY,
ENAME VARCHAR2(100) NOT NULL,
JOB VARCHAR2(10),
SALARY NUMBER(4) CHECK (SALARY <= 100000),
DOB Date,
NIC VARCHAR2(20) UNIQUE,
DEPTNO NUMBER(4) REFERENCES DEPT(DEPTNO)

);

CREATE TABLE DEPT


10

( DEPTNO NUMBER(4) NOT NULL PRIMARY KEY,

DNAME VARCHAR2(20) NOT NULL,

LOC VARCHAR2(20)

/*VARCHAR is use to store characters. VARCHAR can store up to 2000 bytes of characters while
VARCHAR2 can store up to 4000 bytes of characters. So two indicates double capacity in
varchar2.*/

3. External Level
 External level is related to the data which is viewed by individual end users.
 This level includes a no. of user views or external schemas.
 This level is closest to the user.
11

 External view describes the segment of the database that is required for a
particular user group and hides the rest of the database from that user
group.
 Examples are of DOB(stored field) is basically viewed by user as an age or
different views for different users. Lets create a view named as
“NED_EMP_VIEW” which shows name of employee in capital letters with
their age and their annual salary as:

Employee View
EMPNO EMP_NAME AGE ANNUAL_SAL

Create View NED_EMP_VIEW


As
12

Select EMPNO,
UPPER(ENAME) AS EMP_NAME,

(SYSDATE-DOB)/365 AS Age,
SAL*12 ANNUAL_SAL
From EMP ;

/* whenever we need to take out record from view then we will run the
query as*/

Select * from NED_EMP_VIEW

-----------*-------------------*-----------------------*-----------------
In next lecture we will see further detail of external and internal
level (full topic).
13

-----------*---------------------*----------------------*-------------------

You might also like