1 Phases of Database Design: Lesson 3 - Data Modelling
1 Phases of Database Design: Lesson 3 - Data Modelling
1 Phases of Database Design: Lesson 3 - Data Modelling
PAG. 1
Databases 2022/2023
Once the requirements have been collected and analyzed, the next step is to
create a conceptual schema for the database, using a high-level conceptual data
model. This step is called conceptual design.
The conceptual schema is a concise description of the data requirements of the
users and includes detailed descriptions of the entity, relationships, and
constraints; these are expressed using the concepts provided by the high-level
data model. Because these concepts do not include implementation details, they
are usually easier to understand and can be used to communicate with
nontechnical users.
The high-level conceptual schema can also be used as a reference to ensure that
all users’ data requirements are met and that the requirements do not conflict.
This approach enables database designers to concentrate on specifying the
properties of the data, without being concerned with storage and
implementation details.
During or after the conceptual schema design, the basic data model operations
can be used to specify the high-level user queries and operations identified
during functional analysis. This also serves to confirm that the conceptual
schema meets all the identified functional requirements. Modifications to the
conceptual schema can be introduced if some functional requirements cannot
be specified using the initial schema.
The next step in database design is the actual implementation of the database,
using a commercial DBMS. Most current commercial DBMSs use an
implementation data model—such as the relational or the object-relational
database model—so the conceptual schema is transformed from the high-level
data model into the implementation data model. This step is called logical design
or data model mapping; its result is a database schema in the implementation
data model of the DBMS. Data model mapping is often automated or
semiautomated within the database design tools.
PAG. 2
Databases 2022/2023
During this last step, the internal storage structures, file organizations,
indexes, access paths, and physical design parameters for the database files
are specified. In parallel with these activities, application programs are
designed and implemented as database transactions corresponding to the
high-level transaction specifications.
PAG. 3
Databases 2022/2023
2 ENTITY-RELATIONSHIP MODEL
The Entity-Relationship model was proposed by Peter Chen in 1976. The entity-
relationship model is one of the most popular conceptual database design tools existing
today. It displays the relationship of entity sets stored in a database.
The ER Model describes data as entities, relationships, and attributes
3 Entities
An entity is a thing in the real world with an independent existence. An entity may be an
object with a physical existence (for example, a particular person, car, house, or
employee) or it may be an object with a conceptual existence (for instance, a company,
a job, or a university course).
Entities are represented as a rectangular box enclosing the entity name. A weak entity
is distinguished by surrounding its box with double lines. Use a general, singular noun.
Example: Person, Organization, Customer, Invoice.
4 Relationships
A relationship is defined as an association among two or more entities.
Relationships are displayed as diamond-shaped boxes, which are connected by straight
lines to the rectangular boxes representing the participating entities. The relationship
name is written inside the diamond-shaped box. You use a verb that connects two (or
more) nouns (the entities). You should always use meaningful names.
PAG. 4
Databases 2022/2023
• Binary (degree 2)
• Ternary (degree 3)
• Unary (degree 1) or reflexive: Here, the same entity type participates more than
once in a relationship type with a different role for each instance.
4.1 PARTICIPATION
Relationships have certain constraints that limit the possible combinations of entity
instances that may participate in the corresponding relationship set. These constraints
are determined from the mini world situation that the relationships represent.
PAG. 5
Databases 2022/2023
The ER model introduces the (min, max) notation to specify an interval of possible
participations in a relationship:
An entity of type E1 may be related to at least m1 and at most n1 entities of type E2.
Likewise, m2 is the minimum number and n2 is the maximum number of E1 entities to
which an E2 entity is related.
Types of participation
• (0, 1)
• (1, 1)
• (0, n)
• (1, n)
Minimum participation tells whether the participation is partial or total.
• If minimum cardinality = 0, then it signifies partial participation.
• If minimum cardinality = 1, then it signifies total participation.
-
4.2 CARDINALITY
Cardinality constraint defines the maximum number of relationship instances in which
an entity can participate.
PAG. 6
Databases 2022/2023
• 1: 1 (one to one)
• 1: N (one to many)
• M: N (many to many)
• For the Tasks Entity: given a department and an employee (an employee in a
department), how many tasks do they perform? (1, N)
• For the Employee Entity: given a department and a task (a task of a department),
how many employees does it perform? (1, N)
• For the Department Entity: given an employee and a task in how many
departments is it performed? (1, 1)
PAG. 7
Databases 2022/2023
5 Attributes
Each entity is described by a set of attributes (e.g., Employee = (Name, Address,
Birthdate (Age), Salary). An attribute is a property or characteristic of an entity.
The names of the attributes are enclosed in ovals and are attached to their entity type
by straight lines. The Key attribute is underlined.
The key attribute is the set of attributes whose values can be used to identify each entity
element uniquely.
A primary key that is made up of more than one attribute is known as a composite key.
An attribute can be allocated to an entity or to a relationship.
Types of attributes
Several types of attributes occur in the ER model:
PAG. 8
Databases 2022/2023
5.1 Domains
In ER model a domain is a set of values for an attribute.
Attribute Domain
DNI String of 10 characters
Name String of 10 characters
Birthdate Date
Address String of 100 characters
Salary Real numbers
Age Integer numbers
Department Human resources, Marketing, Information Technology,
Administration, Sales
6 Weak Entities
The relationship between a strong entity and a weak entity is also weak. This relationship
has a dependency that can be of two types:
• Existence dependency: The occurrence of a weak entity has no sense without the
presence of the strong entity.
PAG. 9
Databases 2022/2023
PAG. 10