Beruflich Dokumente
Kultur Dokumente
MODEL
BCA20
Engr. Florence B. Reyes
DATA MODELS
A Database models
some portion of the real
world.
Conceptual schema
defines logical View 1 View 2 View 3
structure
Conceptual Schema
Physical schema
describes the files
and indexes used. Physical Schema
DB
LEVELS OF ABSTRACTION
struct STAFF {
int Staff_no;
int Branch_no;
Physical Level char FName[15];
char LName[15];
struct date DOB;
float Salary;
struct STAFF *next;
};
index Staff_no; index Branch_no;
DATA INDEPENDENCE: THE BIG
BREAKTHROUGH OF THE RELATIONAL MODEL
A Simple Idea:
Applications should be
insulated from how data is View 1 View 2 View 3
structured and stored.
Logical data
independence: Protection Conceptual Schema
from changes in logical
structure of data.
Physical Schema
Physical data
independence: Protection
from changes in physical
structure of data.
DB
Q: Why are these
particularly important for
DBMS?
RELATIONAL DATA MODEL CONCEPTS
Therelational Model of Data is based on the
concept of a Relation, which is physically
represented as a table.
STUDENT
Name StudentNo Sex Degree
Tuples
Attribute Values
from same Domain
DOMAINS
A Domain D is the set of allowable values for one
or more attributes
is a set of atomic values
An atomic value is indivisible (as far as the
relational data model is concerned)
Each domain has a data type or format
Examples:
– Domain of Names:
{Joe Smith, Alan Yates, Bob Lovell, Jane
Austin, ...}
– Domain of Degrees:
{Phd, MSc, BInfTech, BSc, MInfTech, …}
DOMAIN TYPES
integers
real numbers
fixed or variable length character strings
date
time stamp
currency
sub-range from a data type, e.g. 1£_ Grade £_ 7
enumerated data type, e.g. {‘Male’, ‘Female’}
EXAMPLE DOMAINS
Indonesian telephone numbers
Values: the set of telephone numbers valid in
Indonesia
Format: the digits “62” followed by 9 digits 0-9
Subject Lecturer
Code Subject Code Staffmem
CSEE CS182 CS182 Harrison
CSEF CS180 CS181 Duke
Law LA303 CS180 Marjanovic
Cardinality of R (2)
STUDENT
Attribute Values
from same Domain
DEFINITION SUMMARY
Table Relation
Column/Field Attribute
Row/Record Tuple
Values in a column Domain
Table Definition Schema of Relation
No. of Columns Degree of Relation
No. of Rows Cardinality of Relation
EXAMPLE
RELATION SCHEMA AND INSTANCE
RelationSchema
– Denoted by R(A1,A2,A3,…,An), includes a
relation
name R and list of attributes A1, A2, … An
– Integer n is termed “degree of the relation”
– Example relation schema of degree 4:
STUDENT(Name, Age, Id, Address)
RelationInstance
– A relation instance r of the relation schema R,
denoted by r(R), is a set of n-tuples r = {t1,t2,
…,
tm}.
EXAMPLE OF SCHEMA AND INSTANCE
PART
QUESTIONS: