0% found this document useful (0 votes)
18 views8 pages

Chapt 02-Lect 05

Uploaded by

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

Chapt 02-Lect 05

Uploaded by

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

Chapter 02 (cont.

)
Database Design: An Architecture for a Database System
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.
 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
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

/* Lets create another view to from multiple tables let say Emp and department table view*/

Create View Emp-Dept_VIEW


As
Select E.Ename Empname, D.Deptno, D.Dname DeptName, From
Emp E,Dept D

Where E.Deptno = D.deptno


/* select your desired fields right now*/
Select Empname, DeptName from Emp-Dept_VIEW
External view consist of many occurrences of each of many types of external records (views).
Database Language
Each user in a database system has language at its end:
Application programmer: conventional programming languages like C++, C#, java, visual basic etc.

Database programmer: Proprietary language that is specific to the database system. For example PL/SQL( procedural language
SQL) in oracle , T-SQL(Transact- SQL)

Each of the above Proprietary language language have Data sublanguage(DSL) that is useful for performing operations on 5
database objects. In relational
database theory, the term "sublanguage", purpose by E. F. Codd in 1970, refers to a computer language used to define or
manipulate the structure and contents of a relational database management system (DDL & DML of RDBMS).

DSL is basically said to be embedded in host language (conventional Programming language)


Host language is responsible for performing non-database operations such as after retrieving data apply any business to the
data or apply conditions to further enhance its business.

such as c embedded SQL (DSL) code is written below:


EXEC SQL INCLUDE SQLCA;

EXEC SQL BEGIN DECLARE SECTION


host_name character_string(20) host_emp_number integer

EXEC SQL END DECLARE SECTION EXEC SQL CONNECT frans


/*Above query coonected to database frans and below we write a query in this */

EXEC SQL SELECT name emp_number INTO host_name,host_emp_number FROM employees


WHERE emp_number = 10001
/* Print host_name and host_emp_number */ EXEC SQL DISCONNECT
/* End program */

In simple words we write normal C ,or c++ program and whenever we requires data then we can use embedded SQL
(DSL) as done above

For END USER language available are Query Languages or Menu driven forms.

Here we have two important concepts to understand:

1) Tight Coupling : if the host language(programming language) is not distinct from DSL this phenomenon is known as Tight
coupling . Example is PL/SQL & SQL running simultaneously that we create form In oracle or program in oracle using PL/SQL
where side by side we will used SQL (DSL).

2) Loose Coupling: if the host language is clearly separable from DSL. Example is calling SQL data from VB.net.

We All already know :


DDL = Data Definition Language (create Table,Alter table or create constraints)
DML = Data Manipulation Language (select, Insert update and delete data)
Internal Level(in detail)
We have studied that internal level (physical level) covers the physical implementation of the database to achieve
optimum runtime performance & storage space utilization.
It basically covers the data structure and file organization used to store data on storage devices.
This level is basically part of responsibilities of DBA who decides what physical devices will contain data & which particular
access method will use to retrieve data and what steps will be taken to improve overall performance.
Internal View: is the low level representation of the data. It consist of many occurrences of stored record.
Internal Schema:
Internal Schema consist of:

a) File organization used to store data on physical storage devices & complex low level data structures (Use global lists to
hold all attributes, pointers and address spaces with Garbage-collection Management and unused objects in lists to avoid
memory leaks).

b) Indexing and hashing schemes used.

c) Record descriptions for storage (with stored size of data items).

d) Methods of representation of data field (for example for dates or file names).

e) Record Placement.

f) Physical sequence of records.

g) Data compression and encryption technique.


Internal Schema is Responsible to Interface the Database with Operating System. Internal level
actually brings the data to physical storage(or vice versa) after interfacing with the Operating
system.
External schema

Conceptual Schema

Internal Schema

OS
Mapping

Database

Physical level

Mapping is correspondence between two levels in three layer architecture & It provides isolation between different levels
Conceptual/Internal Mapping: it basically specifies how the conceptual database records are represented at internal
storage level. If storage structure and access techniques are changed then conceptual internal mapping must be changed
accordingly so that there would be no impact on the conceptual schema and it would remain invariant. (irrespective of file
storage structure and operating system our conceptual database designs always remains the same)
Conceptual Internal Mapping that’s why known as the “KEY OF PHYSICAL DATA INDEPENDENCE”

External /Conceptual Mapping:


This mapping determines the DBMS which object at conceptual level corresponds to particular user view.

For example we may generate difference in Record name(view name given to a table), attribute name and the orders of
attribute and we may transform data type by External /Conceptual mapping.
Moreover we may combine several attributes into a single virtual external field. If changes are made in external View or
conceptual model then this Mapping must be changed. External Conceptual Mapping that’s why known as “KEY TO LOGICAL
DATA INDEPENDENCE”
External /External Mapping:
Most DBMS allows an external view to be defined in terms of another view. For example:

CREATE VIEW /* now we will select our old


NED_OLD_EMP_VIEW employees record as*/
As
Select EMPNO,EMP_NAME Select * from NED_OLD_EMP_VIEW
From NED_EMP_VIEW
WHERE AGE > 50;

///*NEXT Class we will start a topic of Database Administrator*///

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