0% found this document useful (0 votes)
18 views57 pages

Chapter 5

Chapter 5 of the document discusses data modeling in database systems, outlining its objectives, types, and processes. It explains various data models including hierarchical, network, relational, object-oriented, and entity-relationship models, each serving different purposes in database design. The chapter also details the steps involved in the data modeling process, from identifying entities to creating database constraints.

Uploaded by

Faridah
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)
18 views57 pages

Chapter 5

Chapter 5 of the document discusses data modeling in database systems, outlining its objectives, types, and processes. It explains various data models including hierarchical, network, relational, object-oriented, and entity-relationship models, each serving different purposes in database design. The chapter also details the steps involved in the data modeling process, from identifying entities to creating database constraints.

Uploaded by

Faridah
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/ 57

ISLAMIC UNIVERSITY IN UGANDA

Bridging Communities

DATABASE SYSTEMS
Chapter 5 : Data Modeling

Dr. Guma Ali


Objectives (1/1)
At the end of the chapter, the student should be able to:
• Differentiate between data model and data modeling.
• State the types of data models.
• Examine the purposes of data modeling.
• List the key concepts in data modeling.
• Outline the objectives of data modeling.
• Explain with relevant examples, the three types of data
models in databases.
• Describe the steps followed during the data modeling
process. 2
Data Model (1/15)
• A data model is a conceptual framework or blueprint
that defines how data is structured, stored, and
accessed in a database system.
• It specifies the relationships between data elements, the
rules governing the data, and how different data entities
are related to each other.
• Data models act as a guide for designing databases and
ensure that the data is organized efficiently to meet the
needs of an application. 3
Data Model (2/15)

4
Data Model (3/15)
❑ Hierarchical data model
• The hierarchical data model organizes data into a tree-
like structure, where each record (or node) has a single
parent and zero or more children, resembling a
hierarchy.
• Data is stored as a collection of records that are
connected by links in a parent-child relationship.
• Each parent can have multiple children, but each child
can have only one parent, forming a strict hierarchy. 5
Data Model (4/15)

6
Data Model (5/15)
❑ Network data model
• The network data model is an extension of the
hierarchical model that allows more complex
relationships by enabling multiple parent-child
relationships.
• It uses a graph structure where nodes (records) are
connected by edges (links).
• Data is stored in records, and relationships between
these records are represented as sets. 7
Data Model (6/15)
• Unlike the hierarchical model, a child node can have
more than one parent node, allowing many-to-many
relationships.

8
Data Model (7/15)
❑ Relational data model
• The relational data model organizes data into tables
(also called relations) that consist of rows (tuples) and
columns (attributes).
• Relationships between data are established through the
use of keys (primary keys and foreign keys) rather than
by explicit pointers.
• Data is stored in tables, with each table representing an
entity (e.g., a customer, product, etc.). 9
Data Model (8/15)
• Each row in the table represents a record, and each
column represents an attribute of the entity.
• Relationships are defined using foreign keys that link
related records in different tables.

10
Data Model (9/15)

11
Data Model (10/15)
❑ Object-oriented data model
• The object-oriented data model integrates the principles
of object-oriented programming into databases.
• Data is represented in the form of objects, which
encapsulate both the data (attributes) and the behavior
(methods) that operate on the data.
• Similar to how objects are defined in object-oriented
programming, the data model organizes data into
classes (blueprints) with attributes and methods. 12
Data Model (11/15)
• Objects can inherit properties and behaviors from
parent classes, supporting concepts like inheritance,
encapsulation, and polymorphism.

13
Data Model (12/15)
❑ Entity-relationship model (ER model)
• The entity-relationship (ER) model is a high-level data
model used in database design to visually represent
entities, their attributes, and the relationships between
them.
• It uses diagrams (ER diagrams) to map out the structure
of the database at a conceptual level.

14
Data Model (13/15)
• The ER model uses entities (representing objects or
things) and relationships (representing associations
between entities).
• Entities are represented as rectangles, relationships as
diamonds, and attributes as ovals.
• Lines are used to connect entities to their relationships
and attributes.

15
Data Model (14/15)

16
Data Model (15/15)

• Each of these data models serves different purposes,


and the choice of which to use depends on the specific
requirements of the application and the complexity of
data relationships.
17
Data Modeling (1/2)
• Data modeling is a process used to define and structure
data in a way that makes it easier to understand,
manipulate, and retrieve from a database.
• It involves defining data elements, relationships, and
constraints to represent real-world entities and the
relationships between them.
• It serves as a blueprint for the design and development
of a database, ensuring that data elements and their
relationships are accurately represented. 18
Data Modeling (2/2)
• Data modeling is essential in database design as it
provides a clear plan that guides how data will be
stored, accessed, and manipulated.

