250 likes | 352 Views
Constraints. Overview. Unique Identifiers Arcs Domains Various other constraints. Rembrandt. Identification and Representation. G. Papini, please?. EMPLOYEES. Name PAPINI HIDE PAPINI BAKER. Initials G. T.M. G. S.J.T. Birthdate 02-FEB-1954 11-JUN-1961 02-FEB-1945 24-SEP-1958. JOB
E N D
Overview • Unique Identifiers • Arcs • Domains • Various other constraints
Identification and Representation G. Papini, please? EMPLOYEES Name PAPINI HIDEPAPINI BAKER Initials G.T.M.G.S.J.T. Birthdate 02-FEB-195411-JUN-196102-FEB-194524-SEP-1958
JOB COMPUTER IN NETWORK TELEPHONE EMPLOYEE MAIL LIST Unique Identifier Examples Name IP Address Country code, Area code, Telephone number Employee number Name, Initials, Birth Date Name, Owner or
Unique Identifier Indicates Unique Identifier CUSTOMER# Family Nameo Initials# Addresso Telephone ORDER# Date by responsible for Indicates Unique Identifier
Unique Identifiers USER# Name owner of part of owned by contains MAIL LIST# Name ROOM# No FLOOR# No HOTEL# Name
Multiple Relationship UID USER# Name USER# Name owner of owner of isreferred to part of owned by contains owned by LIST# Name LIST# Name contains referring to contained in LIST ITEM
Z# Z1o Z2o Z3# Z4 Well-defined Unique Identifiers Q# Q1 P# P1 Y# Y1# Y2 K L # L1 X# X1 M# M1 R# R1 XY T# T1 S
G# G1 L# L1 F# F1 K# K1 R# R1 P# P1 KL To # T1 Q# Q1 G# G1 H Incorrect Unique Identifiers
54.0.093.81 Information-Bearing Codes Product GroupIn Production?FactorySequence Number PRODUCT GROUP# Code PRODUCT # Code* In Production?* Sequence No FACTORY# Id
Contract Conditions Std? 123456 Arcs “A contract consists of contract components; these are standard conditions or customized conditions” CONTRACT STANDARDCONDITION basis for based on consists of in CUSTOMIZEDCONDITION Arc in Indicates relationship in arc part of referring to referring to CONTRACT COMPONENT
Exclusive Arc USER ownerof owned by LIST container of is referred to is referred to contained in referring to referring to LIST ITEM
The arc “belongs” to one entity • Relationships in the arc must be of the same optionality • Arcs must contain at least two relationships An arc may be correct, but is quite difficult to implement ... Some Incorrect Arc Constructs
Arc or Subtype ADDRESS USER ownerof ownerof USER owned by owned by LIST LIST is referred to contains is referred to contains is referred to referring to referring to in in referring to LIST ITEM LIST ITEM
A C A B C A B C B 3 4 5 R R Q Q P P P Q Arc and Subtypes A A 1 2 R Q Q P P
Every A is either a B or a C Every B is an A Every C is an A Subtypes Hide Relationships in Arc • Every A mustbe a B orbe a C • Every B must be an A • Every C must be an A A A is B B is is C C is
Value sets CODE TYPE# Id* Name* Max Length of Description A YESNO# Code* Description B GENDER# Code* Description CODE# Code* Description WEEKDAY# Code* Description
Other Constraints: Range Check EMPLOYEE* Name* Address JOB* Title* Minimum Salary* Maximum Salary between with of for referring to EMPLOYMENT* Start Dateo End Date* Salary
Other Constraints: State Value Transition SinMarWidDivDP Possible Marital Status Transitions to EMPLOYEE* Name* Address* Current Marital Status from SingleMarriedWidowedDivorcedDomestic Partnership
Conditional Relationship CONTRACT# Id* Standard Indicator STANDARDCONDITION basis for based on consists of in CUSTOMIZEDCONDITION in part of referring to referring to CONTRACT COMPONENT
Boundaries EXTERNAL # Id* Description* Value unrelated entity and possible implementation EXTERNALS Id 1234 Description Value added tax %Maximum available Space per Mail User in MbyteMaximum level of Nested Mail FoldersMaximum level of Nested Mail Lists Value 15500316
Summary • Identification • Can be a real problem in the real world • Models cannot overcome this • Entities must have at least one Unique Identifier • Unique Identifiers consist of attributes or relationships or both • Arcs • Many types of constraint are not represented in ER model
Practices • Identification Please • Identification • Moonlight UID • Tables • Modeling Constraints