CS-Notes icon indicating copy to clipboard operation
CS-Notes copied to clipboard

Notes for end sem

Open sanaaa09 opened this issue 2 months ago • 8 comments

🌸 Normalization in DBMS (BCA 1st Year)

🌿 What is Normalization?

Definition:
Normalization is a process of organizing data in a database to reduce redundancy (duplicate data) and improve data integrity (accuracy and consistency).

It means dividing large, unorganized tables into smaller, logical tables — so data is stored efficiently.


💡 Why Normalization is Needed

Problem (Before Normalization) Solution (After Normalization)
Data repeated many times Data repetition reduced
Difficult to update data Easier to update/delete/insert
Database becomes confusing Clear and efficient structure
Inconsistent data Data remains accurate and consistent

⚙️ Important Points

  • Normalization is done using normal forms (NF).
  • Each normal form has rules.
  • Main normal forms are:
    1. 1NF – First Normal Form
    2. 2NF – Second Normal Form
    3. 3NF – Third Normal Form
    4. BCNF – Boyce-Codd Normal Form

🧩 Types of Normalization (With Examples)


🥇 1NF – First Normal Form

📘 Rule:

  • Each cell must contain only one value.
  • Each record should be unique.

❌ Before 1NF:

| Student_ID | Student_Name | Subjects        |
|-------------|---------------|----------------|
| 1           | Riya          | DBMS, C, Java  |
| 2           | Sanjay        | DBMS, Python   |

After 1nf

| Student_ID | Student_Name | Subject |
|-------------|---------------|----------|
| 1           | Riya          | DBMS    |
| 1           | Riya          | C       |
| 1           | Riya          | Java    |
| 2           | Sanjay        | DBMS    |
| 2           | Sanjay        | Python  |


🥈 2NF – Second Normal Form

📘 Rule:
	•	Table must be in 1NF.
	•	No partial dependency (non-key columns must depend on the whole primary key).

❌ Before 2NF:

| Student_ID | Subject | Student_Name | Subject_Fee |
|-------------|----------|---------------|--------------|
| 1           | DBMS     | Riya          | 500          |
| 1           | C        | Riya          | 400          |
| 2           | Python   | Sanjay        | 600          |

Problem:
	•	Student_Name depends only on Student_ID.
	•	Subject_Fee depends only on Subject.
→ Partial dependency exists.

✅ After 2NF:

Table 1: Student

| Student_ID | Student_Name |
|-------------|---------------|
| 1           | Riya          |
| 2           | Sanjay        |


Table 2 subject 

| Subject | Subject_Fee |
|----------|--------------|
| DBMS     | 500          |
| C        | 400          |
| Python   | 600          |

Non-key columns depend on the whole key — Table is in 2NF.


🥉 3NF – Third Normal Form

📘 Rule:
	•	Table must be in 2NF.
	•	No transitive dependency (a non-key column should not depend on another non-key column).

❌ Before 3NF:

| Student_ID | Student_Name | City   | Pin_Code |
|-------------|---------------|--------|-----------|
| 1           | Riya          | Pune   | 411001    |
| 2           | Sanjay        | Delhi  | 110001    |




Problem:
	•	City depends on Pin_Code, not on Student_ID.
→ Transitive dependency exists.

✅ After 3NF:

Table 1: Student

| Student_ID | Student_Name | Pin_Code |
|-------------|---------------|-----------|
| 1           | Riya          | 411001    |
| 2           | Sanjay        | 110001    |


Table 2 city

| Pin_Code | City   |
|-----------|--------|
| 411001    | Pune   |
| 110001    | Delhi  |

No transitive dependency — Table is in 3NF.

sanaaa09 avatar Oct 26 '25 15:10 sanaaa09

这是来自QQ邮箱的假期自动回复邮件。您好,您的邮件已收到,我会尽快给您回复。

HarryWord avatar Oct 26 '25 15:10 HarryWord

  您好,邮件已收到,我将在上机后,尽快给您回复。

lanseie avatar Oct 26 '25 15:10 lanseie

您好,来信已收到,谢谢!

SunnyEver0 avatar Oct 26 '25 15:10 SunnyEver0

你发过来的邮件怎么都是乱码啊,什么都看不到,再发一次吧。

tangdlit avatar Oct 26 '25 15:10 tangdlit

您好,您的邮件我已收到,我会尽快回复的,谢谢~

IrenaChen33 avatar Oct 26 '25 15:10 IrenaChen33

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

SmokingMouse avatar Oct 26 '25 15:10 SmokingMouse

这是来自QQ邮箱的假期自动回复邮件。您发给我邮件已经收到,我会尽快给您回复。

huyouen avatar Oct 26 '25 15:10 huyouen

这是来自QQ邮箱的假期自动回复邮件。你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。

KafCaleb avatar Oct 26 '25 15:10 KafCaleb