Database Application
Development Process
Involves
Database Design
Application Programs
Implementation
Department of Computer Science
Database Design
A DB Design is a model of a
particular real-world system
It provides a picture of reality
Should be simple and self-
explanatory
Department of Computer Science
Database Development
Process
Department of Computer Science
Database Development
Process
Preliminary Study
Similar to
software
Requirement Analysis development
process
DB Design
Physical Design
Implementation
Maintenance
Department of Computer Science
Design Stages
Analyze User Environment
Develop Conceptual Model
Map Conceptual Model to Logical
Choose DBMS
Develop Physical Design
Implement System
Test System
Operational Maintenance Department of Computer Science
Database Design Phase
Department of Computer Science
Database Design
Design and Model mean the
same
Database Design represents
logical structure of the database
Department of Computer Science
Database Modeling
Process of creating a logical
representation of the structure of
the database
Themost important task in
database development
Department of Computer Science
Points to Remember
A database must mirror the real
world. Only then can it answer
questions about the real world!
The emphasis of data modeling is
on representing reality
Department of Computer Science
Points to Remember
Ideally it should be a represented
graphically
The goal is to identify the facts to
be stored in the database
Data modeling involves users and
analysts
Department of Computer Science
Thanks
Thinkcontent-fully and strive
forcefully
Department of Computer Science
In the name of ALLAH
Introduction to Database
Systems
Lecture 5
(28-10-10)
Fall 2010
Data Model
Created using a data model
Data Model: is a set of tools or
constructs that is used to
construct a database design
Department of Computer Science
Components of a DM
Structures
Manipulation language
Integrity constraints
Beep beep, caution
Department of Computer Science
Significance of DM
Facilitatesand provides
guidelines or rules in the DB
design process
Every DBMS is based on a
DM
Department of Computer Science
Types of Data Models
Semantic: Entity-Relationship,
Object-Oriented
Record based: Hierarchical,
Network, Relational
Department of Computer Science
DB Design Types
Conceptual: using SDM
Logical: using DM of tool
Physical: using the DBMS
Department of Computer Science
Introduction to
Relational Data Model
Department of Computer Science
Two Major Strengths
Simplicity
Strong Mathematical Foundation
Department of Computer Science
Relational Data Model
Presented by E. F. Codd in 1970,
then of IBM
Before Relational Data Model, two
older data models were in use;
Hierarchical, Network
Department of Computer Science
Relational Data Model
FirstDBMS built on Relational
Data Model (RDM) was system
R
Another Relational DBMS built
during those days was INGRES
Department of Computer Science
Basic of RDM
RDM used mainly for external,
conceptual, and to some extent
physical schema
Separation of conceptual and
physical levels makes manipulation
much easier, contrary to previous
data models
Department of Computer Science
Basic of RDM
RDM used for external, conceptual,
and to some extent physical
schema
The basic structure is relation
Both entities and relationships are
modeled using tables/relations
Department of Computer Science
Basics of RDM
Relations physically
represented as tables
Table is a two dimensional
representation of a relation
Consists of rows and columns
Department of Computer Science
Basics of RDM
Columns represent attributes
and rows represent records
Rows, records and tuples all
these terms are used
interchangeably
Department of Computer Science
In the name of ALLAH
Introduction to Database
Systems
Lecture 6
(01-11-10)
Fall 2010
Basic Properties of a Table
1. Each cell of a table contains
atomic/single value
2. Each column has a distinct
name; the name of the
attribute it represents
3. The values of the attributes
come from the same domain
Department of Computer Science
Basic Properties of a Table
3. The order of the columns is
immaterial
4. The order of the rows is
immaterial
5. Each row/tuple/record is
distinct, no two rows can be
same
Department of Computer Science
A table
stID stName clName doB sex
S001 M. Suhail MCS 12/6/84 M
S002 M. Shahid BCS 3/9/86 M
S003 Naila S. MCS 7/8/85 F
S004 Rubab A. MBA 23/4/86 F
S005 Ehsan M. BBA 22/7/88 M
Department of Computer Science
Components of RDM
As discussed in data model
definition
1. Structure (relation/table)
2. Manipulation language (SQL)
3. Integrity constraints (Two)
Department of Computer Science
Mathematical Relations
Consider two sets
A = {x, y} B = {2, 4, 6}
Cartesian product of these sets
A X B= {(x,2), (x,4), (x,6), (y,2), (y,4),
(y,6)}
Department of Computer Science
Mathematical Relations
A relation is some subset of this
Cartesian product, For example,
R1= {(x,2), (y,2),(x,6),(x,4)}
R2 = {(x,4), (y,6), (y,4)}
Department of Computer Science
Mathematical Relations
The same notion of Cartesian
product and relations can be
applied to more than two sets,
e.g. in case of three sets, we
will have a relation of ordered
triplets
Department of Computer Science
Database Relations
Thinking in some real world
scenario
Name = {Ali, Sana, Ahmed, Sara}
Age = {15,16,17,18,…….,25}
Department of Computer Science
Database Relations
Cartesian product of Name & Age
Name X Age= {(Ali,15), (Sana,15), (Ahmed,15),
(Sara,15), …., (Ahmed,25), (Sara,25)}
CLASS = {(Ali, 18), (Sana, 17), (Ali, 20), (Ahmed,
19)}
Department of Computer Science
Database Relations
Let A1, A2, A3, …, An be some
attributes and D1, D2, D3,…, Dn be
their domains
A relation scheme relates certain
attributes with their domain in
context of a relation
Department of Computer Science
Relation Scheme
Can be represented as
R = (A1:D1, A2:D2, ……, An:Dn)
STD = (stId:Text, stName: text,
stAdres:Text, doB:Date) OR
STD(stId, stName, stAdres, doB)
Department of Computer Science
Database Relations
According to this scheme we can have
a relation (instance of this scheme),
like
STD={(stId:S001, stName:Ali, stAdres:
Lahore, doB:12/12/76), (stId:S003,
stName:A. Rehman, stAdres: RWP,
doB:2/12/77)}
Department of Computer Science
Database Relations
STD={(S001, Ali, Lahore, 12/12/76),
(S003, A. Rehman, RWP, 2/12/77)}
stId stName stAdres doB
S001 Ali Lahore 12/12/76
S003 A. Rehman RWP 2/12/77
Department of Computer Science
DB and Math Relations
Properties of DB relations are
similar to those of Mathematical
relations, except
Theorder of columns in
Mathematical relation does matter
Department of Computer Science
Degree and Cardinality
The number of rows in a
relation is its cardinality and
the number of columns is its
degree
Department of Computer Science
Relations Keys
The concept of key and all
different types of keys are
applicable to the Relations
Foreign Key: An attribute of a
table B that is primary key in
another table A
Department of Computer Science
Foreign Key
Consider table EMP and DEPT
EMP (empId, empName, qual, depId)
DEPT (depId, depName, numEmp)
Department of Computer Science
Integrity Constraints
Two main types
Entity integrity constraint
– Primary key cannot have null value
Referential integrity constraint
– Value of Foreign key is either null or
matches with a value in its home
relation
Department of Computer Science
Significance of Constraints
Constraintshelp to maintain the
correctness, validity or integrity
of the database
Like
null constrains, default
value, domain constraint
Department of Computer Science
RDM Components
So far we have studied
structure and integrity constraint
component of the RDM
Remaining;manipulation
language will be discussed later
Department of Computer Science
Thanks
Thinkcontent-fully and strive
forcefully
Department of Computer Science