SQL Server Mastery

Relational Database Design & Normalization (1NF to 3NF)

1 Views Updated 5/4/2026

Database Normalization

Normalization is the process of organizing data to reduce redundancy and improve data integrity. It ensures that every piece of data is stored in exactly one place. If you don't normalize, you'll end up with "Update Anomalies" where changing a customer's address requires editing 1,000 order records.

1. The Three Golden Rules

  • First Normal Form (1NF): No repeating groups. Every column must contain atomic (single) values. (e.g., Don't store "Skills" as a comma-separated string).
  • Second Normal Form (2NF): Must be in 1NF + every non-key column must depend on the *entire* Primary Key, not just part of it.
  • Third Normal Form (3NF): Must be in 2NF + no "Transitive Dependencies". If Column A depends on Column B, and B depends on the Key, then A doesn't belong in this table.

2. Why normalize?

It saves **Space** (no repeated names/addresses) and ensures **Integrity**. If you update a Category Name in the Categories table, it automatically reflects across 1 million products because they only store the CategoryID.

4. Interview Mastery

Q: "When is it acceptable to DE-normalize a database?"

Architect Answer: "Normalization is for **Writing** (OLTP); De-normalization is for **Reading** (OLAP/Reporting). In high-performance reporting systems, JOINing 20 tables is too slow. We intentionally duplicate data (e.g., storing the 'CustomerName' directly in the 'Order' table) to speed up SELECT queries. However, you must accept the risk of 'Data Staleness' and handle it via background synchronization or triggers."

SQL Server Mastery
1. SQL Server Architecture & Basics
SQL Server Internals: How the Storage Engine works Relational Database Design & Normalization (1NF to 3NF) Data Types Mastery: Choosing the right type for performance
2. Advanced T-SQL Querying
Joins Deep Dive: Inner, Outer, Cross, and Self Joins Subqueries vs CTEs: Writing readable, high-performance code Window Functions: ROW_NUMBER, RANK, and LEAD/LAG Aggregations & Grouping Sets: Building complex reports Set Operators: UNION vs UNION ALL, INTERSECT, and EXCEPT
3. Indexing & Performance Tuning
Clustered vs Non-Clustered Indexes: The physical storage reality Covering Indexes & Included Columns: Reducing I/O costs Index Fragmentation: Why it happens and how to fix it Execution Plans: Reading the Query Optimizer's mind Statistics: Why 'Out of Date' stats kill performance SARGability: Writing queries that actually use indexes
4. Database Programmability
Stored Procedures: Security, Performance, and Best Practices User Defined Functions (UDF): Scalar vs Table-Valued Triggers: Auditing changes and the dangers of hidden logic Views & Indexed Views: Abstraction with performance Error Handling: TRY/CATCH and XACT_STATE()
5. Transactions & Concurrency
Transaction Isolation Levels: Read Uncommitted to Snapshot Locking & Blocking: Analyzing Deadlocks like a Pro Optimistic vs Pessimistic Concurrency
6. Administration & Security
SQL Server Security: Logins, Users, and Roles SQL Injection Prevention: Beyond simple parameterization Backup & Recovery Models: Full vs Simple vs Bulk-Logged Automating Maintenance: SQL Agent Jobs & Rebuilding Indexes
7. Modern SQL & Cloud
SQL Server & JSON: Storing and Querying semi-structured data Temporal Tables: Keeping track of data history automatically Introduction to Azure SQL: Database as a Service (PaaS) SQL Server Developer Interview: Junior to Senior Architect Level