0% found this document useful (0 votes)
43 views26 pages

Topic 5. Data Models: Hneu, Department of Information Systems, Databases Course, V. V. Fedko

The document discusses various data models including hierarchical, network, relational, entity-relationship, and object-oriented models. It defines key components of data models such as entities, attributes, and relationships. It also compares the relational and entity-relationship models and notes that the ER model adds relationships between tables to the relational model. Finally, it provides an example ER model diagramming the relationship between students and the courses they take.
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)
43 views26 pages

Topic 5. Data Models: Hneu, Department of Information Systems, Databases Course, V. V. Fedko

The document discusses various data models including hierarchical, network, relational, entity-relationship, and object-oriented models. It defines key components of data models such as entities, attributes, and relationships. It also compares the relational and entity-relationship models and notes that the ER model adds relationships between tables to the relational model. Finally, it provides an example ER model diagramming the relationship between students and the courses they take.
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/ 26

Topic 5.

Data models

HNEU,
Department of Information Systems,
Databases Course,
V. V. Fedko
Contents
1. Data modelling
2. Classification of models
3. Advantages and Disadvantages of Various Data Models
4. Degrees of data abstraction

HNEU, Department of Information Systems, Course Database, V. V. Fedko 2


Test questions
En: Ru:
1. Describe data model components. 1. Опишите компоненты модели
данных.
2. Compare relational and ER models
2. Сравните реляционную и ER модели
3. Create a physical ER model that
contains two entities: a Student and a 3. Постройте физическую ER модель,
Telephone (one student may have которая содержит две сущности:
several phone numbers). Студент и Телефон (у одного
студента может быть несколько
номеров телефонов).

Send your answers at email Name the Word file according to the template
[email protected] TN_Surname_specialty_group, for example,
T5_Johnson_121.017_1.

HNEU, Department of Information Systems, Course Database, V. V. Fedko 3


1. Data modelling
Data model
A model is an abstraction of a more complex real-world object or event.
A model’s main function is to help you understand the complexities of the real-
world environment.
A data model is an abstract model that organizes data elements and make
uniform their relationship with each other and with the properties of objects
in the real world.
Example: a data model may indicate that a data element representing
a student consists of the following elements: Last Name, Faculty, Course,
Date of Birth, etc.
A data model is a relatively simple representation, usually graphical, of more
complex real-world data structures.

HNEU, Department of Information Systems, Course Database, V. V. Fedko 4


The importance of data models
Data models provide a
framework for data to be used
within database by providing
specific definition and format.
If a data model is used
consistently across systems
then compatibility of data can
be achieved.
If the same data structures are
used to store and access data,
then different applications can
freely exchange data.

HNEU, Department of Information Systems, Course Database, V. V. Fedko 5


Possible problems in data models
• Business rules specific to how everything is done in a particular
place are often reflected in the structure of the data model. This
means that small changes in business lead to large changes in
computer systems and interfaces (1 and N telephones).
• Entity types are often not accurately identified or are identified
incorrectly. There may be data duplication (clients and firms prices).
• Data models for different systems are arbitrarily different. As a
result, complex interfaces between systems that exchange data are
required. These interfaces can account for 25-70% of the cost of
modern systems (date format for different systems).

Just as you are not likely to build a good house without a blueprint, you are equally
unlikely to create a good database without first creating an appropriate data model.

HNEU, Department of Information Systems, Course Database, V. V. Fedko 6


Data model components
An implementation-ready data model
should contain at least the following
components:
• A description of the data structure
that will store the end-user data.
• A set of binding rules that
guarantee data integrity.
• A data manipulation methodology
to support the real-world data
transformations.

HNEU, Department of Information Systems, Course Database, V. V. Fedko 7


Basic building blocks
• An entity is anything (a person, a place, a thing, or an event) about
which data are to be collected and stored (class - Manufacturer,
Product, Sale, Meeting).
• An attribute is an entity property (Product: Name, Price).
• A relationship describes an association among entities:
• 1:M or 1..* (Product - Sale),
• M:N or *..* (Product - Manufacturer),
• 1:1 or 1..1 (Product – Product_picture)
• A constraint is a restriction placed on the data (5<=Price<=50,
Sale_date <= Date(), Name is unique in Product).

HNEU, Department of Information Systems, Course Database, V. V. Fedko 8


2. Classification of models
Types of models
• Hierarchical
• Network
• Relational
• Entity relationship
• Object oriented
• …

HNEU, Department of Information Systems, Course Database, V. V. Fedko 9


Hierarchical data model
The hierarchical data model is a data model in which the database is represented as a tree-
like (hierarchical) structure consisting of objects (data) of different levels.
There are connections between objects. Each object may include several lower level
objects.
Such objects belong to the parent (the object is closer to the root) and to the child (the
object of a lower level).
The hierarchical model depicts a set of one-to-many (1:M) relationships between a parent
and its children segments.
Car

