Lecture 5 - Database Architecture & Schema
Lecture 5 - Database Architecture & Schema
SCHEMA
HIRA FAYYAZ
LECTURE 5
2
Database Architecture
• DBMS architecture depends upon how users are connected to the database to get
their request done.
• The basic client/server architecture is used to deal with a large number of PCs, web
servers, database servers and other components that are connected with networks.
• The client/server architecture consists of many PCs and a workstation which are
connected via the network.
Database Architecture (cont.)
DBMS
Architectur
e
• For example, lets say you want to fetch the records of employee
from the database and the database is available on your computer
system, so the request to fetch employee details will be done by
your computer and the records will be fetched from the database
by your computer as well. This type of system is generally referred
as local database system.
• Microsoft Excel
ADVANTAGES AND DISADVANTAGES OF 1 9
TIERARCHITECTURE
• ADVANTAGES:
• Easy to optimize performance.
• No context switching
• DISADVANTAGES:
• Not scalable
• Hard to modify.
2-Tier Architecture
• Internal
Deals with
Schema
physical storage of data
RECORD EMPof records on disk - files, pages, blocks
• Structure
LENGTH=44
• Indexes and ordering of records
HEADER: BYTE(5)
• Used by database system programmers
OFFSET=0
NAME: BYTE(25)
OFFSET=5
SALARY: FULLWORD
OFFSET=30
DEPT: BYTE(10)
OFFSET=34
Conceptual Level
• Conceptual
Deals with the
Schema
organisation of the data as a whole
• Abstractions
CREATE TABLE are used to remove unnecessary details of the internal
level
Employee (
• Name
Used by DBAs and application programmers
VARCHAR(25),
Salary REAL,
Dept_Name
VARCHAR(10))
External Level
• External
Provides Schemas
a view of the database tailored to a user
• Parts of the data may be hidden
Payroll:
• String
Data is presented
Name in a useful form
• double
Used bySalary
end users and application programmers
Personnel:
char *Name
char *Department
Database Architecture 34
External view (Level, Schema or Model):
• In the diagram below same data record is displayed in two
entirely different ways.
Database Architecture 35
Conceptual or Logical View:
(Example)
Database Architecture 36
Internal: (Example)
37
Continued…
continue…
Sales Officer Inventory Controller
View 1 View 2
External Item_Name Item_Name
Level Price Stock
Conceptual
Conceptual Item_Number Character (6)
Item_Name Character(30)
Level Price Numeric(5,2)
Stock Numeric(4)
Physical
Stored_Item Length=50
Physical Item # Type = Byte(6), offset = 0, Index = Ix
Name Type = Byte(30), offset = 6
Level Price Type = Byte(8), offset = 36
Stock Type = Byte(4), offset = 44
Schemas and Instances
• Database Schema: The overall description of the database is
called the database schema. Similar to types and variables in
programming languages.
1. External Schema: At the highest level, we have multiple external
schemas that correspond to different views of the data.
2. Conceptual Schema: the overall logical structure of the database,
describes all the entities, attributes, and relationships together with
integrity constraints.
Example: The database consists of information about a set of
customers and accounts in a bank and the relationship between them
3. Internal schema: the overall physical structure of the database,
containing the definitions of stored records, the methods of representation, the
data fields, and the indexes and storage structures used.
• Instance – the actual content of the database at a particular
point in time
• Analogous to the value of a variable
40
Mappings
• Physical
Mappingsdata
translate
independence
information from one level to the next
• Changes
External/Conceptual
to internal level shouldn’t affect conceptual level
• Conceptual/Internal
• Logical data independence
• These mappings
• Conceptual level provide data independence
changes shouldn’t affect external levels
Reading
Material 42
Book Chapter Sections / Pages
• https://www.slideshare.net/shahab3/database-systems-cha
pter-2
• http://grail.cba.csuohio.edu/~matos/notes/cis-610/6th-Editi
on/Slides/Elmasri_6e_Ch02_Handout.pdf
• http://cezeife.myweb.cs.uwindsor.ca/courses/60-315/notes/
ch2.pdf
• https://www.slideshare.net/philipsinter/database-system-38
795643