View
212
Download
0
Category
Preview:
Citation preview
Relational DB Components
MMG 508
Conceptual DB Design Components
To get started, look at the Conceptual Database Diagram on page 26 of the text, and on the next slide.
ComponentsEntitiesAttributesRelationships
Movie Rental Conceptual Design
Relationship Types
One-to-One RelationshipsThe generic definition of 1:1 relationships is:
This is an association where an instance of one entity can be associated with at most one instance of the other entity and vice versa
These are rare and anomaliesThese are normally corrected by combining the
entitiesFigure 2-2 on page 29 applies
One-to-One Conditional
Figure on next slide shows a different “flavor” of one-to-one relationship that is optional (some say conditional) in both directions
The dealership issues automobiles to some employees, typically sales staff, for them to drive for a finite period.
We can read the relationship between the Employee and Automobile entities as follows:
“At any point in time, each employee can have zero or one automobiles issued to him or her, and each automobile can be assigned to zero or one employee.”
Note the clause “At any point in time.” If an automobile is taken back from one employee and then reassigned to another, this would still be a one-to-one relationship, albeit a transferable one. This is because when we consider relationships, we always think in terms of a snapshot taken at an arbitrary point in time.
One-to-One Conditional (Cont’d)
Relationship Types (Cont’d)
One-to-Many relationships (1:m)Basic definition states that the 1:m
relationship is an association between two entities where any instance of the first entity may be associated with one or more instances of the second and any instance of the second entity may be associated with at most one instance of the first
See next slide
One-to-Many (1:M) Diagram
Relationship Types (Cont’d)
Many-to-Many Relationships (n:m)Defined as an association between two
entities where any instance of the first entity may be associated with zero, one, or more instances of the second and vice versa.
Look at Figure 2-1, p. 26 (and next slide)Most common relationship
Many-to-Many (M:N) Relationship
Relationship Types (Cont’d)
Recursive RelationshipsCan be 1:1; 1:n, n:m relationshipsAre relationships within one entitySee Figure 2-4 p. 32
Business Rules
These are policies mandated by the organization
Look at Figure 2-1 on page 26This Business Rule states that “Customers
with overdue amounts may not book new orders”
Can be manually enforcedCan be enforced via program coding
Tables
This is the primary unit of storage for any RDBMS and is two dimensional
Relational tables are logical storage structures and usually do not exist in tabular form in the physical layer
Tables have unique names assigned by the DBA
See Figure 2-5 on page 34
Table Attributes
Table attributes are:ColumnsData typesConstraints
Primary Key constraintsReferential constraints
e.g. foreign keys
Intersection Tables (p. 42)
Integrity Constraints
Integrity ConstraintsNOT NULL constraints
Essentially, not null is used where a specific column cannot be blank
CHECK constraintsUsed for value validation in columnsSee p. 44 for example – also Figure 2-11
Views
A View is a virtual tableThis is a logical table which give a user
access to specific columns in a table or tables
MS Access view illustrated on p. 46, Figure 2-12
Recommended