DDLesson4 5 Rev09
DDLesson4 5 Rev09
Sections 4 & 5 Subtype, Supertype, Mutually exclusive, non-transferability, transferable, 1:1, 1:M, M:M, Redundant, Intersection entity, Barred relationship, CRUD analysis
Reserved Words
A reserved work is one that has a specific meaning and function in the computer system, language, or database. Examples:
NULL DATE DISTINCT
3
Video ERD
TAPE/DVD
number format
a copy of
on
rented by
the renter of
featured in
Subtype
A subtype: inherits all attributes of the supertype inherits all relationships of the supertype usually has its own attributes or relationships is drawn within the supertype never exists alone may have subtypes of its own is also known as a "subentity
8
Attributes
Supertype can have attributes at supertype level Attributes at supertype level are for all subtypes Subtypes can have own attributes for only that attribute
10
Example
takes
STUDENT
taken by
EXAM
BONUS QUESTIONS
included in
oral presentation
QUIZ
include
11
12
13
Subtype Needs
Exhaustive:
Every instance of the supertype is also an instance of one of the subtypes. Treating all parts or aspects without omissions. 2 or more items
Mutually exclusive:
Every instance of the supertype is of one and only one subtype. A relationship that presents choices which are unable to be true at the same time.
14
Nested subtypes
16
17
Business Rules
Recognize if Business rule is implemented by the data model or by programming Example:
Only an employee with a title of manager can manage other employees The event planner must contact the customer before the DJ can be assigned
Business rules can be changed as society changes or business leaders feel change is needed
18
Procedural
Work flow related Programmed validation is procedural constraint Generally need to write code Example: Commission can not be > 25% of salary
19
20
21
Discussion
Students must have studied algebra and geometry in order to sign up for trigonometry. Could you represent this in the ERD? How would you implement this with programming? If the student had taken the subjects, can you think of an additional business rule that a school may want in this scenario?
22
23
Relationship Transferability
24
Relationship transferability
Rules established for the purpose such as safety, efficiency, or increased profit Example: Airline tickets
can be transferable or non-transferable?
25
Non-transferable relationship
place CUSTOMER
placed by
ORDER
Orders are non-transferable Resolution would be to cancel order and create new order
26
PERSON
born in
TOWN
27
Relationship types
One to One (1:1) One to Many (1:M) Many to Many (M:M)
28
29
PERSON
ridden by
BYCYCLE
30
31
32
One to Many
Most common type are mandatory on one side and optional on the other Mandatory at both ends models entities that cannot exist without each other
ORDER TYPE ORDER
33
TAX RETURN
BAND
composed of belong to
MUSICIAN
34
35
Many to Many
Often common in initial version of ERD Later stage of design converted to other type
learn from
STUDENT
educate
TEACHER
36
Redundant relationship
Redundant relationship is one that can be derived from another relationship in the model
37
38
STUDENT
COURSE
REGISTRATION
39
40
Example
PARTNER
EVENT
41
CRUD analysis
Create ER models that reflect all business rules gathered during the interview process
Identify the create, retrieve, update, and delete (CRUD) requirements of the business Validate your ER model by performing a CRUD analysis
42
CRUD requirements
CRUD analysis will help you:
Translate between the consultant and the client. Provide a guideline for the DBA who will eventually build the database. Check that you havent missed any entities or relationships in your data model. Check to make sure that you havent modeled anything that the business does not require.
43
What is CRUD?
CRUD is an acronym for create, retrieve, update, delete. Check for completeness and accuracy.
44
Create keywords
Look for these words when you interview the client. INPUT ENTER LOAD IMPORT RECORD CREATE
45
Retrieve keywords
Look for: VIEW REPORT BRING UP PRINT FIND READ LOOK UP
46
Update keywords
Look for: CHANGE MODIFY ALTER UPDATE
47
Delete keywords
Look for: DISCARD REMOVE TRASH PURGE DELETE
48
CRUD analysis
If you have a business function that has no entity to CRUD against, then your data model may be incomplete. Similarly, if you have entities in your ERD that are not touched by any CRUD (there is no business function that creates, retrieves, updates, or deletes from it), then you may not need that entity in your model.
49