180 likes | 362 Views
Entity Relationships. A337. 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?
E N D
Entity Relationships A337
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 Database Maximum 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, 6th Edition, Rob & Coronel
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 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
“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 Primary Key Relationship Foreign Key