Docsity

Database Normalization: BCNF, 3NF, and Data Dependencies, Cheat Sheet of Deductive Database Systems

Toggle sidebar
bg1
Q1
a) What is Normalization and Why Is It Important?
Normalization is the process of organizing data in a database to:
• Remove repeated data (redundancy)
• Avoid errors when inserting, deleting, or updating
• Make data clean and organized
b) Normalize This Table to BCNF
StudentID
StudentName
CourseID
CourseName
InstructorName
101
Alice
CSE101
DBMS
Dr. Smith
101
Alice
CSE102
OS
Dr. John
102
Bob
CSE101
DBMS
Dr. Smith
Step 1: 1NF
Data is already atomic (simple values)
Step 2: 2NF
Break into smaller tables to remove partial dependency:
1. Students
StudentID
StudentName
101
Alice
102
Bob
2. Courses
CourseID
CourseName
InstructorName
CSE101
DBMS
Dr. Smith
CSE102
OS
Dr. John
3. Enrollments
pf3
pf4

Partial preview of the text

Download Database Normalization: BCNF, 3NF, and Data Dependencies and more Cheat Sheet Deductive Database Systems in PDF only on Docsity!

Q

a) What is Normalization and Why Is It Important?

Normalization is the process of organizing data in a database to:

  • Remove repeated data (redundancy)
  • Avoid errors when inserting, deleting, or updating
  • Make data clean and organized

b) Normalize This Table to BCNF

StudentID StudentName CourseID CourseName InstructorName 101 Alice CSE101 DBMS Dr. Smith 101 Alice CSE102 OS Dr. John 102 Bob CSE101 DBMS Dr. Smith Step 1: 1NF Data is already atomic (simple values) Step 2: 2NF Break into smaller tables to remove partial dependency:

  1. Students StudentID StudentName 101 Alice 102 Bob
  2. Courses CourseID CourseName InstructorName CSE101 DBMS Dr. Smith CSE102 OS Dr. John
  3. Enrollments

StudentID CourseID 101 CSE 101 CSE 102 CSE Step 3: 3NF and BCNF Check for extra dependency:

  • CourseName → InstructorName So, split Courses into: Courses CourseID CourseName CSE101 DBMS CSE102 OS Instructors CourseName InstructorName DBMS Dr. Smith OS Dr. John Q a) Definitions
  • Transitive Dependency: A → B, B → C → then A → C (bad for 3NF)
  • Multivalued Dependency: One item has many independent values (bad for 4NF)
  • Join Dependency: Data is spread and must be joined back (bad for 5NF) b) Examples

From this table: | OrderID | CustName | Address | Phone | Product | Qty | Price | ShipAddress | Method | Date | Step 1: Break into simpler tables:

  1. Customer | CustID | CustName | Address | Phone |
  2. Order | OrderID | CustID | ShipAddress | Method | Date |
  3. Product | ProductID | ProductName | Price |
  4. OrderDetails | OrderID | ProductID | Qty | Primary & Foreign Keys:
  • Customer: PK = CustID
  • Order: PK = OrderID, FK = CustID
  • Product: PK = ProductID
  • OrderDetails: PK = (OrderID, ProductID), FKs = OrderID, ProductID 3. Functional Dependencies
  • OrderID → Customer Info, Shipping Info
  • CustID → CustName, Address
  • ProductID → ProductName, Price
  • OrderID + ProductID → Qty