Fundamental of DB (Section 1-2-3)
Fundamental of DB (Section 1-2-3)
tal
of
Databa
se
Agenda
KEY TOPICS DISCUSSED IN THIS PRESENTATION
• What is database(DB)
• Database Schema
DB
objects
DB
Users
Database
Database
administrato End
designer
r users
What is
DBMS ?
Database Management
System. a computer
software application that
interacts with the user
Database
Users :
Actors on the Behind the
scene : scene :
Database Designer /
Administrator Implementor Tool
Database Designer Developers
End user Operators /
Software Maintenance
Engineering
Steps to
built
database
Step 1
Graphical
representatio
n
Entity
Relations
hip
Diagram
(ERD)
Componen
ts of
ERD :
Entity &
Attribute
Entity
Examples :
Student Doctor Courses Department
Attribute
Examples :
Types of Entity
1-Strong entity
Every entity considered strong
emp dependent
Attributes
Types :
• Degree f relationship
• Types of relatonship
• Participation
Relationship
s:
Rules of
relationship:
degree of relationship
• Unary
• Binary
Relationship
s:
Binary: Can have student
enroll
dept
more than one
relationship between
entities.
manager
Name
proj_name
budget
end_date
start_date
phone
employee
name address
ID
Relationship
s:
Relationship
Types :
one to one
one to many
many to
many
Relationship Types
example :
1
emp
1 own car
1
emp
1
Manage Department
1
4
Relationship Types
example :
1 M
customer make order
M 1
account has branch
1
M work Department
emp
Relationship Types
example :
enroll M
Product M
order
Patient M enroll M
doctor
Participation of
Relationship
Entity
Relations
hip
Diagram
(ERD)
Example about scenario
S TE S TE S TE S TE S TE S TE S TE
P
Mapping P
Mapping P
Mapping P
Mapping P
Mapping P
Mapping P
Mapping
of of Weak of Binary of Binary of Binary of N-ary of Unary
Regular Entity 1:1 1:N M:N Relations Relations
Entity Types . Relation Relations Relations hip Types hip
Types . Types . hip Types hip Types
1- Mapping Regular
Entity :
a)Entity
Type with
Simple
attributes
b) Relation
Mapping Regular
Entity :
a)Entity Type
with
Composite
attributes.
b)Relation
Mapping Regular
Entity :
a) Entity Type
with
Multivalued
attributes
b)
Relation
Example with values
Emp_Id Skills
Relatio
n
3- Mapping 1 : 1 Relation
Types :
Put Primary key for partial participate
entity with another entity (total
participate ).
10001 2224 32
10001 2225 34
10002 2223 35
10003 2224 36
An ER
diagram for
the
COMPANY
database.
An
Schem
a
diagra
m for
the
COMP
A NY
datab
as e.
3 Examples and
Exercises
An ER
diagram for
a BANK
database
Types of constraints
• NOT NULL Constraint: Ensures that a column cannot have NULL value.
• DEFAULT Constraint: Provides a default value for a column when none
is specified.
• UNIQUE Constraint: Ensures that all values in a column are different.
• PRIMARY Key: Uniquely identified each rows/records in a database
table.
• FOREIGN Key: Uniquely identified a row/record in any other database
table.
• CHECK Constraint: The CHECK constraint ensures that all values in a
column satisfy certain conditions.
• INDEX: Use to create and retrieve data from the database very quickly.