

























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


























For BCA · B.Tech CSE/IT · B.Sc CS · MCA Indian University Syllabus Aligned · Exam-Ready Notes MySQL Practical Examples · Diagrams · Question Bank Edition 2026
Step-by-step normalization guide (1NF through BCNF) with worked examples, functional dependency problems, closure computation, candidate key identification, and minimal cover.
(^) Data redundancy, insert / update / delete anomalies Functional dependencies — full, partial, transitive 1NF, 2NF, 3NF, BCNF with step-by-step examples Armstrong's axioms and closure of attribute sets Candidate key identification using closure Lossless decomposition and dependency preservation Minimal cover of a set of dependencies
BCA students preparing for semester exams. B.Tech CSE and IT students in the DBMS course. B.Sc Computer Science students. MCA students revising for exams or interviews. Freshers preparing for SQL rounds in placement interviews.
P A R T I V · D E S I G N Q U A L I T Y · C H A P T E R 8
Third-year students. Big project. One table. The team called it mega_table. It held every column they thought they needed — student name, department, department head, course name, teacher name, teacher phone, marks, fee amount, fee due date. Fifteen columns. All in one table. Week one — the database ran. Week two — Priya's marks appeared twice because they had entered her name in two rows. Week three — the department head got promoted. They had to update his name in 200 rows. They missed three. Week four — a student without any enrollment could not be added because the enrollment columns were required. Week five — the demo. The evaluator asked one question. "Why is your database repeating the same information a hundred times?" They had no answer. They lost 15 marks. And a lesson. K E Y I D E A A table that stores everything ends up being a table that trusts nothing.
◆ That week the team met their senior. He drew four small tables on a whiteboard. Students. Departments. Teachers. Enrollments. Same data. Zero repetition. He called the process normalization. This chapter is that whiteboard, written down. ◆ ◆ ◆
CHAPTER LEARNING OBJECTIVES P A R T I V · D E S I G N Q U A L I T Y · C H A P T E R 8 By the end of this chapter, you should be able to: Explain why normalization is needed. Identify insert, update, and delete anomalies. Explain functional, partial, and transitive dependencies. Apply 1NF, 2NF, 3NF, and BCNF to a table step by step. (^) Explain 4NF and 5NF at an overview level. Compare normalization with denormalization. 8.1 WHAT IS NORMALIZATION P A R T I V · D E S I G N Q U A L I T Y · C H A P T E R 8 Normalization is the process of breaking one big messy table into several smaller, cleaner tables — so each fact is stored in exactly one place.
8.3 THE THREE ANOMALIES P A R T I V · D E S I G N Q U A L I T Y · C H A P T E R 8
You cannot add data because required related data does not exist yet. Example: You want to add a new course "Blockchain" to mega_table, but no student is enrolled yet. The row has empty student columns. Some databases will refuse.
You must update the same fact in many rows, and if you miss even one, the data is inconsistent. Example: The CSE department head changes. You must update every CSE row. Miss one — inconsistency.
Deleting one row accidentally erases unrelated important information. Example: The last student enrolled in "Blockchain" leaves the course. If you delete the row, you also lose the fact that the "Blockchain" course exists.
Anomaly Cause Real-life symptom Insert Cannot add without unrelated data Empty required columns Update Same fact stored many times Data goes out of sync Delete Deleting a row erases other information Course disappears when students leave 8.4 FUNCTIONAL DEPENDENCY (FD) P A R T I V · D E S I G N Q U A L I T Y · C H A P T E R 8 A functional dependency says: "If I know A, I can determine B."
Written as A → B. Examples: student_id → name — if I know the student ID, I know the name. (^) student_id → dept_name — if I know the student ID, I know their department. course_id → course_title.
B depends on the whole of a composite key, not part of it. Example: In enrollments(student_id, course_id, grade), the grade depends on both — full functional dependency.
B depends on only part of a composite key. Example: In mega_table, if student_name depends only on student_id (part of the composite key), that is a partial dependency.
Example: student_id → dept_id → dept_head. The dept_head depends on dept_id, which depends on student_id. K E Y I D E A Every normal form beyond 1NF is a specific rule about which dependencies are allowed. Learn the dependencies and you learn the whole chapter. 8.5 FIRST NORMAL FORM (1NF) P A R T I V · D E S I G N Q U A L I T Y · C H A P T E R 8
A table is in 2NF if:
enrollments(student_id, course_id, student_name, course_title, grade) with primary key (student_id, course_id). student_name depends only on student_id. Partial dependency. course_title depends only on course_id. Partial dependency.
Split into three tables. students(student_id PK, student_name) courses(course_id PK, course_title) enrollments(student_id, course_id, grade) Now every non-key column in enrollments depends on the entire composite key. K E Y I D E A 2NF violations only happen with composite primary keys. Single-column primary keys skip 2NF entirely. 8.7 THIRD NORMAL FORM (3NF) P A R T I V · D E S I G N Q U A L I T Y · C H A P T E R 8
A table is in 3NF if:
students(student_id, name, dept_id, dept_name, dept_head) with primary key student_id. dept_name depends on dept_id, which depends on student_id. Transitive. Same for dept_head.
Move department details to their own table. students(student_id PK, name, dept_id) departments(dept_id PK, dept_name, dept_head) Now every non-key column in students depends only on student_id. T R Y T H I S Look at every column in a table. Ask, "Does this depend on the primary key, or on another column?" That single question identifies most 3NF violations. 8.8 BOYCE-CODD NORMAL FORM (BCNF) P A R T I V · D E S I G N Q U A L I T Y · C H A P T E R 8
A table is in BCNF if for every functional dependency A → B, A is a super key. BCNF is a stricter version of 3NF. Every table in BCNF is in 3NF, but not every 3NF table is in BCNF.
Imagine a table class(student_id, course_id, teacher_id) where:
Removes join dependencies. If a table can be reconstructed by joining smaller tables, it should be split. Rare in college projects. K E Y I D E A 4NF and 5NF appear on exam papers but almost never in student projects. Understand the ideas. Do not lose sleep. 8.10 STEP-BY-STEP NORMALIZATION WALKTHROUGH P A R T I V · D E S I G N Q U A L I T Y · C H A P T E R 8
student_id name phones course_id course_title teacher 101 Amit 99999, 88888 C1 DBMS Prof. Rao 101 Amit 99999, 88888 C2 OS Prof. Sen 102 Neha 77777 C1 DBMS Prof. Rao Problems — multivalued phone, repeated course info, repeated teacher.
Split multivalued phones into rows or a child table. students(student_id, name) student_phones(student_id, phone) enrollments(student_id, course_id, course_title, teacher)
Move columns that depend only on course_id out of enrollments. courses(course_id, course_title, teacher) enrollments(student_id, course_id)
If teacher depends on course_id → teacher and teacher also has a phone, split further. teachers(teacher_id, teacher_name, phone) courses(course_id, course_title, teacher_id)
If any non-super-key determines another column, split again. In this example, after 3NF the tables are already in BCNF. Final schema: students(student_id PK, name) student_phones(student_id, phone) -- PK: (student_id, phone) teachers(teacher_id PK, teacher_name, phone) courses(course_id PK, course_title, teacher_id) enrollments(student_id, course_id) -- PK: composite T R Y T H I S Take your project's biggest table. Apply steps 1 to 3 on paper. It usually splits into 3 or 4 clean tables in 20 minutes. 8.11 ADVANTAGES AND DISADVANTAGES P A R T I V · D E S I G N Q U A L I T Y · C H A P T E R 8
Less redundancy. Better consistency. Easier updates. Smaller storage. Clearer meaning.
More tables to manage.
8.14 EXAM QUESTIONS P A R T I V · D E S I G N Q U A L I T Y · C H A P T E R 8
Q1. What is normalization? A stepwise process of organising a database into smaller tables to reduce redundancy and prevent anomalies. Q2. Define functional dependency. An FD A → B means the value of A uniquely determines the value of B. Q3. What is 1NF? A table is in 1NF if every column has atomic values and there are no repeating groups. Q4. What is a partial dependency? When a non-key column depends only on part of a composite primary key. Q5. Difference between 3NF and BCNF. Both remove transitive dependencies. BCNF is stricter — for every FD A → B, A must be a super key.
Q6. Explain 1NF, 2NF, and 3NF with examples. 1NF — atomic values only. Fix by splitting multivalued columns. 2NF — remove partial dependencies. Fix by separating columns that depend on only part of a composite key. 3NF — remove transitive dependencies. Fix by separating columns that depend on non-key columns. Q7. Explain insert, update, and delete anomalies with an example. Consider a mega_table storing student, course, and teacher. Insert anomaly — you cannot add a new course until at least one student joins it. Update anomaly — changing a teacher's name means editing multiple rows. Delete anomaly — removing the last student in a course erases the course itself. Q8. Normalize the following table up to 3NF: courses(course_id, course_title, teacher_id, teacher_name, teacher_phone, dept_id, dept_name)
Answer: 1NF is already satisfied. Teacher fields depend on teacher_id, not on the whole key. Department fields depend on dept_id. So split: courses(course_id PK, course_title, teacher_id, dept_id) teachers(teacher_id PK, teacher_name, teacher_phone) departments(dept_id PK, dept_name)
Q9. Given the table orders(order_id, customer_id, customer_name, product_id, product_name, price, quantity, order_date), take it through 1NF, 2NF, and 3NF. Suggested answer: Assume 1NF is met (atomic values). Composite key candidate — (order_id, product_id). (^) Partial dependencies — customer_id and customer_name depend only on order_id. product_name and price depend only on product_id. 2NF split — orders, order_items, products. 3NF — move customer_name out of orders into a customers table. Final: customers(customer_id PK, customer_name) orders(order_id PK, customer_id, order_date) products(product_id PK, product_name, price) order_items(order_id, product_id, quantity) 8.15 QUICK REVISION SHEET P A R T I V · D E S I G N Q U A L I T Y · C H A P T E R 8
End of Chapter 8
P A R T I V · D E S I G N Q U A L I T Y · C H A P T E R 9
Karan had two weeks left for his project submission. His guide gave him one instruction. "Before you touch MySQL, spend three hours in a cafe. Just paper and a pen. Come back with a design." Karan protested. Three hours felt like a waste. He had SQL to write. He went anyway. The first hour, he listed every entity his Student Attendance System would touch. Students, teachers, subjects, class sessions, attendance marks. The second hour, he wrote down the questions the system would answer. "How many classes did student X attend?" "What is the class-wise attendance percentage?" "Who has less than 75%?" The third hour, he drew tables. Then he drew arrows for dependencies. Then he redrew everything twice. He walked into the lab the next morning with 12 pages of design. He finished coding in six days. He got the highest marks in his batch. K E Y I D E A Design is where you fight your bugs. Code is where you record the winner.