19
Key Concepts in Data Modeling (1/1)

20
Objectives of Data Modeling (1/3)

21
Objectives of Data Modeling (2/3)

22
Objectives of Data Modeling (3/3)

23
Types of Data Models in Databases
(1/19)
• There are three primary types of data models in
database systems, each serving different purposes
depending on the level of abstraction:

24
Types of Data Models in Databases
(2/19)
 Conceptual data model
• Conceptual data model is the process of creating a
high-level, abstract representation of the data that an
organization uses.
• A conceptual data model identifies the entities that
describe the data and relationships between them and
not attributes or primary keys.
• Often used for understanding the needs of business
stakeholders and does not involve any technical details. 25
Types of Data Models in Databases
(3/19)
• Conceptual models are usually created as part of the
process of gathering initial project requirements.
• The features of conceptual data model include:
 The important entities and the relationships among
them.
 No attribute is specified.
 No primary key is specified.
 Usually represented by an ERD.
26
Types of Data Models in Databases
(4/19)
• The components of conceptual data model are:
o Entities: Represent real-world objects (e.g.,
customer, product, order).
o Relationships: Define how entities interact with
each other (e.g., customers place orders).
▪ For example,
• For a Retail Business, the conceptual model might
include:
27
Types of Data Models in Databases
(5/19)
• Entities:
 Customer,
 Order,
 Product.
• Relationships:
o A Customer can place multiple Orders.
o An Order contains multiple Products.

28
Types of Data Models in Databases
(6/19)
 Logical data model
• Logical data model expands on the conceptual model
by specifying detailed attributes of each entity, as well
as the relationships and constraints.
• A logical data model uses entities, attributes,
relationships, cardinality, and primary keys and foreign
keys, and constraints to describe the entity set for each
table in a relational database.
29
Types of Data Models in Databases
(7/19)
• It uses graphical representations such as ERD to
illustrate the relationships between data entities,
attributes, and their cardinalities.
• The features of a logical data model include:
 All entities and relationships among them.
 All attributes for each entity are specified.
 The primary key for each entity is specified.
 Foreign keys are specified.
 Normalization occurs at this level. 30
Types of Data Models in Databases
(8/19)
• Provides a more detailed view than the conceptual
model.
• Ensures the model is consistent with business rules and
functional requirements.
• The logical data model provides the foundation for
creating physical data models.
• The components of logical data model are:
o Entities: Represent real-world objects (e.g.,
customer, product, order).
31
Types of Data Models in Databases
(9/19)
o Attributes: Describe details of the entities (e.g.,
customer name, product price).
o Relationships: Define how entities interact with
each other (e.g., customers place orders).
o Keys:
✓ Primary Key: Uniquely identifies each record in
a table (e.g., Customer ID).
✓ Foreign Key: Links two tables together (e.g.,
Order ID linking to Customer ID).
32
Types of Data Models in Databases
(10/19)
▪ For example,
• For the Retail Business, the logical model might
include:
 Customer:
o Attributes: Customer_ID (Primary Key), Name,
Email, Phone.
 Order:
o Attributes: Order_ID (Primary Key),
Order_Date, Customer_ID (Foreign Key). 33
Types of Data Models in Databases
(11/19)
 Product:
o Attributes: Product_ID (Primary Key),
Product_Name, Price.

34
Types of Data Models in Databases
(12/19)
 Physical data model
• Physical data model describes the actual
implementation of the database, focusing on how the
data will be stored, accessed, and managed by the
DBMS.
• It defines the actual database structure that will be built
in the database, including all tables, columns, primary
keys and foreign keys used to identify the relationships
between tables. 35
Types of Data Models in Databases
(13/19)
• It involves translating the logical data model into a
specific database schema that can be implemented in a
particular DBMS (e.g., MySQL, PostgreSQL, Oracle).
• In physical data modeling, the designer also defines the
data types, lengths, and other properties of each
column.
• The steps for physical data model design are:
 Convert entities into tables.
36
Types of Data Models in Databases
(14/19)
 Convert relationships into foreign keys.
 Convert attributes into columns.
 Modify the physical data model based on physical
