The Three-level ArchitectureI. External modelII. Logical or conceptual modelIII. Internal or physical model
Logical Data ModelsI. Semantic data modelII. Record based model
DATABASE ARCHITECTURE
THE THREE-LEVEL ARCHITECTURE
External model Logical Or Conceptual Model Internal Or Physical Model
THE THREE-LEVEL ARCHITECTURE
EXTERNAL LEVEL
• The external level interacts directly with the user (end users or application programs). It changes the data coming from the conceptual level to a format and view that is familiar to the users.
• Consists of many user models or views• Has external records - records seen by users• May include calculated or virtual data• Devide in external schemas (sub-schemas)• Used to create user interface
LOGICAL OR CONCEPTUAL MODEL
The conceptual level defines the logical view of the data.
• All entities, attributes, relationships represented• Includes all record types, data item types, relationships, semantic
information, security and integrity information• Described in logical schema
INTERNAL LEVEL
• The internal level determines where data is actually stored on the storage devices.
• The DBMS and Operating System View• Physical implementation level• Includes data structures, file organizations used by DBMS• Depends on what DBMS is used
WHAT IS DATA INDEPENDENCE
• Techniques that allow data to be changed without affecting the applications that process it.
Slide 2- 8
TYPES OF DATA INDEPENDENCE
• Logical Data Independence: • The capacity to change the conceptual schema without having to change the
external schemas and their associated application programs.
• Physical Data Independence:• The capacity to change the internal schema without having to change the
conceptual schema.• For example, the internal schema may be changed when certain file
structures are reorganized or new indexes are created to improve database performance
RECORD BASED MODELS
¤ In this model database is structured in fixed-format records of several types.
¤ They allow the designer to develop and specify the logical structure and provide some options for implementation of the design
¤ It describes the data at the conceptual and view levels both.
¤ Specify overall logical structure of the database
I. Hierarchical ModelII. Network ModelIII. Relational Model
Types:
HIERARCHICAL MODEL
¤ Oldest¤ Like a structure of a tree¤ Branches represent fields¤ Nodes represent record¤ Structure contains levels, or segments.¤ Higher layer is perceived as the parent of the segment
directly beneath it, which is called the child
S1001 Ali Ahmad Computer Science
60
Csc01A Intro to Algo Talha TuF10 N45
S1002 Kamal Khan Computer Science
60
S1008 Noman Ch Computer Science
60
Example:
NETWORK MODEL
¤ Like hierarchical model¤ But may have many to many relation¤ It allows a record to have more than one parent¤ Replaces the hierarchical tree with a graph
S1001 Ali Ahmad Computer Science
60
Csc01A Intro to Algo
Talha TuF10 N45
S1002 Kamal Khan Computer Science
60
S1008 Noman Ch Computer Science
60
Mth01A
Calculus I Mutiullah
MW9 R25
Example:
:- A student taking two classes:- A teacher teaches different classes:- An employee works for two departments
Examples:
RELATIONAL MODEL
¤ Proposed by E.F. Codd¤ Uses relations¤ Contains tables¤ Tables represent relationships ¤ Columns represent attributes¤ It’s better than others
STDID STDNAME MAJOR CREDITS
S1001 Ali Ahmad Computer Science
60
S1002 Kamal Khan Math 40
S1003 Shoaib Mansoor
Computer Science
60
C_ID CNAME PROF SCHED ROOM
Mth01A Calculus I Mutiullah MW9 R25
Csc01A Intro to Algo Talha TuF10 N45
Csc01B Programming I Imran TuThF9 N40
Student - TableEnrollment - Table
Class - Table
C_ID STDID Grade
Csc01A
S1001 B+
Csc01B
S1001 A
Mth01A
S1002 B
Csc01A
S1002 B