πŸ“˜ Course Code: 21CSC205J β€’ Semester 4

Database Management Systems Study Hub

Comprehensive academic revision guide covering ER modeling, relational algebra, relational decomposition & BCNF normalization, ACID transactions, conflict serializability, concurrency locking, and B+ Tree indexing.

πŸ“Š Methodology Behind PYQ Frequency Analysis

The core focus areas below reflect historical analysis of SRM IST 21CSC205J end-semester examinations and cycle test papers (2022–2025). Questions are categorized by recurrence in Part A (relational integrity constraints, ACID definitions), Part B (relational algebra expressions, locking protocols), and Part C (15-mark numerical problems: functional dependency closures, BCNF decomposition proofs, and Precedence Graph conflict serializability tests).

Unit 1 β€’ Architecture & Data Models

Database Architecture, ER Modeling & Relational Algebra

1.1 Three-Schema Architecture & Data Independence

The ANSI/SPARC 3-schema architecture separates user applications from physical storage:

  • External Level (View): Individual user views tailored to specific business roles.
  • Conceptual Level (Logical): Global logical structure of the entire database (entities, relationships, constraints, data types).
  • Internal Level (Physical): Physical storage representation (record formats, page layouts, file structures, indexes).
  • Logical Data Independence: Capacity to alter the conceptual schema without altering external schemas or application programs.
  • Physical Data Independence: Capacity to alter internal schema (e.g. adding B+ trees, partitioning) without modifying the conceptual schema.

1.2 Relational Algebra Operators

Fundamental Operators: β€’ Selection (Οƒ_p(R)): Filters tuples satisfying predicate p: {t ∈ R | p(t)} β€’ Projection (Ο€_A(R)): Extracts specified columns A, eliminating duplicate tuples β€’ Cartesian Product (R Γ— S): Combines all tuples: {(r, s) | r ∈ R, s ∈ S} β€’ Set Difference (R - S): Tuples in R but not in S (R and S must be union-compatible) β€’ Union (R βˆͺ S): Tuples in R, S, or both (union-compatible) β€’ Rename (ρ_S(R)): Renames relation R to S or renames attributes Derived Operators: β€’ Natural Join (R β‹ˆ S): Ο€_{all unique attrs}(Οƒ_{R.A = S.A}(R Γ— S)) on common attribute A β€’ Theta Join (R β‹ˆ_ΞΈ S): Οƒ_ΞΈ(R Γ— S) conditioned on comparison predicate ΞΈ β€’ Division (R Γ· S): Finds tuples in R that are associated with ALL tuples in S
Unit 2 β€’ Relational Design & Normalization

Functional Dependencies & Normal Forms (1NF to BCNF)

2.1 Armstrong's Axioms for Functional Dependencies

Given a set of functional dependencies $F$, the closure $F^+$ is derived using sound and complete inference rules:

β€’ Reflexivity: If Y βŠ† X, then X β†’ Y β€’ Augmentation: If X β†’ Y, then XZ β†’ YZ for any attribute set Z β€’ Transitivity: If X β†’ Y and Y β†’ Z, then X β†’ Z Derived Rules: β€’ Union: If X β†’ Y and X β†’ Z, then X β†’ YZ β€’ Decomposition: If X β†’ YZ, then X β†’ Y and X β†’ Z β€’ Pseudotransitivity: If X β†’ Y and WY β†’ Z, then WX β†’ Z

2.2 Formal Normal Form Definitions

  • 1NF: All attribute domains contain only atomic (indivisible) scalar values. No repeating groups or nested tables.
  • 2NF: In 1NF and no non-prime attribute is partially dependent on any candidate key. Every non-prime attribute must depend on the whole candidate key.
  • 3NF: In 2NF and for every non-trivial functional dependency $X \to Y$, either $X$ is a superkey OR $Y$ is a prime attribute (part of some candidate key). Eliminates transitive dependencies.
  • BCNF (Boyce-Codd Normal Form): For every non-trivial functional dependency $X \to Y$, $X$ MUST be a superkey. Stricter than 3NF.
πŸ“ Worked Example 1: Candidate Key Discovery & BCNF Decomposition

