Database Lecture02r
Database Lecture02r
Models
KT24503 Database
1
Chapter Objectives
By the end of this chapter, you should be able to:
3. Define what business rules are and how they influence database
design
5. List emerging alternative data models and the needs they fulfill
2
Lifecycle of Database Development
3
Data Modeling and Data Models
4
The Importance of Data Models
• Facilitates communication among designer, application programmer and end user
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
7
Knowledge Check Activity 2-1
8
Knowledge Check Activity 2-1: Answer
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
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 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.)
13
Naming Conventions
• Entity names should be descriptive of the objects in the business environment and
use technology that is familiar to the users
• 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
14
Discovering Business Rules
• Sources of business rules
− Company managers
− Policy makers
− Department managers
− Written documentation
− Direct interviews with end users
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 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 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)
20
The Relational Model (3 of 4)
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)
• 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
23
The Entity Relationship Model (2 of 3)
24
The Entity Relationship Model (3 of 3)
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
26
The Object-Oriented Model (2 of 3)
27
The Object-Oriented Model (3 of 3)
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
• 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
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
35
Knowledge Check Activity 2-2: Answer
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
37
The External Model (1 of 3)
• The external model is the end users’ view of the data environment
38
The External Model (2 of 3)
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
41
The Conceptual Model (2 of 2)
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
• When you change the internal model without affecting the conceptual model, you
have logical independence
43
The Internal Model (2 of 2)
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
46
Knowledge Check Activity 2-3: Answer
47
Summary
Now that the lesson has ended, you should be able to:
3. Define what business rules are and how they influence database design
5. List emerging alternative data models and the needs they fulfill
48
The End. Question?
49