Database Design - Normalization
Database Design - Normalization
Table of Contents
Entity Relationship Diagram.......................................................................................................1
Entities and Attributes.........................................................................................................1
Relationships.......................................................................................................................1
Artist Database ERD and Tables.........................................................................................3
General Rules Governing Relationships Among Tables.....................................................3
Normalization Rules...................................................................................................................6
The Need for Normalization...............................................................................................6
Conversion to 1NF..............................................................................................................7
Conversion to 2NF..............................................................................................................8
Conversion to 3NF..............................................................................................................9
Boyce-Codd Normal Form (BCNF).................................................................................10
Database Design........................................................................................................................11
Changing Data into Information.......................................................................................11
The Information System....................................................................................................11
Systems Development Life Cycle.....................................................................................12
Database Lifecycle (DBLC).............................................................................................13
Phase 1: Database Initial Study.................................................................................13
Phase 2: Database Design.........................................................................................14
Phase 3: Implementation and Loading......................................................................16
Phase 4: Testing and Evaluation...............................................................................16
Phase 5: Operation....................................................................................................17
Phase 6: Maintenance and Evaluation......................................................................17
DB Design Strategy Notes........................................................................................................17
Centralized vs. Decentralized Design.......................................................................................17
Database Management System.................................................................................................17
Installation and Uninstallation of Oracle Database Server...............................................18
DBMS – Unit 1 Database Design Concept 1
Relationships
– A relationship is an association between entities. For example, a STUDENT takes a
CLASS, a PROFESSOR teaches a CLASS, a DEPARTMENT employs a PROFESSOR, a
DIVISION is managed by an EMPLOYEE, and AIRCRAFT is flown by a CREW, etc. The
entities that participate in a relationship, i.e., connected entities, are called participants.
Connectivity and Cardinality
Connectivity describes relationship classification. It may be classified as 1:1, 1:M,
M:N.
Cardinality expresses the specific number of entity occurrences associated with one
occurrence of related entity.
Connectivity and cardinality are established by very concise statements known as
business rules, which is derived from a precise and detailed description of an
organization’s data environment, also establish the E-R model’s entities, attributes,
relationships, connectivities and constraints.
Relationship Strength
Existence Dependence – Entity’s existence depends on existence of related entities
Weak (non-identifying) Relationships
PK of related entity doesn’t contain PK component of parent entity
For example, the definition of the COURSE and CLASS entities is
COURSE(CRS_CODE, DEPT_CODE, CRS_DESCRIPTION,
CRS_CREDIT)
CLASS(CLASS_CODE, CRS_CODE, CLASS_SECTION, CLASS_TIME,...)
Strong (identifying) Relationships
PK of related entity contains PK component of parent entity
For example, the definition of the COURSE and CLASS entities is
COURSE(CRS_CODE, DEPT_CODE, CRS_DESCRIPTION,
CRS_CREDIT)
CLASS(CRS_CODE, CLASS_SECTION, CLASS_TIME,…)
Weak Entities – In database design terms, the existence of a strong relationship
between a parent entity and its related entity or entities is associated with weak
entities.
Relationship Participation
Optional
Entity occurrence does not require a corresponding occurrence in related entity
A PROFESSOR does not to teach a CLASS; i.e., CLASS is optional to
PROFESSOR
It indicates that the minimum cardinality is 0 for the optional entity.
Mandatory
DBMS – Unit 1 Database Design Concept 3
Multi-valued Attributes (1:M Relationship, Foreign Key CAR_VIN in the New Table)
Normalization Rules
Conversion to 1NF
Repeating groups must be eliminated
Repeating groups, for example, any project number (PROJ_NUM) in the Figure,
can have a group of several data entries.
Make sure that each row defines a single entity.
Proper primary key developed; for example, uniquely identifies attribute values
(rows), combination of PROJ_NUM and EMP_NUM.
DBMS – Unit 1 Database Design Concept 8
Dependencies can be identified with help of the figure above, which is the dependency
diagram shown in first normal form (1NF).
Desirable dependencies based on primary keys, which are bold, underlined, and
shared in a different color in the figure.
Less desirable dependencies, which is indicated with arrows below the dependency
diagram. Two types of dependencies exist:
Partial dependencies – based on part of composite primary key.
Transitive dependencies – one nonprime attribute depends on another
nonprime attribute.
The table structure can shown in the format:
TABLE_NAME(PRIMARY_KEY_ATTRIBUTE(S), DEPENDENT
ATTRIBUTES)
Prime attribute (or key attribute), any attribute that is at least part of a key, e.g.,
PROJ_NUM and EMP_NUM.
Nonprime attribute (or nonkey attribute), is not even part of a key.
1NF Summarized
All key attributes defined
No repeating groups in table
All attributes dependent on primary key
Conversion to 2NF
Start with 1NF format:
Write each key component on separate line
Write original (composite) key on last line
PROJ_NUM
EMP_NUM
PROJ_NUM EMP_NUM
Each component will become the key new table
Write dependent attributes after each key. For example herein, the three new tables,
PROJECT, EMPLOYEE, and ASSIGN, are described by
PROJECT (PROJ_NUM, PROJ_NAME)
EMPLOYEE (EMP_NUM, EMP_NAME, JOB_CLASS, CHG_HOUR)
ASSIGN (PROJ_NUM, EMP_NUM, ASSIGN_HOURS)
The conversion results of this operation are displayed in next page. (It still shows a
transitive dependency, which can generate anomalies – the charge per hour changes for a
job classification that is held by many employees.)
2NF Conversion Results
In 1NF
DBMS – Unit 1 Database Design Concept 9
Conversion to 3NF
Break off the piece(s) that are identified by the transitive dependency arrow(s) below the
dependency diagram and storing them in separate table(s) to eliminate transitive
functional dependencies
PROJECT (PROJ_NUM, PROJ_NAME)
DBMS – Unit 1 Database Design Concept 10
Database Design
Figure 2
Planning
Should the existing system be continued, modified or replaced?
The technical of hardware and software requirements.
The system cost.
Analysis
What are the precise requirements of the current system’s end users?
Do these requirements fit into the overall information requirements?
DBMS – Unit 1 Database Design Concept 13
Detailed system design – the designer completes the design of the system’s processes
including all the necessary technical specifications for the screens, menus, reports, and
other devices that might e used in help make the system a more efficient information
generator.
Implementation
Install the hardware, the DBMS software, and application programs.
The system enters into a cycle of coding, testing, and debugging, until it is readto
delivered.
The actual database is created, and the system is customized, by using a variety of
methods and devices:
Customized user programs
Database interface programs
Conversion programs that import the data from a different file structure, using
batch programs, a database utility, or both.
Maintenance
Corrective maintenance in response to system errors.
Adaptive maintenance due to changes in the business environment.
Perfect maintenance to enhance the system.
Figure 3
Information needs
Information users
Information sources
Information constitution
Data sources
Developing and gathering end-user data views
Direct observation of current system
Interfacing with systems design group
Business rules
Entity Relationship Modeling and Normalization
Steps to develop the conceptual model using ERD
STEP ACTIVITY
1 Identify, analyze, and refine the business rules.
2 Identify the main entities, using the results of Step 1.
3 Define the relationships among the entities, using the results of Steps 1 and 2.
4 Define the attributes, primary keys, and foreign keys for each of the entities.
5 Normalize the entities.
6 Complete the initial ERD.
7 Have the main end users verify the model in Step 6 against the data, information and
processing requirements.
8 Modify the ERD, using the results of Step 7.
E-R Modeling is Iterative – Figure 8
Concept Design: Tools and Resource – Figure 9
Data Model Verification
E-R model is verified against proposed system processes
End user views and required transactions
Access paths, security, concurrency control
Business-imposed data requirements and constraints
E-R Model Verification Process
STEP ACTIVITY
1 Identify the E-R model’s central entity.
2 Identify each module and its components.
3 Identify each module’s transaction requirements;
Internal: Updates/Inserts/Deletes/Queries/Reports
External: Module interfaces
4 Verify all processes against the E-R model.
5 Make all necessary changes suggested in Step 4.
DBMS – Unit 1 Database Design Concept 16
Phase 5: Operation
Database considered operational
Starts process of system evaluation
Unforeseen problems may surface
DBMS – Unit 1 Database Design Concept 18