![]() |
Session Six
Initial Database Design |
![]() |

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.
"The Children get the Presents."
| 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.
Special Handout on IDD StepsThe 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, U1Use 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.
| 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. |
Arcs represent a kind of multiple alternative foreign key. Choose between two alternative designs for mapping arcs to foreign keys.Alternative Designs
- Explicit Arc Design - creates a foreign key column for each relationship included in the arc
- Generic Arc Design - creates a single foreign key column and one relationship flag column for the arc. Since the relationships are exclusive, only one FK value will exist for each row in the table.
Option 1 - Single Table Subtype DesignOption 2 - Separate Tables Subtype Design
- Map the subtypes onto a single table for the supertype.
- The single table will contain instances of all subtypes.
- Use when the subtypes have few subtype-specific attributes and relationships.
- Design Advantages
- Access to the supertype is straightforward.
- The subtypes can be accessed and modified using views.
- Design Disadvantages
- Subtype NOT NULL requirements cannot be enforced at the database level.
- Application logic will have to cater to different sets of attributes, depending on TYPE.
- Map the subtypes onto separate tables - one for each subtype.
- Each table will contain only instances of that subtype.
- Use when there are many subtype-specific attributes or relationships.
- Design Advantages
- The subtype's attribute optionality is enforced at the database level.
- Application logic does not require checks for subtypes.
- Design Disadvantages
- Access to the supertype requires the UNION operator or a view with the UNION operator.
- Views that join the two tables are display only.
- Application program code must be specific to the individual subtype tables.
- Maintenance of UID's across subtypes is difficult to implement.