Professional Documents
Culture Documents
Chapter 2 (Part 2) - Database Building Blocks
Chapter 2 (Part 2) - Database Building Blocks
Chapter 2 (Part 2) - Database Building Blocks
DATABASE BUILDING
BLOCKS
Nulls
• Nulls:
– No data entry/something is unknown, therefore, insert
NULL to a particular attribute
– Not permitted in primary key
– Should be avoided in other attributes
– Can represent
• An unknown attribute value Solution: assign
default value
• A known, but missing, attribute value
• A “not applicable” condition if(price == 0 || price == NULL)
** null
ENTITY INTEGRITY &
REFERENTIAL INTEGRITY
ENTITY INTEGRITY
002 2 2
003
Referential integrity enforces the
following three rules:
• We may not add a record to the EMPLOYEE
table unless the ManagedBy attribute points to a
valid record in the MANAGER table.
• If the primary key for a record in the MANAGER
table changes, all corresponding records in the
EMPLOYEE table must be modified using a
cascading update.
• If a record in the Managers table is deleted, all
corresponding records in the EMPLOYEE table
must be deleted using a cascading delete.
Why are entity integrity and referential
integrity important in a database?
• Simple Attributes
• Composite Attributes
• Derived Attributes
• Single value and Multivalue attributes
Simple Attributes
Attribute Characteristics:
simple (atomic) and
composite, derived, Composite tables
single-valued &
multivalued