2. Part # 2
OUTLINE
Database Concepts
Database Management System
Architecture
ERD model
Entity Relationship Notation
Understand concepts of cardinality ratio
Understand concepts of Participation
3. Part # 2
Database Concepts
Data:
Known facts that can be recorded.
Database:
A collection of related data.
For Example:
Names, telephone numbers, and addresses of the people you
know.
You may have recorded this data in an indexed address book
or you may have stored it on a hard drive, using a personal
computer and software such as Microsoft Access.
This collection of related data with an implicit meaning is a
database.
3
4. Part # 2
Database Concepts
Data models:
A group of concepts that describe the database structure that
contain different data types, relationships and constraints.
Entity:
Describing a real world object.
Example: employee, student, and courses.
It corresponds to a table that contains a collection of attributes.
The entity can be a person, place, event or an object that help
the organization to maintain its data.
4
5. Part # 2
Database Concepts
Attribute:
It can be described as a property to the entity.
For example, if we have an entity is called an employee, this
entity can have attributes such as name, age and salary.
An attribute corresponds to a column or field in a table.
The number of attributes is called the degree.
Tuple:
corresponds to a row in a table.
5
6. Part # 2
Database Concepts
Relationship:
It describes how entities related to each other.
Primary key:
An attribute which is a unique identifier in a table.
The primary key can be consisting of one attribute or combination of
attributes which called a composite key.
The value of the primary key cannot be repeated in the same column.
Foreign Key:
Is an attribute or set of attributes in a table that matches the primary key of
another table.
Used to represent relationship between tuples of two relations.
Composite Key:
a primary key that consists of more than one attribute
6
8. Part # 2
Example
Relation Name ?……………………...........
Number of Tuples?…………………………
Example of Attribute: ………………………
Degree of relation?…………………………
Primary Key?.............................................
11. Part # 2
Properties of Entities
• The Entity has a name that is distinct from all other
Entity names in the relational database.
• Each attribute has a distinct name.
• The values of an attribute are all of the same
domain.
• Each tuple is distinct. There are no duplicate tuples.
• The order of attributes has no significance.
• The order of tuples has no significance.
12. Part # 2
Database Concepts
12
Database Management System (DBMS): software that is
used to create, maintain and update databases. It has an
interface which can be menu based or graphic based or form
based or can be a collection of all these forms.
Database administrators (DBA):
Responsible for the whole database including construction,
implementation, access privileges and authorization.
13. Part # 2
Database Management System
Architecture
The DBMS has three main
levels they are:
1- Internal level: that describes
the physical data model,
2- Conceptual level: Describes
structure of the whole database
for a community of users.
3- External level: Describes part
of the database that a particular
user group is interested in.
and hide other parts.
13
Figure 2.1 shows the three main levels
of the database Architecture
USER
VIEW
EXTENAL
LEVEL
CONCEPTUAL
LEVEL
INTERNA
LEVEL
14. Part # 2
Data Independence
Capacity to change the schema at one level of a
database system Without having to change the
schema at the next higher level
Types of data independence :
Logical
Physical
15. Part # 2
Types of data independence
Logical
is the capacity to change
the conceptual schema
without having to change
external schemas or
application programs.
Physical
is the capacity to change
the internal schema
without having to change
the conceptual schema.
16. Part # 2
What is ERD model?
ERD stands for the Entity Relationship Diagram that describes
the representation of data including entities, attributes and
relationships within an organization. It is considered one of the
critical phases in the designing of databases.
Figure 2.2 shows a simple example for an ERD for a school
16
17. Part # 2
Entity Relationship Notation
There are common notations used all over the world for
the database.
There are many tools help designers to draw the ERD
with its different notations such as Microsoft Visio or
the Oracle Designers.
Most of these tools eliminate the diamond relationship
and show the attributes inside the entity rectangle
related to these attributes.
17
18. Part # 2
18
The major activity of this phase is identifying:
Relationships
Entities
Attributes
Entity Relationship Notation
20. Part # 2
Notations for ER Diagram
In the ER Model, the notations 1-1, 1-M, M-M used to represent the
Cardinality ratio.
the participation is representing as double line for the total
participation and one line for the partial participation as shown in
Figure 2.5.
20
Figure 2.5 shows database notation used in this course
21. Part # 2
Strong entity: can be defined as the entity that can stand alone
without the needs for other entities such as the student entity, the
department entity and the Instructor entity and is represented by a
single rectangle.
21
Figure 2.6 shows an ERD with strong entities
22. Part # 2
Weak entity: is the opposite of the strong entity which can be
defined as the entity that depends on another entity .it can be
represented in the ERD as a doubled line rectangle. The relation
between the weak entity and the owner entity is called the identifying
relationship and is represented in the ERD as doubled line diamond
22
Figure2.7 shows an ERD with a weak entity
Notations for ER Diagram
23. Part # 2
Multi-valued attribute: This can be defined as the attribute that can
have more than one value such as spoken languages "Arabic and
English" can be represented in the ERD as an ellipse with double lines.
23
Figure 2.9 shows a multi-valued attribute
Notations for ER Diagram
24. Part # 2
Derived attribute: an attribute that can be calculated from another
attribute, such as the age attribute which can be calculated from the
date of birth attribute
24
Figure 2.10 shows a derived attribute
Notations for ER Diagram
26. Part # 2
Activity 1
Identify entities and attributes?
Cars
Phone Number
Salary
Products
Date
Height
Employees
26
27. Part # 2
Activity 2
Assume that you are designing a database
for school, what are the possible Entities,
Attributes and Keyes for the database?
27
28. Part # 2
What is the cardinality ratio
28
It can be defined as the number of instances of an
entity that can be associated, participated or in a
relationship with another entity.
It can be divided into Three main types :
o One to One (1:1)
o One to Many (1: M)
o Many to Many (M: M )
29. Part # 2
29
A department must have only one employee, while the
employee must work in only one department .
Figure 2.14 shows I-I relationship
Example #1
30. Part # 2
A department may have numbers of employee and each
employee must work only in one department
Figure 2.13 shows I-M relationship
30
Example #2
31. Part # 2
31
Example #3
A department may have many employees, while the
employee may work in more than department.
Figure 2.15 shows M-M relationship with partial participation
32. Part # 2
32
What is the Participation
Participation in database is used to describe how
the degree of participation that the entity will have
in the relationship.
There are two main types of participation:
o Total participation : represented by two lines
o Partial participation : represented by only single
line.
33. Part # 2
1- A department must employ an employee and the
employee must be employed by a department.
Figure 2.17 shows total participation from both sides
33
Participation Examples
34. Part # 2
2- A department must employ an employee, while the
employee need not to be employed by a department
Figure 2.18 shows total participation from one side and partial participation from another side
34
Participation Examples
35. Part # 2
3-A department may not need to employee any employee
and the employee needs not to be employed by a
department
Figure 2.19 shows partial participation from both sides
35
Participation Examples
36. Part # 2
Activity 3
36
What are the cardinality and participation types that are
suitable for this relation?