• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 7 pages
Summary

Summary SQL & Relational Database Management Complete Study Guide - Normalization, B+ Trees, ACID, Window Functions - CS 186 / CS 340 Exam Cheat Sheet

Document preview thumbnail
Preview 2 out of 7 pages

COMPREHENSIVE SQL & RELATIONAL DATABASE MANAGEMENT STUDY GUIDE & EXAM CHEAT SHEET Preparing for your database midterm or final exam? This high-yield, professionally formatted study companion covers core relational database theory, query execution, indexing, and transaction protocols without fluff. WHAT'S INCLUDED IN THIS COMPLETE GUIDE: Master SQL Operations & Relational Algebra Matrix: Mapping between SELECT/JOIN/WHERE and algebraic projection/selection/cross-products. True SQL Logical Execution Order: Why SELECT executes after WHERE and GROUP BY, and how it impacts aliases. Functional Dependencies & Normalization: Step-by-step algorithms for 1NF, 2NF, 3NF, and BCNF lossless/dependency-preserving decompositions. Storage & B+ Tree Indexing: Clustered vs. secondary index differences, composite index Leftmost Prefix Rule, and fan-out cost models. Transactions & ACID Guarantees: Detailed breakdown of Dirty Reads, Non-Repeatable Reads, and Phantom Reads across all 4 SQL Isolation Levels. Concurrency Control Protocols: Two-Phase Locking (2PL), Strict 2PL, Cascading Abort prevention, and Deadlock detection. Advanced SQL Window Functions: ROW_NUMBER(), RANK(), DENSE_RANK(), LAG(), LEAD(), and moving averages. 10 Deadly Exam Traps: Three-valued NULL logic, NOT IN with NULL failure, and WAL invariants. 20 Rapid-Fire Flashcards: Active recall Q&A prompts for pre-exam self-assessment. PERFECT FOR: - Students enrolled in CS 186, CS 340, DATA 100, or Information Systems - Midterm & Final Exam cramming - Technical interview preparation for Data Engineering & Backend roles ️ LEGAL DISCLAIMER: This is an independent academic summary and study aid. It is not affiliated with, endorsed by, or sponsored by any specific university, textbook author, or publisher.

Content preview

HIGH-YIELD REVISION GUIDE & CHEAT SHEET


SQL & Relational Database Systems
Complete Semester Guide
High-Yield Comprehensive Guide, Relational Algebra, B+ Tree Mechanics,
Normalization Decompositions, ARIES Recovery & Quick-Cram Appendix


Computer Science & Data Engineering | Course Code: CS 186 / CS 340 / DATA 100 | 2024-2025
Comprehensive Edition




📘 WHAT’S INSIDE THIS GUIDE:
✔ Relational Algebra & True SQL Execution Order with query cost optimization models


✔ Database Normalization Theory: Functional dependency closures, candidate keys, and step-
by-step 3NF/BCNF decompositions

✔ B+ Tree Indexing Deep Dive: Step-by-step worked trace of node splits, redistribution, and
height calculations

✔ Query Evaluation & Join Algorithms: Detailed disk I/O cost formulas for Page/Block Nested
Loop, Index Nested Loop, and Grace Hash Join

✔ Concurrency Control & Strict 2PL: Conflict serializability, Precedence Graphs, and 4 ANSI
Isolation Levels

✔ Crash Recovery (ARIES): Write-Ahead Logging (WAL) protocol and Analysis, Redo, and Undo
phase traces

✔ 10 Deadly Database Exam Traps covering NULL three-valued logic, subquery pitfalls, and
index scans

✔ APPENDIX: 1-Hour Emergency Pre-Exam Quick-Cram Cheat Sheet with master relational
matrix and 25 active recall flashcards
Disclaimer: This is an independently created academic study aid. It is not affiliated with, endorsed by, or sponsored by any specific
university, textbook author, or publisher.

