0% found this document useful (0 votes)
40 views

Database Lecture02r

This document discusses data modeling and data models. It covers the basics of data modeling including entities, attributes, relationships, and constraints. It describes how data models have evolved from hierarchical and network models to the relational model. It also discusses emerging alternative data models and the importance of identifying business rules to help design effective data models.

Uploaded by

Watanabe Kiseki
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Database Lecture02r

This document discusses data modeling and data models. It covers the basics of data modeling including entities, attributes, relationships, and constraints. It describes how data models have evolved from hierarchical and network models to the relational model. It also discusses emerging alternative data models and the importance of identifying business rules to help design effective data models.

Uploaded by

Watanabe Kiseki
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Module 2: Data

Models
KT24503 Database

1
Chapter Objectives
By the end of this chapter, you should be able to:

1. Discuss data modeling and why data models are important

2. Describe the basic data-modeling building blocks

3. Define what business rules are and how they influence database
design

4. Understand how the major data models evolved

5. List emerging alternative data models and the needs they fulfill

6. Explain how data models can be classified by their level of


abstraction

2
Lifecycle of Database Development

3
Data Modeling and Data Models

• Data modeling refers to the process of creating a specific data model


for a determined problem domain
− Data modeling is an iterative, progressive process
• A data model is a relatively simple representation of more complex
real-world data structures
• Database designers make use of existing data-modeling constructs and
powerful database design tools that diminish the potential for errors in
database modeling

4
The Importance of Data Models
• Facilitates communication among designer, application programmer and end user

• Gives various views of the database.


− Programmer’s view of the data is different from that of the manager or the end
user

• Organizes data for various users

• Provides an abstraction for the creation of good a database


− A sound data environment requires an overall database blueprint based on an
appropriate data model

5
Data Model Basic Building Blocks (EARC)
• An entity is a person, place, thing, concept, or event about which data will be
collected and stored
• An attribute is a characteristic of an entity
• A relationship describes an association among entities
• The following are three different types of relationships:
− One-to-many (1:M or 1..*) relationship
− Many-to-many (M:N or *..*) relationship
− One-to-one (1:1 or 1..1) relationship

6
Data Model Basic Building Blocks (EARC)
• A constraint is a restriction placed on the data
− Constraints help ensure data integrity

• Constraints are normally expressed in the form of rules:


− An employee’s salary must have values that are between 6,000 and 350,000
− A student’s GPA must be between 0.00 and 4.00
− Each class must have one and only one teacher

7
Knowledge Check Activity 2-1

• What is a relationship, and what three types of relationships exist?

8
Knowledge Check Activity 2-1: Answer

• What is a relationship, and what three types of relationships exist?


• Answer: A relationship is an association among (two or more) entities.
Three types of relationships exist: one-to-one (1:1), one-to-many (1:M),
and many-to-many (M:N or M:M.)

9
Business Rules
• A business rule is a brief, precise, and unambiguous description of a policy,
procedure, or principle within a specific organization
− They apply to any organization that stores and uses data to generate information

• Business rules are used to define entities, attributes, relationships, and constraints
− They must be easy to understand and widely disseminated

• Examples of business rules include the following:


− A vendor must supply at least one product
− Each product is supplied by only one vendor

10
Translating Business Rules into Data Model
Components
• Business rules set the stage for the proper identification of entities, attributes,
relationships, and constraints.
− Nouns translate into entities
− Verbs translate into relationships among entities
− Relationships are bidirectional
• “A customer may generate many invoices”
− Customer and invoice are objects of interest for the environment and should be
represented by their respective entities
− There is a generate relationship between customer and invoice
− The rule above is complemented by the business rule “an invoice is generated by only
one customer”
− The relationship is one-to-many (1:M)

11
Example of Business Rules
• An invoice contains one or more invoice lines.

• Each invoice line is associated with a single invoice.

• A store employs many employees.

• Each employee is employed by only one store.

• A college has many departments.

• Each department belongs to a single college. (This business rule reflects a university
that has multiple colleges such as Business, Liberal Arts, Education, Engineering, etc.)

12
Example of Business Rules
• A driver may be assigned to drive many different vehicles.

• Each vehicle can be driven by many drivers. (Note: Keep in mind that this business
rule reflects the assignment of drivers during some period of time.)

• A client may sign many contracts.

• Each contract is signed by only one client.

• A sales representative may write many contracts.

• Each contract is written by one sales representative.

13
Naming Conventions
• Entity names should be descriptive of the objects in the business environment and
use technology that is familiar to the users

• An attribute name should also be descriptive of the data represented

• It is good practice to prefix the name of an attribute with the name or abbreviation of
the entity in which it occurs
− For example, in the CUSTOMER entity, customer’s credit limit may be called
CUS_CREDIT_LIMIT

