diff --git a/app/sem4/dbms/content/chapter4.tsx b/app/sem4/dbms/content/chapter4.tsx new file mode 100644 index 0000000..f73052d --- /dev/null +++ b/app/sem4/dbms/content/chapter4.tsx @@ -0,0 +1,146 @@ +export const Ch4Content = () => { + return ( +
+

+ Normalization is the process of + organizing a database to reduce redundancy and improve data integrity by + breaking large tables into smaller, well-structured ones. +

+ +
+ +
+

+ Why Normalize? +

+ +
+ +
+ +
+

+ Functional Dependency +

+ +
+

Exam Tip: FDs are the foundation of all normal forms. Master them first.

+
+
+ +
+ +
+

+ 1NF — First Normal Form +

+ +
+

Violation → Fix

+
{`❌ Not 1NF:
+StudentID | Courses
+101       | DBMS, OS, CN
+
+✅ 1NF:
+StudentID | Course
+101       | DBMS
+101       | OS
+101       | CN`}
+
+
+ +
+ +
+

+ 2NF — Second Normal Form +

+ +
+

Violation → Fix

+
{`❌ Not 2NF (PK = StudentID + CourseID):
+StudentID | CourseID | StudentName | Grade
+101       | CS401    | Zubair      | A
+
+StudentName depends only on StudentID (partial dependency).
+
+✅ 2NF: Split into two tables:
+Students(StudentID, StudentName)
+Enrollments(StudentID, CourseID, Grade)`}
+
+
+ +
+ +
+

+ 3NF — Third Normal Form +

+ +
+

Violation → Fix

+
{`❌ Not 3NF:
+StudentID | DeptID | DeptName
+101       | D01    | CSE
+
+DeptName depends on DeptID (not on StudentID) — transitive.
+
+✅ 3NF: Split:
+Students(StudentID, DeptID)
+Departments(DeptID, DeptName)`}
+
+
+ +
+ +
+

+ BCNF — Boyce-Codd Normal Form +

+ +
+

If a table is in BCNF, it is also in 3NF — but not vice versa. BCNF is stronger.

+
+
+ +
+ +
+

+ Decomposition +

+ +
+
+ ); +}; \ No newline at end of file diff --git a/app/sem4/dbms/content/chapter5.tsx b/app/sem4/dbms/content/chapter5.tsx new file mode 100644 index 0000000..aa54577 --- /dev/null +++ b/app/sem4/dbms/content/chapter5.tsx @@ -0,0 +1,126 @@ +export const Ch5Content = () => { + return ( +
+

+ A transaction is a sequence of + database operations treated as a single unit. Concurrency control ensures + multiple transactions run simultaneously without conflicts. +

+ +
+ +
+

+ ACID Properties +

+ +
+

Exam Tip: ACID is one of the most asked topics. Remember all four with the mnemonic: All Changes Isolated & Durable.

+
+
+ +
+ +
+

+ Transaction States +

+ +
+

State Flow

+
{`Active → Partially Committed → Committed
+Active → Failed → Aborted`}
+
+
+ +
+ +
+

+ Concurrency Problems +

+ +
+ +
+ +
+

+ Locking +

+ +
+ +
+ +
+

+ Two-Phase Locking (2PL) +

+ +
+

Once a transaction releases its first lock, it enters the shrinking phase and cannot acquire new locks.

+
+
+ +
+ +
+

+ Deadlock +

+ +
+

Deadlock Example

+
{`T1 holds Lock(A), waits for Lock(B)
+T2 holds Lock(B), waits for Lock(A)
+→ Deadlock! Neither can proceed.`}
+
+
+ +
+ +
+

+ Timestamp-Based Concurrency Control +

+ +
+
+ ); +}; \ No newline at end of file