📚 Database Systems Overview
#DBMS #Architecture
80 % of enterprise DBMS are relational
SQL‑92 became ANSI standard
DBMS = software that stores, retrieves, and manages data while enforcing integrity and security.
DBMS Types
- Centralized
- Client‑Server
- Distributed
- Cloud‑based
Key Components
- Storage manager
- Query processor
- Transaction manager
- Recovery manager
| Centralized | Client‑Server | |
|---|---|---|
| Data location | Single server | Multiple clients |
| Scalability | Limited | High |
| Network load | Low | Higher |
| Typical use | Small orgs | Enterprises |
Tip: Sketch an ER diagram before converting to relational tables – it prevents missing foreign keys.
Data Independence – logical vs. physical separation.
SQL DDL/DML – CREATE, INSERT, SELECT, UPDATE, DELETE.
Transactions – ACID properties ensure reliability.
🔗 Relational Model & Algebra
#Relational #Algebra
PK = unique, non‑null
FK = referential integrity
Relation = a set of tuples with a fixed schema (attributes).
Unary Operations
- SELECT – filter rows
- PROJECT – choose columns
Binary Operations
- JOIN – combine tables
- DIVISION – “all‑of” queries
- Identify entities & attributes.
- Define primary keys.
- Convert relationships to foreign keys.
- Apply normalization (1NF‑3NF).
Common traps:
- Omitting foreign‑key constraints.
- Using NULL in primary keys.
- Mis‑interpreting JOIN direction.
- Forgetting to project only needed columns.
- Violating referential integrity during updates.
SELECT – σ (selection).
PROJECT – π (projection).
JOIN – combine related tuples.
🧩 Normalization & SQL Basics
#Normalization #SQL
1NF = atomic values
3NF = no transitive deps
Normalization = process of organizing tables to reduce redundancy and improve integrity.
| Normal Form | Requirement |
|---|---|
| 1NF | Atomic attributes, no repeating groups. |
| 2NF | 1NF + no partial dependency on a composite PK. |
| 3NF | 2NF + no transitive dependencies. |
| BCNF | Every determinant is a candidate key. |
Tip: Declare UNIQUE and NOT NULL constraints early to enforce 1NF/2NF rules automatically.
Sample Questions
- What SQL clause enforces referential integrity? FOREIGN KEY
- Convert a many‑to‑many relationship into tables. Add junction table with two FKs
- Which normal form eliminates transitive dependencies? 3NF
- Write a SELECT that returns only distinct values. SELECT DISTINCT …
- How to create a stored procedure in SQL? CREATE PROCEDURE … BEGIN … END
Procedures – encapsulate reusable SQL blocks.
Functions – return a value, can be used in expressions.
Triggers – fire on INSERT/UPDATE/DELETE events.