• A proper naming convention can help make your model self-documenting

14
Discovering Business Rules
• Sources of business rules
− Company managers
− Policy makers
− Department managers
− Written documentation
− Direct interviews with end users

• Reasons for identifying and documenting business rules


− Standardize company’s view of data
− Facilitate communications tool between users and designers
− Assist designers
§ Understand the nature, role, scope of data, and business processes
§ Develop appropriate relationship participation rules and constraints
§ Create an accurate data model

15
The
Evolution
of Data
Models

16
Hierarchical and Network Models (1 of 2)
• The hierarchical model was developed in the 1960s to manage large amounts of data
for complex manufacturing projects
− The hierarchical structure contains levels, or segments

• A segment is the equivalent of a file system’s record type

• A higher layer is perceived as the parent of the segment directly beneath it, which is
called the child

• The network model was created to represent complex data relationships more
effectively than the hierarchical model, to improve database performance, and to
impose a database standard

17
Hierarchical and Network Models (2 of 2)
• The following database concepts that emerged with the network model are still used
by modern data models:
− The schema is the conceptual organization of the entire database as viewed by
the database administrator
− The subschema defines the portion of the database “seen” by the application
programs that produce the desired information from the data within the database
− The data manipulation language (DML) defines the environment in which data can
be managed and is used to work with the data in the database
− A schema data definition language (DDL) enables the database administrator to
define the schema components

18
The Relational Model (1 of 4)
• The relational model’s foundation is a mathematical concept known as a relation
− A relation is a two-dimensional structure composed of intersecting rows and
columns
− Each row in a relation is called a tuple and each column represents an attribute

• The relational data model is implemented through a very sophisticated relational


database management system (RDBMS)
− The RDBMS performs the same basic functions provided by the hierarchical and
network DBMS systems

• The RDBMS manages all of the details, while the users sees a collection of tables in
which the data is stored

19
The Relational Model (2 of 4)

Figure 2.1 Linking Relational Tables

20
The Relational Model (3 of 4)

Figure 2.2 A Relational Diagram

21
The Relational Model (4 of 4)

• Any SQL-based relational database application involves the following three parts:
− The end user interface – the interface allows the end user to interact with the
data
− A collection of tables stored in the database – the tables “present” the data to
the end user in a way that is easy to understand
− SQL engine – the SQL engine executes all queries or data requests

22
The Entity Relationship Model (1 of 3)

• Complex design activities require conceptual simplicity to yield successful results

• Database designers prefer to use a graphical tool in which entities and their
relationships are pictured
− The entity relationship (ER) model (ERM) was developed to do just that

• The relational data model and ERM combined to provide the foundation for tightly
structured database design

• An entity relationship diagram (ERD) uses graphical representations to model


database components

23
The Entity Relationship Model (2 of 3)

• The ER model is based on the following components:


− Entity – an entity is represented in the ERD by a rectangle (entity box)
− Attributes – each entity consists of a set of attributes that describes particular
characteristics of the entity
− Relationships – relationships describe associations among data

• The following are three ER notations:


− Chen notation
− Crow’s Foot notation
− Class diagram notation (part of the Unified Modeling Language (UML))

24
The Entity Relationship Model (3 of 3)

Figure 2.3 The ER Model Notations

25
The Object-Oriented Model (1 of 3)
• In the object-oriented data model (OODM), both data and its relationship are
contained in a single structure known as an object
− The OODM is the basis for the object-oriented database management system
(OODBMS)
− The OODM is said to be a semantic data model because semantic indicates
meaning

• The OODM is based on the following components:


− An object is an abstraction of a real-world entity
− Attributes describe the properties of an object

26
The Object-Oriented Model (2 of 3)

• The OODM is based on the following components (continued):


− A class is a collection of similar objects with shared structure and behavior
§ A class’s method represents a real-world action such as finding a selected
PERSON’s name, changing a PERSON’s name, or printing a PERSON’s address
− The class hierarchy resembles an upside-down tree where each class has only
one parent
− Inheritance is the ability of an object within the class hierarchy to inherit the
attributes and methods of the classes above it
− Object-oriented data models are typically depicted using Unified Modeling
Language (UML) class diagrams

27
The Object-Oriented Model (3 of 3)

Figure 2.4 A Comparison of the OO,


UML, and ER Models

28
Object/Relational and XML
• The extended relational data model (ERDM) adds many of the OO model’s features
within the simpler relational database structure

• A DBMS based on the ERDM is often described as an object/relational database


management system (O/R DBMS)

• The success of the O/R DBMSs can be attributed to the model’s conceptual
simplicity, data integrity, easy-to-use query language, high transaction performance,
high availability, security, scalability, and expandability