, Computer Science & Data Engineering · CS 186 / CSSQL & Relational Database Systems Complete Semester
340 / DATA 100 Guide




1 Relational Algebra & Query Execution Mechanics
Relational algebra provides the formal foundation for declarative SQL query optimization.


1.1 Core Relational Operators
• Selection (𝜎𝑐(𝑅) ): Filters tuples satisfying predicate 𝑐.
• Projection (𝜋𝐿(𝑅) ): Extracts specified attributes 𝐿, deduplicating duplicate rows in pure relational
theory.
• Natural Join (𝑅 ⨝ 𝑆): Equi-join over all shared attributes, projecting out duplicate column names.
• Theta Join (𝑅 ⨝𝜃 𝑆): Cross-product followed by selection: 𝜎𝜃(𝑅×𝑆) .


1.2 The True SQL Logical Execution Pipeline
Unlike procedural languages, SQL executes declaratively in this strict logical sequence:
1. FROM / JOIN: Evaluates Cartesian products and evaluates ON filters to build the virtual table.
2. WHERE: Filters individual candidate rows before aggregation.
3. GROUP BY: Partitions remaining rows into aggregate groups.
4. HAVING: Filters aggregated groups based on summary predicates (e.g., COUNT(*) > 2).
5. SELECT: Evaluates projection list, mathematical expressions, and window functions.
6. DISTINCT: Eliminates duplicate rows from the projected set.
7. ORDER BY: Sorts the final result set using the specified collation.
8. LIMIT / OFFSET: Truncates output tuples for client delivery.


2 Functional Dependencies & Normalization Step-by-Step

2.1 WORKED STEP-BY-STEP PROBLEM: Candidate Keys & BCNF Decompo-
sition
Problem: Consider relation 𝑅(𝐴, 𝐵, 𝐶, 𝐷, 𝐸) with Functional Dependencies (FDs):
𝐹 = {𝐴𝐵 → 𝐶, 𝐶 → 𝐷, 𝐷 → 𝐸, 𝐸 → 𝐴}

Find all Candidate Keys of 𝑅, test whether 𝑅 is in 3NF or BCNF, and decompose into BCNF if violated.

2.1.1 Step 1: Attribute Closures & Candidate Key Derivation
• Calculate closure of (𝐴𝐵)+ :
‣ (𝐴𝐵)+ = {𝐴, 𝐵}
‣ Using 𝐴𝐵 → 𝐶: adds 𝐶 → {𝐴, 𝐵, 𝐶}
‣ Using 𝐶 → 𝐷: adds 𝐷 → {𝐴, 𝐵, 𝐶, 𝐷}
‣ Using 𝐷 → 𝐸: adds 𝐸 → {𝐴, 𝐵, 𝐶, 𝐷, 𝐸} = 𝑅.
‣ Therefore, 𝐴𝐵 is a Candidate Key!
• Since 𝐸 → 𝐴, substitute 𝐴 with 𝐸: (𝐸𝐵)+ = {𝐴, 𝐵, 𝐶, 𝐷, 𝐸} = 𝑅 → 𝐸𝐵 is a Candidate Key.
• Since 𝐷 → 𝐸, substitute 𝐸 with 𝐷: (𝐷𝐵)+ = 𝑅 → 𝐷𝐵 is a Candidate Key.
• Since 𝐶 → 𝐷, substitute 𝐷 with 𝐶: (𝐶𝐵)+ = 𝑅 → 𝐶𝐵 is a Candidate Key.
• Prime Attributes (members of any candidate key): {𝐴, 𝐵, 𝐶, 𝐷, 𝐸}. All attributes are prime!




Independent Study Aid. Not affiliated with or endorsed by any specific university or Page 2 of 7
publisher.

Document information

Uploaded on
October 24, 2026
Number of pages
7
Written in
2026/2027
Type
Summary
$15.98

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
15
Last sold
-



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions