Primary-Design-Approaches¶
When building a database for an organization, there are two primary Design Approaches (āĻĄāĻŋāĻāĻžāĻāύ āĻĒāĻĻā§āϧāϤāĻŋāϏāĻŽā§āĻš) to make sure the data is structured cleanly without errors:
1. Normalization Theory (āύāϰāĻŽāĻžāϞāĻžāĻāĻā§āĻļāύ āϤāϤā§āϤā§āĻŦ)¶
-
Core Concept: Formalizes (āύāĻŋāϰā§āĻĻāĻŋāώā§āĻ āύā§āϤāĻŋāĻŽāĻžāϞāĻžāϝāĻŧ āϰā§āĻĒ āĻĻā§āϝāĻŧ) what makes a database design "bad" and provides formal mathematical tests to detect and fix those flaws.
-
Goal: To eliminate data redundancy (āĻĄā§āĻĒā§āϞāĻŋāĻā§āĻ āĻĄā§āĻāĻž) and prevent update anomalies (āϤāĻĨā§āϝ āĻĒāϰāĻŋāĻŦāϰā§āϤāύā§āϰ āϏāĻŽāϝāĻŧ āĻā§āϞ āĻšāĻāϝāĻŧāĻž).
- Real-life Example:
- If you put Student Info, Course Info, and Teacher Info all inside one giant table, every time 50 students take the same course, the teacher's name and phone number get written 50 times.
- Normalization tests this messy table, identifies that it is a bad design, and splits it into three clean, linked tables:
Students,Courses, andTeachers.
2. Entity-Relationship (ER) Model (āϏāϤā§āϤāĻž-āϏāĻŽā§āĻĒāϰā§āĻ āĻŽāĻĄā§āϞ)¶
-
Core Concept: Represents an entire enterprise (āĻĒā§āϰāϤāĻŋāώā§āĻ āĻžāύ āĻŦāĻž āϏāĻāϏā§āĻĨāĻž) as a collection of real-world objects (Entities) and the connections (Relationships) between them.
-
Key Components:
-
Entity (āϏāϤā§āϤāĻž): A "thing" or "object" in the organization that is distinguishable (āĻāϞāĻžāĻĻāĻžāĻāĻžāĻŦā§ āĻā§āύāĻž āϝāĻžāϝāĻŧ āĻāĻŽāύ) from other objects.
-
Example: A specific
Student, aTeacher, anAccount, or aProduct. -
Attributes (āĻŦā§āĻļāĻŋāώā§āĻā§āϝāϏāĻŽā§āĻš): Properties that describe the entity.
-
Example: A
Studententity is described by attributes likeRoll_Number,Name,Department, andDate_of_Birth. -
Relationship (āĻĒāĻžāϰāϏā§āĻĒāϰāĻŋāĻ āϏāĻŽā§āĻĒāϰā§āĻ): An association (āϝā§āĻāϏā§āϤā§āϰ/āϏāĻāϝā§āĻ) among several entities.
-
Example: A
Studententity and aCourseentity are connected by the relationship "Enrolls In". ADoctorand aPatientare connected by "Treats". -
Entity-Relationship Diagram (ER Diagram): The entire model is represented diagrammatically (āĻāĻŋāϤā§āϰā§āϰ āĻŽāĻžāϧā§āϝāĻŽā§) using standard shapes:
-
Rectangles: Entities (e.g.,
Student,Course) - Ovals / Ellipses: Attributes (e.g.,
Name,ID) - Diamonds: Relationships (e.g.,
Enrolls)
How Both Approaches Work Together¶
-
Step 1 (ER Model - Top-Down): You first draw an ER Diagram to visualize the whole system and create your initial tables.
-
Step 2 (Normalization - Bottom-Up): You test those tables using Normalization rules to find flaws, remove duplicate fields, and confirm the design is clean.