• The Extensible Markup Language (XML) has emerged as a standard for the efficient
and effective exchange of structured, semi-structured, and unstructured data

29
Emerging Data Models: Big Data and NoSQL
(1 of 3)
• Internet of Things (IoT) is a web of Internet-connected devices exchanging and
collecting data
− The IoT has accelerated the rate of data growth so that about 2.5 quintillion bytes
of data are created daily

• Big Data refers to a movement to find new and better ways to manage large amounts
of web- and sensor-generated data and derive business insight from it

• A basic characteristic of Big Data databases can be described as volume, velocity,


and variety, or the 3 Vs

30
Emerging Data Models: Big Data and NoSQL
(2 of 3)
• Some of the most frequently used Big Data technologies are Hadoop and NoSQL
databases:
− Hadoop is a Java-based, open-source, high-speed, fault-tolerant distributed
storage and computational framework
− Hadoop Distributed File System (HDFS) is a highly distributed, fault-tolerant file
storage system designed to manage large amounts of data at high speeds
− MapReduce is an open-source application programming interface (API) that
provides fast data analytics services
− NoSQL is a large-scale distributed database system that stores structured and
unstructured data in efficient ways

31
Emerging Data Models: Big Data and NoSQL
(3 of 3)
• NoSQL databases have the following general characteristics:
− They are not based on the relational model and SQL
− They support highly distributed database architectures
− They provide high scalability, high availability, and fault tolerance
− They support very large amounts of sparse data
− They are geared toward performance rather than transaction consistency

32
33
34
Knowledge Check Activity 2-2

• What does the term “3 Vs” refers to?

35
Knowledge Check Activity 2-2: Answer

• What does the term “3 Vs” refers to?

• Answer: The term “3 Vs” refers to the 3 basic characteristics of Big


Data databases, they are: volume, velocity, variety.

36
Degrees of Data Abstraction
The American National Standards Institute (ANSI) Standards
Planning and Requirements Committee (SPARC) defined a
framework for data modeling based on degrees of data
abstraction

Figure 2.6 Data Abstraction Levels

37
The External Model (1 of 3)

• The external model is the end users’ view of the data environment

• End users usually operate in an environment in which an application has a specific


business unit focus
− End users within those business units view their data subsets as separate from or
eternal to other units within the organization

• ER diagrams will be used to represent the external views

• A specific representation of an external view is known as an external schema

38
The External Model (2 of 3)

Figure 2.7 External Models for Tiny


College

39
The External Model (3 of 3)

• The use of external views that represent subsets of the database has some important
advantages:
− It is easy to identify specific data required to support each business unit
− It makes the designer’s job easy by providing feedback about the model’s
adequacy
− It helps to ensure security constraints in the database design
− It makes application program development much simpler

40
The Conceptual Model (1 of 2)
• The conceptual model represents a global view of the entire database by the entire
organization

• Also known as a conceptual schema, it is the basis for the identification and high-
level description of the main data objects

• The most widely used conceptual model is the ER model

• The following are advantages of the conceptual model:


− It provides a bird’s-eye view of the data environment that is easy to understand
− The conceptual model is independent of both software and hardware

• The term logical design refers to creating a conceptual data model

41
The Conceptual Model (2 of 2)

Figure 2.8 Conceptual Model for


Tiny College

42
The Internal Model (1 of 2)

• The internal model is the representation of the database as “seen” by the DBMS
− The internal model requires a designer to match the conceptual model’s
characteristics and constraints to those of the selected implementation model

• An internal schema depicts a specific representation of an internal model, using the


database constructs supported by the chosen database

• Because the internal model depends on specific database software, it is said to be


software dependent

• When you change the internal model without affecting the conceptual model, you
have logical independence

• However, the internal model is still hardware independent

43
The Internal Model (2 of 2)

Figure 2.9 Internal Model for Tiny


College

44
The Physical Model

• The physical model operates at the lowest level of abstraction, describing the way
data is saved on storage media

• The physical model requires the definition of both the physical storage devices and
the (physical) access methods required to reach the data within those storage
devices
− This means the physical model is both software and hardware dependent

• When you can change the physical model without affecting the internal model, you
have physical independence

45
Knowledge Check Activity 2-3

• What is logical independence?

46
Knowledge Check Activity 2-3: Answer

• What is logical independence?


• Answer: Logical independence exists when you can change the internal
model without affecting the conceptual model.

47
Summary
Now that the lesson has ended, you should be able to:

1. Discuss data modeling and why data models are important

2. Describe the basic data-modeling building blocks

3. Define what business rules are and how they influence database design

4. Understand how the major data models evolved

5. List emerging alternative data models and the needs they fulfill

6. Explain how data models can be classified by their level of abstraction

48
The End. Question?

49

You might also like