entity relationships
Post on 16-Feb-2016
27 Views
Preview:
DESCRIPTION
TRANSCRIPT
Entity RelationshipsA337
Data Stores-Specific Diagrams• Included on both Flowcharts and DFDs
• There are also rules related to data stores. For example
– Can there be multiple invoices with the same number?– Can a customer have more than one address?– Can an address belong to more than one customer?
Relationships within the Relational DatabaseMaximum Cardinality (the “outside” symbols)
• 1:M relationship
• M:N relationships
• 1:1 relationship
Minimum Cardinality (the “inside” symbols)
• 0 optional
• | mandatory
The 1:1 Relationship• One entity can be related to only one other entity, and
vice versa
• Could indicate that two entities actually belong in the same table
• Sometimes 1:1 relationships are appropriate
Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel
The 1:1 Relationship Between PROFESSOR and DEPARTMENT
The Implemented 1:1 Relationship Between PROFESSOR and DEPARTMENT
The 1:M Relationship• Indicates that for every row in one table, there may
be multiple related records
• Depends on the situation
• Customer to Address can be
– 1:1 (e.g., HOA)– 1:M (e.g., Online retailer - mailing, billing, etc)
The 1:M Relationship Between COURSE and CLASS
The Implemented 1:M RelationshipBetween COURSE and CLASS
The M:N Relationship• Implemented by using a pair of 1:M relationships
• Can require creating a composite entity or bridge entity
• Composite entity table must contain at least the primary keys of original tables
The ERD’s M:N Relationship Between STUDENT and CLASS
The M:N Relationship Between STUDENT and CLASS
Changing the M:N Relationship to Two 1:M Relationships
Converting the M:N Relationship into Two 1:M Relationships
The Expanded Entity Relationship Model
“Key” terms• An entity is something of importance to a user
that needs to be represented in a database.
• An entity represents one theme or topic and is represented by a table.
• The table dimensions, like a matrix, consist of rows (tuples) and columns (attributes).
• A table may be related to other tables (i.e., a relationship).
Relationship Key Example
Project
Proj_Num
Proj_Name
MgrID
Manager
MgrID
MgrName
Foreign Key
Primary Key
Relationship
top related