0% found this document useful (0 votes)
28 views22 pages

FDB Lecture03

Uploaded by

jsherzad733
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views22 pages

FDB Lecture03

Uploaded by

jsherzad733
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Jawzjan University

Computer Learning Department

Fundamentals of
Database
Prepared by: Khudaydad MAHMOODI
Overview
 Database Design
 Entity Relationship Model (E-R Model)
 Entities

 Types of Entities
 Attributes

 Types of Attributes
 Relationships

 E-R Diagrams
Database Design
 Conceptual design
Build a model independent of the choice of DBMS

 Logical design
Create the database in a given DBMS

 Physical design
How the database is stored in hardware
Entity Relationship Model
 Give a conceptual view of the database
 Are independent of the choice of DBMS
 Can identify some problems in a design
 The most used and popular model for the
conceptual design
Entities
 Entities represent objects or things of interest
 Physical things like:
students, teachers, employees, products
 More abstract things like:
subjects, orders, projects
Entities
 Entity Type
 An entity type is a collection of entities

 Entity Instance
 A single occurance of an entity type
Types of Entity
 Strong Entity
 An independent entity, unique

 Weak Entity
 Dependent on a specific strong entity
Attributes
 Attributes are properties or characteristics of an
entity
 Usually denoted by a field
 Students have IDs, names, ages, addresses, …
 Subjects have codes, titles, credit weights, levels, …
Types of Attributes
 Simple or atomic attribute
 Composite Attribute
 Single-value attribute
 Multi-value attribute
 Stored Attribute
 Derived attribute
Simple or atomic attribute
Attributes that can’t be divided into subparts are
called Simple or Atomic attributes. For example,
employee number, age, gender, etc of a person are
simple or atomic attributes.
Composite attribute
Composite attributes can be divided into smaller
subparts. These subparts represent the basic
attributes with independent meanings of their own.
For example, take (full_name) attributes. We can
divide it into sub-parts like (first_name),
(middle_name), and (last_name).
Single-value attribute
Attributes that can have single value at a particular
instance of time are called single valued. A person
can’t have more than one age value. Therefore, age
of a person is a single-values attribute.
Multi-value attribute
A multi-valued attribute can have more than one
value at one time. For example, degree of a person
is a multi-valued attribute since a person can have
more than one degree. Where appropriate, upper
and lower bounds may be placed on the number of
values in a multi-valued attribute. For example, a
bank may limit the number of addresses recorded
for a single customer to two. Such attributes are
represented by double ovals in ER diagram.
Stored attribute
The stored attribute are such attributes which are
already stored in the database and from which the
value of another attribute is derived is called stored
attribute. For example age of a person can be
calculated from person’s date of birth and present
date. Difference between these two dates gives the
value of age. In this case, date of birth is a stored
attribute and age of the person is the derived
attribute.
Derived attribute
The derived attributes are such attributes for which the
value is derived or calculated from stored attributes. For
example date of birth of an employee is the stored attribute
but the age is the derived attributed. Derived attributes are
usually created by a formula or by a summary operation on
other attributes. Take another example, if we have to
calculate the interest on some principal amount for a given
time, and for a particular rate of interest, we can simply use
the interest formula
Interest=(N*P*R)/100;
In this case, interest is the derived attribute whereas
principal amount (P), time (N) and rate of interest(R) are all
stored attributes.
Relatioships
 Relationships are an association between two or
more entities
 Each Student takes several Subjects
 Each Subject is taught by a Teacher
 Each Employee works for a single Department
Relatioship Types (Cardinality Ratio)
 One-to-one (1:1)
 One-to-many (1:N)
 Many-to-one (N:1)
 Many-to-many (M:N)
Relatioship Types (Cardinality Ratio)
 One-to-one (1:1)

Teacher has Office


Relatioship Types (Cardinality Ratio)
 One-to-many (1:N)
Subject

Teacher teaches Subject

Subject
Relatioship Types (Cardinality Ratio)
 Many-to-one (N:1)

Student

Student study in Department

Student
Relatioship Types (Cardinality Ratio)
 Many-to-many (N:N)

Student Subject

Student takes Subject

Student Subject
E-R Diagram
Name

 Many-to-many (N:N) Author ID Last Name

Price
Title Phone

ISBN Book writes Author

Author ID

pulishes
Publisher ID

Name
Publisher
Phone

You might also like