10/13/2024
Problem identification
Analysis
Logical Design
Physical Design
Mapping
Implementation
Testing & Maintenance
2
Database Administrator (DBA)
System Analysts
Database Designer
Database Developer
Application programmers
BI & BigData Specialist (Data Scientist)
End users
10/13/2024 ERD Concepts
Entity-Relationship Diagram (ERD)
identifies information required by the business by
displaying the relevant entities and the relationships
between them.
Basic constructs of the E-R model:
1. Entities - person, place, object, event, concept (often
corresponds to a real time object that is distinguishable
from any other object)
2. Attributes - property or characteristic of an entity type
(often corresponds to a field in a table)
3. Relationships – link between entities (corresponds to
primary key-foreign key equivalencies in related tables)
10/13/2024 ERD Concepts
access-date
cust-name number
cust-id
customer has account
cust-street
cust-city balance
Rectangles: entity sets
Diamonds: relationship sets
Ellipses: attributes
10/13/2024 ERD Concepts
A Strong Entity- An Entity set that has a primary key.
A Weak Entity- An entity set that do not have sufficient
attributes to form a primary key.
Partial key: A set of attributes that can be associated with P.K of an
owner entity set to distinguish a weak entity.
10/13/2024 ERD Concepts
1. Composite Attribute
2. Multi-valued Attribute
3. Derived Attribute
4. Complex Attribute
5. Simple Attribute
10/13/2024 ERD Concepts
access-date
cust-name number
cust-id
customer has account
cust-street
cust-city balance
10/13/2024 ERD Concepts
First Last
number
Name
date-of-birth customer has account
balance
month day year
10/13/2024 ERD Concepts
age number
date-of-birth
Emp has account
Salary
Deduction Net Salary balance
derived (dashed ellipse)
10/13/2024 ERD Concepts
number
address
customer has account
phone no. balance
multi-valued (double ellipse)
10/13/2024 ERD Concepts
Street City Country number
address
customer has account
balance
multi-valued + Composite
10/13/2024 ERD Concepts
A Relationship is an association among several entities.
A relationship may also have attributes
For example, consider the entity sets customer and loan and the relationship set
borrower. We could associate the attribute date-issued to that relationship to specify
the date when the loan was issued.
10/13/2024 ERD Concepts
Relation has three Properties:
Degree of Relationships
Cardinality Constraint
Participation Constraint
Degree: number of entity types that participate in a relationship
Three cases
Unary: between two instances of one entity type
Binary: between the instances of two entity types
Ternary: among the instances of three entity types
• Recursive Relationships - A relationship in which the same entity
participates more than once.
18
A binary relationship set is of degree 2.
19
ternary relationship set is of degree 3.
How many instances of one entity will or must be connected to a
single instance from the other entities.
One-One Relationship
One-Many Relationship
Many- Many Relationship
One-to-One 1 1
Employee own Car
One-to-Many Department
1
has
M
Employee
Many-to-Many M M
Course take Student
10/13/2024 ERD Concepts
An employee MUST work for a department
An employee entity can exist only if it participates in a
WORKS_FOR relationship instance
So this participation is TOTAL
Only some employees manage departments
The participation is PARTIAL
PARTICIPATION CONSTRAINT
Employee Has Car
-An Employee may have a car.
-A Car must be assigned to particular employee
PARTICIPATION CONSTRAINT
Department Hire Employee
- A department may hire many employees ( Zero or more)
- An employee must be employed by a department
(Department membership is Optional, Employee membership is
Mandatory)
Different Types of Keys:
1. Candidate Key
2. Primary Key
3. Foreign Key
4. Composite Key
5. Partial Key
6. Alternate key
7. Super Key
10/13/2024 ERD Concepts
Candidate key: is a set of one or more attributes whose value can
uniquely identify an entity in the entity set
Any attribute in the candidate key cannot be omitted without destroying the
uniqueness property of the candidate key.
Example:
(SSN, Name) is NOT a candidate key .
“SSN” is a candidate key of customer.
Candidate key could have more than one attributes.
10/13/2024 ERD Concepts
Example: Both “SSN” and “License #” are candidate keys
of Driver entity set.
Primary Key: is the candidate key that is chosen by the
database designer as the unique identifier of an entity.
[Unique & Not Null]
Primary key May be Composite
10/13/2024 ERD Concepts
The key is underlined
10/13/2024 ERD Concepts
Identifying relationship is links strong entities to weak entities and represented with double line diamond
10/13/2024 ERD Concepts
Case 1
A big company has decided to store information about its projects and employees in a database.
The company has wisely chosen to hire you as a database designer. Prepare an E-R diagram for
this Company according to The following Description:
The company has a number of employees each employee has SSN, Birth Date, Gender and Name which
represented as Fname and Lname.
The company has a set of departments each department has a set of attributes DName, DNUM (unique)
and locations.
Employees work in several projects each project has Pname, PNumber as an identifier, Location and
City.
Each employee may have a set of dependent; each dependent has Dependent Name (unique), Gender, and
Birth Date.
Note: if the employee left the company no needs to store his dependents info
For each Department, there is always one employee assigned to manage that Department and each
manager has a hiring Date
Department may have employees but employee must work on Only One department
Each department may have a set of projects and each project must assigned to one department
Employees work in several projects and each project has several employees and each employee has a
number of working hours in each project
Each employee has a supervisor
10/13/2024 ERD Concepts
10/13/2024 ERD Concepts
10/13/2024 ERD Concepts