Motor Body Running gear

Left door Right door Roof

HNEU, Department of Information Systems, Course Database, V. V. Fedko 10


Network data model
A network model is a database model conceived as a flexible way of representing objects
and their relationships.
Its distinctive feature is that the schema is considered as a graph.
In a graph, object types are nodes, and relationship types are arcs that are not limited to a
hierarchy.
Unlike the hierarchical model, the network model allows a record to have more than one
parent.

Seller Buyer
1:M 1:M
Product Invoice
1:M 1:M
Invoice_line

HNEU, Department of Information Systems, Course Database, V. V. Fedko 11


Relational data model
The relational model represents the database as a collection of relations.
In the relational model data are stored as tables.

Relation (Table)
Relation
PRODUCTS schema
Primary
key PRODUCT_ID NAME PRICE PURCHASE_PRICE
1 Bread "Ukrainian" 13.50 12.00 Tuple
2 Baton "Milk" 12.80 12.50 (Row)
3 Bun with poppy seeds 10 9

Domain – attribute type


Cardinality – total # of rows Attribute (Column) Degree – total # of attributes
HNEU, Department of Information Systems, Course Database, V. V. Fedko 12
Entity–Relationship model (ER model)
The entity-relationship model is a database model that works around the entities of the
real world and the associations (relationships) between them.
In fact, this is a relational model to which relationships between tables are added:
ER = Relations + Relationships.
Components of the ER model:
An entity is class for each row of a table (Relation).
An attribute is class for field in each row (of a column).
A relationship between entities is implemented by storing the primary key of one entity
as a foreign key in the table of another entity.
Cardinality – defines the numerical attributes of the relationship between two entities
(1:1, 1: M, M:N)

HNEU, Department of Information Systems, Course Database, V. V. Fedko 13


Example ER model

HNEU, Department of Information Systems, Course Database, V. V. Fedko 14


Object-oriented data model (OODM)
Unlike the ER model, in object-oriented data model, both the data and their relationships
are contained in a single structure known as an object.
Object = Data + Relationships
The class contains a set of data and procedures known as methods. A class method is a
real action, such as finding the selected name, changing it, and so on (as in Hibernate,
Entity Framework).
Invoice
InvoiceID
InvoiceNumber
InvoiceDate
Manufacturer 1
InvoiceProduct M
getInvoice(ID)
printInvoice(ID)
HNEU, Department of Information Systems, Course Database, V. V. Fedko 15
3. Advantages and Disadvantages of Various Data Models
Hierarchical
ADVANTAGES DISADVANTAGES
1. It promotes data sharing. 1. Complex implementation requires knowledge of physical data
2. Parent/Child relationship promotes storage characteristics.
conceptual simplicity. 2. Navigational system yields complex application development,
management, and use; requires knowledge of hierarchical path.
3. Database security is provided and
3. Changes in structure require changes in all application
enforced by DBMS. programs.
4. Parent/Child relationship promotes 4. There are implementation limitations (no multiparent or M:N
data integrity. relationships).
5. It is efficient with 1:M 5. There is no data definition or data manipulation language in
relationships. the DBMS.
6. There is a lack of standards.

HNEU, Department of Information Systems, Course Database, V. V. Fedko 16


Network
ADVANTAGES DISADVANTAGES
1. Conceptual simplicity is at least equal to that of the 1. System complexity limits
hierarchical model. efficiency —still a navigational
system.
2. It handles more relationship types, such as M:N and
multiparent. 2. Navigational system yields
complex implementation,
3. Data access is more flexible than in hierarchical and file application development, and
system models. management.
4. Data Owner/Member relationship promotes data 3. Structural changes require
integrity. changes in all application
5. There is conformance to standards. programs.
6. It includes data definition language (DDL) and data
manipulation language (DML) in DBMS.

HNEU, Department of Information Systems, Course Database, V. V. Fedko 17


Relational
ADVANTAGES DISADVANTAGES
1. Structural independence is promoted by 1. The RDBMS requires substantial hardware
the use of independent tables. Changes in and system software overhead.
a table’s structure do not affect data access or
application programs. 2. Conceptual simplicity gives relatively
untrained people the tools to use a good
2. Tabular view substantially improves system poorly, and if unchecked, it may
conceptual simplicity, thereby promoting produce the same data anomalies found in file
easier database design, implementation, systems.
management, and use.
3. It may promote “islands of information”
3. The special power of queries is based on problems as individuals and departments can
SQL. easily develop their own applications.
4. Powerful RDBMS isolates the end user from
physical-level details and improves
implementation and management simplicity.

HNEU, Department of Information Systems, Course Database, V. V. Fedko 18


