Entities - Vin Costa`s Wiki

Download Report

Transcript Entities - Vin Costa`s Wiki

Session 5
Data Modeling
ITE 252 international, open membership, notfor-profit technology standards
Database
Management
consortium.
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
1
Unary Relationships
Bill of Materials
problem. Basic
parts make
international, open membership, not- subassemblies;
for-profit technology standards
subassemblies
consortium.
make bigger
subassemblies
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
2
Ternary Relationships
• Involve three different entities
• Can be considered sets of binary
relationships
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
3
Ternary Relationships
Special five sided intersection data
box - describes relationship b’twn
two entities
Prof. Vincent Costa
Intersection Data – date of the
sale & number of units of the
product sold
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
4
Many-to-Many Relationships
• Help minimize wasted space and optimize
performance
• Intersection data:
– Data that is part of many-to-many relationship and
associated with specific, unique instance of related
entities
• Associative entities:
– Entity designed to associate key values from
two entities in many-to-many relationship
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
5
Many-to-Many Relationships
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
6
Associative Entities
The unique identifier of an associative entity is the combination
of the unique identifiers of the two entities in the many-to-many
relationships.
e.g., a combination of Salesperson Number & Product Number
Attributes
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
7
Creating Data Models
• To create data model:
– Identify entities
– Identify attributes for each entity
– Identify associations between entities
• Modeling tools include:
– Manual (pencil and paper) {we will use this}
– Generic draw program (e.g.Visio)
– Custom modeling program (ERWIN)
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
8
Visio Database Diagrams
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
9
Example: General Hardware Company
• Wholesaler and distributor of various
manufacturers’ tools and other hardware
products
• Customers:
– Hardware and home improvement stores,
which in turn sell products at retail to
individual consumers
• Acts as middleman:
– Buys goods from manufacturers and sells to
retail stores
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
10
Example: General Hardware Company
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
11
Example: General Hardware Company
Quantity is Intersection
Data Entity
keep track of how many
units of each product
each salesperson has sold
Dependent Entity
diagonal hash mark
in each corner
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
12
Example: Good Reading Bookstores
• Chain of bookstores
• Needs to track data for:
–
–
–
–
Books
Publishers
Authors
Customers
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
13
Example: Good Reading Bookstores
Date, Price, and Quantity are
Intersection Data in the
many-to-many relationship
between the BOOK and
CUSTOMER entities.
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
14
Summary
• Database design process: Conceptual, logical, and
design
• Main types of databases: Transactional, decision
support (DSS), and hybrid
• Goal of data modeling: Create a well-structured
international,
open
notdatabase
model that
is membership,
simple, easy
to read and
for-profitand
technology
comprehend,
scalablestandards
consortium.objects: Tables and indices
• Basic database
• Tables: Describe entities; are composed of columns
(fields) and rows (records), with primary keys
used as unique identifiers of records
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
15
Summary
• Key components of relational database model:
Entities and relationships
• Relationships may be binary, unary, or ternary, and
have different cardinalities and modalities
• Many-to-many relationships support intersection
international,
openentities
membership, notdata and
associative
for-profit
• In creating
a datatechnology
model, youstandards
(1) identify entities, (2)
identifyconsortium.
their attributes, and then (3) identify
associations between entities
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
16
Key Terms
•
•
•
•
•
•
•
•
•
Associative entity
Balanced tree index
Base object
Binary relationship
Binary tree index
B-tree index
Bulk loading
Business rules
Cardinality
Prof. Vincent Costa
•
•
•
•
•
•
•
•
•
Clustered index
Conceptual design
Concurrency
Database object
Data diagram
Data mart
Data model
Data warehouse
Decision support system
(DSS)
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
17
Key Terms
• Entity-Relationship diagram
(ERD)
• Entity-Relationship (E-R)
modeling
• Field
• Hybrid database
• Identifier
• Index
• Intersection data
• Large object (LOB) data
• Leaf node
Prof. Vincent Costa
• Logical design
• Many-to-many (M-M) binary
relationship
• Modality
• Node
• Nonclustered index
• Object-relation model
(ORM)
• One-to-many (1-M) binary
relationship
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
18
Key Terms
• One-to-one (1-1) binary
relationship
• Online transaction
processing (OLTP)
• Physical design
• Primary index
• Primary key Record
• Referenced entity
• Referencing entity
• Referential integrity
Prof. Vincent Costa
•
•
•
•
•
•
•
•
Reporting database
Scalable
Secondary index
Stakeholder
Ternary relationship
Transactional database
Throughput
Unary relationship
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
19
Important Links
• The Entity Relationship Model – Wikipedia
decriptino
• At Wal-Mart, World's Largest Retail Data
international,
open membership,
Warehouse
Gets Even
Larger not- This is a big,
for-profit technology standards
big, big data
warehouse!
consortium.
• Database Modeling Tools – nice listing of tools,
some are free!
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
20
Homework
• Read Chapter Three, pp. 91-97
• HW#1:
Create an E-R diagram modeled after the
Good Reading Bookstores E-R diagram (Figure 319 in yourinternational,
text and open
slidemembership,
14 here)notfor a
for-profit technology standards
publisherconsortium.
of music (limit to MP3s). Draw the
diagram by hand and write up a description
similar to the one in section 3.4.3 (pp.95-95) in
your text.
• Due next class
Prof. Vincent Costa
Nassau Community College
Acknowledgements: Introduction to
Database Management, All Rights Reserved
21