Data, Cloud & DevOps
SQL & Database Design
Prepare for SQL and database interviews, covering query writing, joins, stored procedures, indexing, transactions, normalization, database architecture, and performance optimization.
Your learning roadmap
Explore the key concepts
Use these subtopics as a study checklist. Start with the fundamentals, then progress to practical examples and interview preparation.
Database fundamentals
Understand how databases store, organize, retrieve, and manage information, including tables, records, schemas, and basic database operations.
Start learningRelational database concepts
Learn the relational database model, including tables, rows, columns, relationships, keys, and how data integrity is maintained through relational constraints.
Start learningDatabase management systems (DBMS)
Explore database management systems, their architecture, storage engines, query processing, transaction management, and responsibilities in managing application data.
Start learningSQL fundamentals
Learn Structured Query Language for creating, querying, modifying, and managing relational databases using standard SQL statements.
Start learningSQL Server architecture
Understand SQL Server architecture, including the relational engine, storage engine, query processor, buffer pool, transaction log, and background services.
Start learningDDL, DML, DCL, and TCL
Understand SQL command categories: DDL for schema definitions, DML for data manipulation, DCL for permissions, and TCL for transaction control.
Start learningCREATE, ALTER, and DROP statements
Create, modify, and remove database objects using CREATE, ALTER, and DROP statements for tables, databases, indexes, and other schema components.
Start learningINSERT, UPDATE, and DELETE statements
Modify table data using INSERT, UPDATE, and DELETE statements and understand filtering, multi-row operations, and safe data modification practices.
Start learningSELECT queries
Retrieve data from relational tables using SELECT statements, including column selection, aliases, expressions, filtering, and result ordering.
Start learningWHERE, ORDER BY, and DISTINCT
Filter query results with WHERE, sort records using ORDER BY, and eliminate duplicate rows with DISTINCT.
Start learningGROUP BY and HAVING
Group records using GROUP BY and filter aggregated groups using HAVING to generate summarized reports and analytical query results.
Start learningAggregate functions
Use aggregate functions such as COUNT, SUM, AVG, MIN, and MAX to calculate summaries and perform grouped data analysis.
Start learningString and date functions
Manipulate text and date values using SQL Server functions for formatting, extraction, conversion, comparison, and date calculations.
Start learningCASE expressions
Write conditional SQL expressions using CASE to implement branching logic, categorize records, and calculate values based on business rules.
Start learningNULL handling and NULL functions
Understand SQL NULL semantics and use IS NULL, ISNULL, COALESCE, and NULLIF to handle missing values and avoid unexpected query results.
Start learningSQL joins
Combine related data from multiple tables using SQL joins and understand matching conditions, result sets, and relationship-based querying.
Start learningINNER JOIN
Retrieve records with matching values in both tables using INNER JOIN and understand how join conditions affect the resulting dataset.
Start learningLEFT and RIGHT JOIN
Use LEFT JOIN and RIGHT JOIN to preserve unmatched rows from one side of a relationship and identify missing related records.
Start learningFULL OUTER JOIN
Combine matching and unmatched records from both tables using FULL OUTER JOIN and understand how NULL values represent missing matches.
Start learningCROSS JOIN
Generate Cartesian products between tables using CROSS JOIN and understand practical use cases involving combinations and reference data.
Start learningSELF JOIN
Join a table to itself using aliases to query hierarchical relationships, employee-manager structures, and comparisons between related records.
Start learningSubqueries
Write nested SQL queries and use subqueries in SELECT, FROM, and WHERE clauses to filter, calculate, and retrieve related data.
Start learningCorrelated subqueries
Understand correlated subqueries that reference outer query columns and learn how they execute for related rows and compare with JOIN-based solutions.
Start learningCommon Table Expressions (CTEs)
Structure complex SQL queries using Common Table Expressions, improve readability, and reuse named query expressions within a statement.
Start learningRecursive CTEs
Use recursive Common Table Expressions to traverse hierarchical data, organizational structures, category trees, and parent-child relationships.
Start learningTemporary tables
Create and manage temporary tables in SQL Server using local and global temporary table syntax to store intermediate query results.
Start learningTable variables
Use table variables to store temporary relational data and understand their scope, declaration, indexing options, and differences from temporary tables.
Start learningUNION and UNION ALL
Combine result sets from multiple SELECT statements using UNION and UNION ALL and understand duplicate elimination and column compatibility requirements.
Start learningEXCEPT and INTERSECT
Compare query result sets using EXCEPT and INTERSECT to identify rows present in one result but absent from or shared with another.
Start learningWindow functions
Analyze rows relative to other rows using SQL window functions and understand OVER, PARTITION BY, ORDER BY, and window frames.
Start learningROW_NUMBER, RANK, and DENSE_RANK
Assign sequential and ranking values to query results using ROW_NUMBER, RANK, and DENSE_RANK and understand how ties affect ranking.
Start learningLEAD and LAG
Access values from subsequent and preceding rows using LEAD and LAG to compare records and analyze changes across ordered datasets.
Start learningPARTITION BY and ORDER BY
Define logical groups and row ordering inside window functions using PARTITION BY and ORDER BY to perform calculations within data partitions.
Start learningRunning totals and moving averages
Calculate cumulative totals and rolling averages using window aggregates and appropriate window frames for reporting and time-series analysis.
Start learningPivot and Unpivot
Transform relational data between row-based and column-based layouts using PIVOT and UNPIVOT for reporting and analytical queries.
Start learningStored procedures
Create and execute stored procedures to encapsulate SQL logic, accept parameters, return results, and manage reusable database operations.
Start learningUser-defined functions
Create SQL Server user-defined functions to encapsulate reusable calculations and data transformations that can be called from SQL statements.
Start learningScalar and table-valued functions
Compare scalar and table-valued functions and learn how each returns individual values or relational result sets for reuse in queries.
Start learningTriggers
Implement DML and DDL triggers to execute database logic automatically in response to INSERT, UPDATE, DELETE, and schema events.
Start learningViews
Create and manage SQL views to encapsulate queries, simplify data access, provide abstraction, and control exposure of underlying table structures.
Start learningIndexed views
Understand indexed views in SQL Server, including schema binding, clustered indexes, storage behavior, and their potential impact on query performance.
Start learningDynamic SQL
Build and execute SQL statements dynamically using EXEC and sp_executesql, handle parameters safely, and understand plan reuse and security risks.
Start learningSQL variables and control flow
Declare and manage SQL variables and use IF, WHILE, BEGIN, END, BREAK, and other control-flow statements in SQL Server scripts.
Start learningCursors and alternatives
Understand SQL cursors for row-by-row processing and compare them with set-based operations, window functions, and other efficient alternatives.
Start learningTransactions
Understand database transactions as units of work and learn how SQL Server manages atomic operations, consistency, isolation, and durability.
Start learningACID properties
Explore the ACID properties of database transactions: atomicity, consistency, isolation, and durability, and understand their role in reliable data processing.
Start learningCOMMIT and ROLLBACK
Control transaction outcomes using COMMIT and ROLLBACK and understand how to save successful operations or undo failed changes.
Start learningTransaction isolation levels
Compare transaction isolation levels such as Read Uncommitted, Read Committed, Repeatable Read, Snapshot, and Serializable and understand their concurrency effects.
Start learningLocking and blocking
Understand SQL Server locking mechanisms, lock modes, blocking sessions, and how concurrent transactions coordinate access to shared database resources.
Start learningDeadlocks and deadlock prevention
Analyze database deadlocks, identify competing resource requests, interpret deadlock graphs, and apply strategies to reduce deadlock occurrences.
Start learningOptimistic and pessimistic concurrency
Compare optimistic and pessimistic concurrency control and understand how version checks, locks, and conflict handling protect concurrent data updates.
Start learningDatabase normalization
Understand database normalization and how organizing relational data reduces duplication, update anomalies, and unnecessary data dependencies.
Start learningFirst, Second, and Third Normal Forms
Apply First, Second, and Third Normal Forms to eliminate repeating groups, partial dependencies, and transitive dependencies in relational database designs.
Start learningBCNF
Understand Boyce-Codd Normal Form and identify functional dependencies that violate BCNF, including cases where Third Normal Form is insufficient.
Start learningDatabase denormalization
Use denormalization techniques to improve read performance by introducing controlled redundancy and understand the trade-offs for consistency and maintenance.
Start learningPrimary and foreign keys
Define primary and foreign keys to uniquely identify records, enforce referential integrity, and establish relationships between relational tables.
Start learningUnique and check constraints
Enforce data integrity using UNIQUE and CHECK constraints to prevent duplicate values and restrict stored data according to business rules.
Start learningDatabase relationships
Model relationships between database entities and understand how keys and constraints represent connections between related tables.
Start learningOne-to-one, one-to-many, and many-to-many relationships
Design one-to-one, one-to-many, and many-to-many relationships and implement them using primary keys, foreign keys, and junction tables.
Start learningClustered and non-clustered indexes
Understand clustered and non-clustered indexes in SQL Server, how they organize data, and how index structures influence data retrieval.
Start learningUnique and composite indexes
Create unique and composite indexes to enforce uniqueness and optimize queries that filter or sort using multiple columns.
Start learningCovering indexes
Design covering indexes using key and included columns to satisfy query requirements and reduce additional table or index lookups.
Start learningIndex fragmentation and maintenance
Identify index fragmentation and understand index reorganizing, rebuilding, fill factor, and maintenance strategies for SQL Server databases.
Start learningIndex seek vs index scan
Compare index seeks and index scans and understand how SQL Server accesses indexed data based on predicates, selectivity, and query requirements.
Start learningExecution plans
Read SQL Server execution plans to understand query operators, access methods, estimated and actual row counts, and performance bottlenecks.
Start learningQuery optimization
Optimize SQL queries by improving filtering, joins, indexing, query structure, and execution strategies to reduce resource consumption.
Start learningSQL performance tuning
Diagnose and improve database performance through query analysis, index design, execution plans, statistics, waits, and workload monitoring.
Start learningSARGable queries
Write Search ARGument Able queries that allow SQL Server to use indexes effectively by avoiding non-searchable predicates and unnecessary transformations.
Start learningStatistics and cardinality estimation
Understand SQL Server statistics and cardinality estimation and learn how data distribution influences row estimates and query execution plans.
Start learningParameter sniffing
Understand parameter sniffing in SQL Server, how cached execution plans depend on parameter values, and techniques for diagnosing and managing plan issues.
Start learningQuery Store
Use SQL Server Query Store to capture query history, compare execution plans, analyze performance regressions, and manage plan forcing.
Start learningDatabase partitioning
Organize large database tables and indexes into partitions to improve manageability, support maintenance operations, and optimize selected queries.
Start learningDatabase sharding
Understand database sharding as a horizontal scaling strategy and explore shard keys, data distribution, routing, and cross-shard query challenges.
Start learningDatabase replication
Explore database replication techniques for distributing data across servers and understand SQL Server replication types and synchronization behavior.
Start learningBackup and recovery
Plan database backup and recovery using full, differential, and transaction log backups and understand restore sequences and recovery models.
Start learningHigh availability and disaster recovery
Design database resilience using high-availability and disaster-recovery technologies, including failover strategies, recovery objectives, and data protection.
Start learningSQL Server security
Secure SQL Server environments through authentication, authorization, encryption, auditing, network protection, and controlled database access.
Start learningUsers, roles, and permissions
Manage SQL Server access by creating database users, assigning roles, granting permissions, and applying least-privilege security principles.
Start learningSQL injection prevention
Prevent SQL injection by using parameterized queries, safe dynamic SQL, input validation, stored procedures, and appropriate database permissions.
Start learningDatabase encryption
Protect sensitive database information using encryption techniques such as Transparent Data Encryption, Always Encrypted, and encryption in transit.
Start learningSQL Server Agent and scheduled jobs
Automate database administration using SQL Server Agent jobs, schedules, job steps, alerts, operators, and execution history.
Start learningDatabase migrations
Manage database schema evolution through migration scripts, version control, deployment planning, rollback strategies, and application compatibility.
Start learningEntity Framework Core and SQL integration
Integrate SQL Server databases with Entity Framework Core and understand entity mapping, LINQ translation, migrations, transactions, and query execution.
Start learningADO.NET database connectivity
Connect .NET applications to SQL databases using ADO.NET connection objects, commands, readers, parameters, transactions, and connection management.
Start learningSQL coding interview problems
Practice SQL interview problems involving joins, subqueries, aggregation, ranking, duplicate detection, window functions, and query optimization.
Start learningReal-world database design scenarios
Apply database design principles to practical business scenarios, including entity modeling, relationships, normalization, indexing, and data integrity.
Start learningPractice & revise
Interview questions
Practice interview questions with answers, key points, and practical examples.
Test your knowledge
Explore 120 questions for this topic, covering concepts, practical examples, and interview scenarios.
Keep learning step by step
Work through the concepts, practice explaining them in your own words, and use interview questions to check your understanding.
Explore another learning path