Professional Documents
Culture Documents
DATABASE MODELING
Entity
It is simply specific object or things in the real world to
represent database.
Example: employee, project, department, book, computer
Entity is represented by rectangular shapes contained an entity
name inside it.
Attributes
Attributes is simply is the characteristics or behaviours that
describe an entity.
On the above example an employee entity has an attributes
like employee name, salary, age and mobile numbers.
A specific entity will have a value for each of its attributes.
For example a specific employee entity may have Name='John
Smith', salary=‘20000', age ='31’, m=‘+251******** ‘
Each attribute has a value set (or data type) associated with it –
e.g. integer, string, sub range, enumerated type, …
Relationships
are represented by DIAMOND shaped symbols.
There are two types relationships.
Weak Relationship is a relationship between Weak and Strong Entities.
Strong Relationship is a relationship between two strong Entities
fundamental of database system CS@SLU
Cont...
17
So on the above example we have student and course entity, Id, Name, Dept,
Age, GPA is attributes for student entity, Id, Name, Credit Hours\2019SZA\
M2…………4.
Is attributes for course entity, enrol is types of relationships entitled between
student and course. this is the ER diagram for the above informations.
Exercise 1
Exercise: Build an ER Diagram for the following information:
A Personnel record management system will have the following two basic data object
categories with their own features or properties:
Employee will have an Id, Name, DoB, Age, Tel and
Department will have an Id, Name, Location
Whenever an Employee is assigned in one Department, the duration of his stay in the
respective department should be registered.
Exercise 2
Build an ER Diagram for the following information:
Patients
Name, Address, Phone #, Age
Drugs
Name, Manufacturer , Expiration Date
Patients are prescribed drugs
Dosage, # Days
fundamental of database system CS@SLU
Relationship Types, Relationship Sets, and Structural
Constraint
25
Relationship
When an attribute of one entity type refers to another entity type.
Represent references as relationships not attributes
A relationship type R among n entity types E1, E2, ..., En
defines a set of associations or a relationship set among entities
from these entity types.
Relationship instances ri
Each ri associates n individual entities (e1,e2, ..., en)
Binary(degree of 2)
A relationship type of degree two is called binary.
Which means the associative relationships between two entity.
R єE1 x E2
E.g. Customer has bank Account
Generalization
a number of entities are brought together into one generalized entity
based on their similar characteristics.
Generalization is taking common attributes from the subclasses and
deriving a common superclass
Specialization
is the opposite of generalization. In specialization, a group of entities is
divided into sub-groups based on their characteristics.
Specialization=> Deriving subclasses from a superclass
Thank you
?