Entity relationship
ADVANTAGES DISADVANTAGES
1. Visual modeling yields extreme 1. There is limited constraint
conceptual simplicity. representation.
2. Visual representation makes it an 2. There is limited relationship
effective communication tool. representation.
3. It is integrated with dominant 3. There is no data manipulation
relational model. language.

HNEU, Department of Information Systems, Course Database, V. V. Fedko 19


Object oriented
ADVANTAGES DISADVANTAGES
1. Semantic content is added. 1. Slow development of standards
2. Visual representation includes caused vendors to supply their own
semantic content. enhancements, thus eliminating a
widely accepted standard.
3. Inheritance promotes data integrity.
2. It is a complex navigational system.
3. There is a steep learning curve.
4. High system overhead slows
transactions.

HNEU, Department of Information Systems, Course Database, V. V. Fedko 20


4. Degrees of data abstraction
Degrees
1. Conceptual: This Data Model defines WHAT the system contains. This
model is typically created by Business stakeholders and Data
Architects. The purpose is to organize, scope and define business
concepts and rules.
2. Logical: Defines HOW the system should be implemented regardless
of the DBMS. This model is typically created by Data Architects and
Business Analysts. The purpose is to developed technical map of rules
and data structures.
3. Physical: This Data Model describes HOW the system will be
implemented using a specific DBMS system. This model is typically
created by DBA and developers. The purpose is actual implementation
of the database.

HNEU, Department of Information Systems, Course Database, V. V. Fedko 21


Conceptual Model
The main aim of this model is to establish the entities, their attributes, and their
relationships. In this Data modelling level, there is hardly any detail available of the
actual Database structure.
The 3 basic elements of Data Model are
Entity: A real-world thing
Attribute: Characteristics or properties of an entity
Relationship: Dependency or association between two entities

Characteristics:
• Offers Organisation-wide coverage of the business concepts.
• This type of Data Models are designed and developed for a business audience.
• The conceptual model is developed independently of hardware specifications like
data storage capacity, location or software specifications like DBMS vendor and
technology. The focus is to represent data as a user will see it in the "real world".

HNEU, Department of Information Systems, Course Database, V. V. Fedko 22


Logical Model
Logical data models add further information to the conceptual model elements. It
defines the structure of the data elements and set the relationships between them.
Characteristics:
• Describes data needs for a single project but could integrate with other logical data
models based on the scope of the project.
• Designed and developed independently from the DBMS.
• Data attributes will have datatypes without exact precisions and length.
• Normalization processes to the model is applied typically till 3NF.

HNEU, Department of Information Systems, Course Database, V. V. Fedko 23


Physical Model
The physical model describes a DBMS-specific implementation of the data model. It offers
database abstraction and helps create schemas. This is due to the wealth of metadata offered
by the physical data model.
Characteristics:
• The physical data model describes the need for data for one project or application, although
it can be integrated with other physical data models depending on the size of the project.
• Data model contains relationships between tables that specify cardinality and nullability of
them.
• Developed for a specific version of a DBMS, location, data storage or technology to be used
in the project.
• Columns should have exact datatypes, lengths assigned and default values.
• Primary and Foreign keys, views, indexes, access profiles, and authorizations, etc. are
defined.

HNEU, Department of Information Systems, Course Database, V. V. Fedko 24


Product
Sale Manufacturer
Conceptual Model
Name
Sale_date Name
Price
Quantity Address
Purchase_price
Phone

Product
Sale Manufacturer
Logical Model
Name: String
Price: Number Sale_date: Datetime Name: String
Purchase_price: Number Quantity: Number Address: String
Phone: String

Sale
Product Manufacturer
SaleId: INTEGER
ProductId: INTEGER ManufacturerId: INTEGER
Physical Model Sale_date: DATE
Name: VARCHAR(25) ManufacturerId: INTEGER (FK) Name: VARCHAR(30)
Price: MONEY ProductId: INTEGER (FK) Address: VARCHAR(40)
Purchase_price: MONEY Quantity: SMALLINT Phone: VARCHAR(15)

HNEU, Department of Information Systems, Course Database, V. V. Fedko 25


Test questions
En: Ru:
1. Describe data model components. 1. Опишите компоненты модели
данных.
2. Compare relational and ER models
2. Сравните реляционную и ER модели
3. Create a physical ER model that
contains two entities: a Student and a 3. Постройте физическую ER модель,
Telephone (one student may have которая содержит две сущности:
several phone numbers). Студент и Телефон (у одного
студента может быть несколько
номеров телефонов).

Send your answers at email Name the Word file according to the template
[email protected] TN_Surname_specialty_group, for example,
T5_Johnson_121.017_1.

HNEU, Department of Information Systems, Course Database, V. V. Fedko 26

You might also like