Problem Statement: Consider relation $R(A, B, C, D, E)$ with functional dependency set:
$F = \{ A \to B, \; BC \to D, \; E \to C, \; D \to A \}$.
Find all candidate keys, identify the highest normal form of $R$, and decompose $R$ into BCNF ensuring lossless join.

  1. Step 1: Determine Candidate Keys
    Attribute $E$ never appears on the right-hand side of any FD; $E$ must be part of every candidate key.
    Test closure of $(A, E)$:
    β€’ $(AE)^+ = \{A, E\}$
    β€’ Using $A \to B \implies \{A, B, E\}$
    β€’ Using $E \to C \implies \{A, B, C, E\}$
    β€’ Using $BC \to D \implies \{A, B, C, D, E\} = R$. Hence, $AE$ is a Candidate Key.
    Testing other combinations:
    β€’ Since $D \to A$, replace $A$ with $D$: $(DE)^+ = \{D, E, A, B, C\} = R \implies$ $DE$ is a Candidate Key.
    β€’ Since $BC \to D$, test $(BCE)^+$: $(BCE)^+ = \{B, C, E, D, A\} = R \implies$ $BCE$ is a Candidate Key.
    Prime attributes: $\{A, B, C, D, E\}$ (all attributes are prime!). Non-prime attributes: $\emptyset$.
  2. Step 2: Check Normal Forms
    β€’ 1NF: Holds (atomic domains).
    β€’ 2NF: Holds vacuously because there are zero non-prime attributes.
    β€’ 3NF: Holds because for every FD $X \to Y$, $Y$ is a prime attribute.
    β€’ BCNF Check: In $A \to B$, determinant $A$ is NOT a superkey (it cannot derive $E$). Thus, $R$ is in 3NF but NOT in BCNF.
  3. Step 3: Lossless BCNF Decomposition
    The violating dependency is $A \to B$. Decompose $R$ based on $A \to B$:
    β€’ Compute $A^+ = \{A, B\}$.
    β€’ Create relation $R_1 = A^+ = (A, B)$ with FD $\{A \to B\}$. Here $A$ is a superkey, so $R_1$ is in BCNF.
    β€’ Create relation $R_2 = R - (A^+ - A) = (A, C, D, E)$.
    β€’ Check $R_2$: The FDs applicable to $R_2$ are $\{E \to C, D \to A\}$. For $E \to C$, $E^+ = \{E, C\}$ (not superkey of $R_2$).
    β€’ Decompose $R_2$ into $R_{21} = (E, C)$ with FD $\{E \to C\}$ (in BCNF) and $R_{22} = (A, D, E)$ with FD $\{D \to A\}$.
    β€’ In $R_{22}$, $D \to A$ violates BCNF ($D$ is not superkey of $ADE$). Decompose into $R_{221} = (A, D)$ and $R_{222} = (D, E)$.
    Final BCNF Relations: $R_1(A, B)$, $R_2(E, C)$, $R_3(A, D)$, $R_4(D, E)$.
    Lossless Join Proof: Each decomposition step splits on $X \to Y$ and preserves $R_a \cap R_b = X$, where $X$ forms a candidate key of at least one of the decomposed schemas.
Unit 3 β€’ Transactions & Concurrency

ACID Properties, Schedules & Conflict Serializability

3.1 Transaction ACID Properties

β€’ Atomicity: All operations execute to completion or none do ('All-or-Nothing'). Managed by Recovery subsystem (Undo logging). β€’ Consistency: Database transitions from one valid consistent state satisfying all integrity constraints to another. β€’ Isolation: Intermediate states of concurrent transactions are invisible to one another. Managed by Concurrency Control. β€’ Durability: Committed changes persist permanently even after hardware crashes. Managed by Redo logging / WAL.
πŸ“ Worked Example 2: Conflict Serializability via Precedence Graph

