Abstraction Data Independence

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 7

Data independence

• The three-layer DBMS architecture provides the feature


called data independence
• Two types of data independence
– logical – changes to implementation schema do not
affect user applications
– physical – changes to physical data storage do not
affect implementation schema

external schema

conceptual schema A B C D E

Internal schema
Example: University Database
• Conceptual schema:
– Students(sid: string, name: string, login: string,
age: integer, gpa:real)
– Courses(cid: string, cname:string, credits:integer)
– Enrolled(sid:string, cid:string, grade:string)
• Physical schema:
– Relations stored as unordered files.
– Index on first column of Students.
• External Schema (View):
– Course_info(cid:string,enrollment:integer)
Data Independence
• Logical Data Independence
– Refers to immunity of external schemas to
changes in conceptual schema.
– Conceptual schema changes (e.g.
addition/removal of entities).
– Should not require changes to external schema or
rewrites of application programs.
• Physical Data Independence
– Refers to immunity of conceptual schema to
changes in the internal schema.
– Internal schema changes (e.g. using different file
organizations, storage structures/devices).
– Should not require change to conceptual or
external schemas.
Data Abstraction
View Level
What data users and
application programs
see ?
View 1 View 2 … View n

What data is stored ? Logical


describe data properties such as Level
data semantics, data
relationships

How data is actually stored ? Physical


e.g. are we using disks ? Level
Which file system ?
Levels of data abstraction
Physical level: describes how data are stored.

Logical level: describes data stored in database, and


the relationships among the data.
type customer = record
name : string;
street : string;
city : integer;
end;

View level: application programs hide details of data


types. Views can also hide information (e.g., salary)
for security purposes.
Data Abstraction
• A major purpose of a database system is to
provide users with an abstract view of the
data.
• The system hides certain details of how the
data are stored and maintained.
• For ease of use, simple user interfaces are
provided to users.
• For efficiency, complex data structures are
used to represent data in the database.
Data Independence DBMS

• Data Independence
– Lower-level schema changes will not effect upper-level
schemas and applications
• Physical Data Independence
– if physical schema changes do not affect application
programs.
– That is, application programs do not depend on physical
schema (but depend on a logical schema or a view
schema).
• Logical Data Independence
– if logical schema changes do not affect application
programs.
– That is, application programs do not depend on logical
schema (but depend on some views).

You might also like