DB 03
DB 03
Database Management –
COMP3140
Billy Yu
1
Data Model?
• https://www.youtube.com/watch?v=4qFZ-5i4GS8
3
Data Model Basic Building Blocks
• Entity: Unique and distinct object used to
collect and store data
– A person, place, thing, concept, or event for
which data can be stored.
• Attribute: Characteristic of an entity
• Relationship: Describes an association
among entities
• One-to-many (1:M)
• Many-to-many (M:N or M:M)
• One-to-one (1:1)
• Constraint: Set of rules to ensure data
integrity 4
Business rules
Get back to the real world!
• Business rules must be easy to understand
and widely disseminated to ensure that
every person in the organization shares a
common interpretation of the rules.
• They describe, in simple language, the main
and distinguishing characteristics of the
data as viewed by the company.
5
Business Rules
Brief, precise, and unambiguous
description of a policy, procedure, or
principle
6
Sources of Business Rules
Company Department
Policy makers
managers managers
Direct
Written
interviews
documentation
with end users
Example:
• A customer may generate many invoices.
• An invoice is generated by only one
customer.
• A book can have only one publisher.
• …
Video:
• https://www.youtube.com/watch?v=6xRbYXqdUUU
8
The Relational Model
• Produced an automatic transmission
database that replaced standard
transmission databases
• Based on a relation
– Relation or table: Matrix composed of
intersecting tuple and attribute
• Tuple: Rows
• Attribute: Columns
• Describes a precise set of data
manipulation constructs
https://en.wikipedia.org/wiki/Relation_(database)
9
Relational Database
Management System (RDBMS)
11
SQL-Based Relational
Database Application
• End-user interface
– Allows end user to interact with the data
• Collection of tables stored in the
database
– Each table is independent from another
– Rows in different tables are related based
on common values in common attributes
• SQL engine
– Executes all queries
12
Relational Model
Advantages Disadvantages
• Structural independence • Requires substantial
is promoted using
independent tables hardware and system
• Tabular view improves software overhead
conceptual simplicity • Conceptual simplicity
• Ad hoc query capability is gives untrained people
based on SQL the tools to use a good
• Isolates the end user system poorly
from physical-level details
• Improves implementation
• May promote
and management simplicity information problems
• More on a separate chapter
13
The Entity Relationship Model
• Graphical representation of entities and
their relationships in a database structure
• Entity relationship diagram (ERD)
– Uses graphic representations to model
database components
• Entity instance or entity occurrence
– Rows in the relational table
• Connectivity: Term used to label the
relationship types
14
Figure 2.3 - The ER Model
Notations
15
More example
https://en.wikipedia.org/wiki/Entity%E2%80%93relationship_model
16
Figure 2.4 - A Comparison of
OO, UML and ER Models
17
Entity Relationship Model
Advantages Disadvantages
• Visual modeling yields • Limited constraint
conceptual simplicity representation
• Visual representation • Limited relationship
makes it an effective representation
communication tool • No data manipulation
• Is integrated with the language
dominant relational model • Loss of information
content occurs when
attributes are removed
from entities to avoid
crowded displays
• More on a separate chapter 18
Big Data Challenges
Expensive
19
Big Data New Technologies
Hadoop
Hadoop Distributed File
System (HDFS)
MapReduce NoSQL
20
NoSQL Databases
• Not based on the relational model
• Support distributed database
architectures
• Provide high scalability, high availability,
and fault tolerance
• Support large amounts of sparse data
• Geared toward performance rather than
transaction consistency
• Store data in key-value stores
21
Figure 2.5 - A Simple Key-
Value Representation
22
Figure 2.6 - The Evolution of Data
Models
23
NoSQL
Advantages Disadvantages
• High scalability, • Complex programming is
availability, and fault required
tolerance are provided • There is no relationship
• Uses low-cost support
commodity hardware • There is no transaction
• Supports Big Data integrity support
• Key-value model • In terms of data
improves storage consistency, it provides
efficiency an eventually consistent
model
24