Problem Statement: Consider concurrent schedule $S$ with transactions $T_1, T_2, T_3$:
$S: R_1(X); \; R_2(Y); \; W_1(X); \; R_3(X); \; W_2(Y); \; W_3(X);$
Test whether schedule $S$ is conflict serializable. If serializable, determine the equivalent serial execution order.

  1. Step 1: Identify Conflicting Operation Pairs
    Two operations conflict if they belong to different transactions, access the same data item, and at least one operation is a Write.
    β€’ On item $X$:
      - $R_1(X)$ followed by $W_3(X) \implies$ Directed edge $T_1 \to T_3$.
      - $W_1(X)$ followed by $R_3(X) \implies$ Directed edge $T_1 \to T_3$.
      - $W_1(X)$ followed by $W_3(X) \implies$ Directed edge $T_1 \to T_3$.
      - $R_3(X)$ followed by $W_3(X)$ (same transaction $T_3$, no edge across transactions).
    β€’ On item $Y$:
      - $R_2(Y)$ and $W_2(Y)$ belong to $T_2$ only; no conflicting cross-transaction operations on $Y$.
  2. Step 2: Construct Precedence Graph $G = (V, E)$
    β€’ Vertices: $V = \{T_1, T_2, T_3\}$
    β€’ Edges: $E = \{ (T_1, T_3) \}$
    Node $T_2$ has in-degree $0$ and out-degree $0$ (isolated).
  3. Step 3: Cycle Detection & Topological Sort
    The precedence graph contains zero directed cycles. By the Conflict Serializability Theorem, schedule $S$ is Conflict Serializable.
    Topological Sort produces valid serial schedules:
    1. $\mathbf{T_1 \to T_2 \to T_3}$
    2. $\mathbf{T_2 \to T_1 \to T_3}$
    3. $\mathbf{T_1 \to T_3 \to T_2}$
Unit 4 β€’ Concurrency Control & Recovery

Two-Phase Locking (2PL), Deadlocks & WAL Recovery

4.1 Two-Phase Locking Protocols

2PL guarantees conflict serializability by constraining lock acquisitions and releases into two monotonic phases:

β€’ Growing Phase: Transaction may acquire new locks (Shared or Exclusive) but cannot release any lock. β€’ Lock Point: Moment when the transaction holds its maximum set of locks. β€’ Shrinking Phase: Transaction may release locks but cannot acquire any new lock. Variants: β€’ Strict 2PL: All Exclusive locks must be held until COMMIT/ABORT. Guarantees strict schedules and prevents cascading rollbacks. β€’ Rigorous 2PL: ALL locks (both Shared and Exclusive) held until COMMIT. Guarantees serialization order identical to commit order.

4.2 Deadlock Prevention: Wait-Die vs. Wound-Wait

When transaction $T_i$ requests a lock held by $T_j$, timestamp schemes decide based on ages (earlier timestamp = older):

  • Wait-Die (Non-preemptive): If $T_i$ is older than $T_j$, $T_i$ is allowed to wait. If $T_i$ is younger, $T_i$ dies (aborts and restarts with its original timestamp).
  • Wound-Wait (Preemptive): If $T_i$ is older than $T_j$, $T_i$ wounds $T_j$ ($T_j$ is aborted and releases lock to $T_i$). If $T_i$ is younger, $T_i$ is allowed to wait.
Unit 5 β€’ Indexing & Storage

Multilevel Indexing & B+ Tree Data Structures

5.1 B+ Tree Properties

A B+ Tree of order $p$ (maximum fanout) is a balanced search tree optimized for secondary storage:

β€’ Balanced Depth: Every leaf node is at the exact same tree level. β€’ Internal Nodes: Store up to (p - 1) search keys and p child pointers. Minimum keys = ⌈p/2βŒ‰ - 1. β€’ Leaf Nodes: Store actual data pointers (or records) and are doubly linked sequentially for efficient range queries. β€’ Search Complexity: O(log_p N), where disk I/O is minimized by maximizing page node capacity.

Lecture Notes & PPT Presentations

Directly connected to SRM IST Google Drive archives. Verified classroom notes, unit PDFs, and semester papers:

⏳
Connecting to Google Drive repository…
Academic Provenance & Verification Notice: This study guide is authored by peer student tutors and academic contributors for the SRM IST 21CSC205J curriculum based on standard reference works (Silberschatz, Korth, Sudarshan). For corrections, derivations, or syllabus inquiries, reach out via Contact Us.