constraints.
• The components of physical data model are:
o Tables: Define the actual structure with specific
data types.
o Indexes: Created to speed up queries by indexing
frequently searched fields. 37
Types of Data Models in Databases
(15/19)
o Constraints: Rules that ensure data integrity (e.g.,
NOT NULL, UNIQUE).
▪ For example,
• For the Retail Business, the physical model might
include:
 Customer Table:
o Columns: Customer_ID INT PRIMARY KEY,
Name VARCHAR(255), Email VARCHAR(255),
Phone VARCHAR(20).
38
Types of Data Models in Databases
(16/19)
 Order Table:
o Columns: Order_ID INT PRIMARY KEY,
Order_Date DATE, Customer_ID INT FOREIGN
KEY, Product_ID INT FOREIGN KEY.
o Indexes: Index on Customer_ID for faster querying.
 Product Table:
o Columns: Product_ID INT PRIMARY KEY,
Product_Name VARCHAR(255), Price
DECIMAL(10,2).
39
Types of Data Models in Databases
(17/19)
• By creating a well-designed data model, database
developers can help ensure that their systems are
efficient, flexible, and able to meet the needs of their
users both now and in the future.
• The following chart describes the different features that
are usually included on each of these three models:

40
Types of Data Models in Databases
(18/19)

41
Types of Data Models in Databases
(19/19)
• These three types of data models - conceptual, logical,
and physical - provide a structured and layered
approach to designing a database, moving from a high-
level abstraction of the data to a DBMS-specific
implementation.
• Each plays a critical role in ensuring that the data is
organized efficiently and meets both business and
technical requirements.
42
Data Modeling Process (1/12)
Step 1. Identifying entities

• The process of data modeling begins with the


identification of the things, events or concepts that are
represented in the data set that is to be modeled.

• Each entity should be cohesive and logically discrete


from all others.

• This step is a part of conceptual data modeling.

43
Data Modeling Process (2/12)
o For example, when visualizing a grocery shop
database, we would have entities such as Products,
Orders, and Customers, as shown below:

44
Data Modeling Process (3/12)
Step 2. Identifying relationship between entities

• The earliest draft of a data model will specify the


nature of the relationships each entity has with the
others.

• This step is part of conceptual data modeling.

o For example, each customer would have one or


more orders, and each order would have one or
more products.
45
Data Modeling Process (4/12)

46
Data Modeling Process (5/12)
Step 3. Identifying entities’ attributes

• Each entity is assigned its attributes; this becomes the


base for the physical data model.

• This step is part of logical data modeling.

o For example, each order would have an order_id,


a customer who placed the order (customer_id),
and products ordered:

47
Data Modeling Process (6/12)

48
Data Modeling Process (7/12)
Step 4. Deciding attributes’ specific data types

• This step is part of physical data modeling.

• Here, we assign database-specific data types to the


attributes of each entity.

o For example, an order_id would be an INTEGER


and a customer name would be VARCHAR.

49
Data Modeling Process (8/12)

50
Data Modeling Process (9/12)
Step 5. Identifying many-to-many relationships and
implementing junction tables
• This step is also part of the physical data modeling.
• Here, we create an additional table that stores many-
to-many relationship data.
o For example, each order can have one or more
products, and at the same time, each product can
be ordered zero or more times.
51
Data Modeling Process (10/12)

52
Data Modeling Process (11/12)
Step 6. Creating database constraints, indices, triggers,
and other database-specific objects
• This step is part of physical data modeling.
• It focus on implementing database-specific features.
o For example, let’s mark the primary keys and
foreign keys (if needed) for each table.

53
Data Modeling Process (12/12)

54
Reading Lists (1/2)
1. Silberschatz, A., Korth, H. F., & Sudarshan, S. (2020).
Database System Concepts (7th ed.). New York: McGraw-
Hill.
2. Lemahieu, W., Broucke, V. S., & Baesens, B. (2018).
Principles of database management: The practical guide to
storing, managing and analyzing big and small data.
Cambridge University Press.
3. Elmasri, R., & Navathe, S. (2017). Fundamentals of
Database Systems (7th ed.). Pearson India
55
Reading Lists (2/2)
4. Jukic, N., Vrbsky, S., & Nestorov, S. (2016). Database
systems: Introduction to databases and data warehouses.
Prospect Press.
5. Connolly, T., & Begg, C. (2015). Database Systems: A
Practical Approach to Design, Implementation, and
Management (6th ed.). Essex, Harlow, England: Pearson
Education Limited.
6. Hoffer, J. A., Ramesh, V., & Heikki, T. (2013). Modern
Database Management (11th ed.). Boston, U.S: Pearson
Education Limited. 56
57

You might also like