Session Six
Initial Database Design

Topics


Database Design Overview

Database Design is performed during the Design Stage of the System Development Cycle and is performed concurrently with Application Design.
Back to the top

Database Design Activities
1 Map the E-R Model to relational tables to produce an initial design.
2 Refine the initial design to produce a complete database design.


Database Design Deliverable

The Database Design Stage produces design specifications for a relational database including definitions for relational tables, indexes, views, and storage space.
Back to the top


Foreign Keys

The rule behind Foreign Keys

"The Children get the Presents."

Back to the top


Steps in Initial Database Design

 
Eyes
Are
Usually
Red
After
Swimming (or Studying)
Entities
Attributes
UIDs
Relationships
Arcs
Subtypes
1.  Map Entities - Map the simple entities to tables.
2.  Map Attributes - Map attributes to columns and document sample data.
3.  Map UIDs - Map unique identifiers to primary keys.
4.  Map Relationships - Map relationships to foreign keys.
5.  Map Arcs - Choose arc options.
6.  Map Subtypes - Choose subtype options.
Back to the top

STEP ONE - MAP ENTITIES
Back to the top

STEP TWO - MAP ATTRIBUTES
Back to the top

STEP THREE -MAP UIDs
Special Handout on IDD Steps

The valid Key Types are PK for a Primary Key column, and FK for a Foreign Key column.

Use NN for a column that must be defined NOT NULL.
Use U for a column that must be unique.

Primary keys will by definition be NN and U.

If multiple columns must be unique in combination, label them with a suffix, for example U1.
Label a single column PK as NN, U
Label a multiple column PK as NN, U1

Use suffixes to distinguish between multiple FK columns in a single table.  For example if an entity has three relationships it should have one of them labeled FK1, one labeled FK2 and the last one labeled FK3.

If an entity's UID includes a relationship( the UID Bar), add foreign key columns to the table and mark them as part of the primary key.

Back to the top

STEP FOUR -MAP RELATIONSHIPS
For M:1 relationships Take the PK at the one end and put it in the table at the many end.
If the table's PK includes a foreign key,  The FK columns to support the relationship may have been added when you mapped the UIDs
For a mandatory 1:1 relationship,  Place the unique FK in the table at the mandatory end and use the NOT NULL constraint to enforce the mandatory condition.
If a 1:1 relationship is optional in both directions,  Place the FK in the table at either end of the relationship.
For a 1:M recursive relationship,  Add a FK column to the single table. This FK column will refer to values of the PK column.
For a 1:1 recursive relationship,  Add a unique FK to the table. This FK column will refer to values of the PK column.
Back to the top

STEP FIVE -CHOOSE ARC OPTIONS
Arcs represent a kind of multiple alternative foreign key. Choose between two alternative designs for mapping arcs to foreign keys.

Alternative Designs

Back to the top

STEP SIX - CHOOSE SUBTYPE OPTIONS
Option 1 - Single Table Subtype Design Option 2 - Separate Tables Subtype Design
Back to the top