SQL Tutorials
SQL is the first skill every data analyst learns and the one interviewers test the hardest. These tutorials cover the queries that actually show up in analyst work: joins that combine tables without duplicating rows, window functions that rank and compare without collapsing the result set, and the NULL handling and aggregation details that trip up even experienced candidates. Every example is runnable against a real database.
What you will learn
- ✓Choose the right join type and spot row multiplication from a non-unique key
- ✓Rank, partition and compare rows with ROW_NUMBER, RANK, DENSE_RANK, LAG and LEAD
- ✓Write GROUP BY and HAVING correctly and know when each filter runs
- ✓Handle NULLs with IS NULL, COALESCE and COUNT variants without silent bugs
- ✓Translate a business question into a single readable query with CTEs where needed
43 articles in this topic
SQL CTE (WITH Clause): Syntax, Chaining, Recursive CTEs & Real Examples (2026)
Master SQL CTEs (Common Table Expressions) using the WITH clause. Learn exact syntax, execution lifecycle, chaining CTEs, recursive CTEs for org hierarchies, and CTEs vs subqueries vs temp tables.
CREATE TABLE in MySQL: Syntax, Data Types & Constraints Guide
Master CREATE TABLE in MySQL with syntax examples, primary keys, foreign keys, AUTO_INCREMENT, constraints, and InnoDB engine best practices.
Data Analyst Interview Questions 2026: Complete Preparation Guide
30+ data analyst interview questions with answers — SQL, Python, statistics, business cases, and behavioral. A complete guide to ace your next interview.
DDL SQL Commands: Complete Guide to Data Definition Language
Master DDL SQL commands: CREATE, ALTER, DROP, TRUNCATE, and RENAME with practical syntax, schema constraints, and DDL vs DML comparisons.
Delete Duplicate Records in SQL: 3 Proven Methods with Examples
Learn how to delete duplicate records in SQL using ROW_NUMBER() CTEs, self-joins with MIN/MAX IDs, and safe transaction workflows across dialects.
DML Commands in SQL: INSERT, UPDATE, DELETE, and MERGE (with Examples)
Master dml commands in sql: learn syntax for INSERT, UPDATE, DELETE, and MERGE, avoid catastrophic updates without WHERE, and compare DML vs DDL.
Normalization in SQL: 1NF, 2NF, 3NF & BCNF Explained with Examples
Learn normalization in sql with step-by-step table examples from unnormalized data to 1NF, 2NF, 3NF, and BCNF to eliminate data anomalies.
OFFSET in SQL: Syntax, Pagination & Performance Optimization
Master OFFSET in SQL for database pagination. Learn LIMIT/OFFSET syntax across dialects, deep pagination performance pitfalls, and keyset seek methods.
Order of Execution in SQL: The 8 Stages Every Analyst Must Understand
Master the order of execution in sql: learn how databases process FROM, WHERE, GROUP BY, HAVING, and SELECT clauses, and resolve query alias errors.
Set Operators in SQL: UNION, UNION ALL, INTERSECT & EXCEPT Guide
Master set operators in SQL with practical examples of UNION, UNION ALL, INTERSECT, and EXCEPT/MINUS to combine query result sets effectively.
Case Statement in SQL: Complete Guide to CASE WHEN & Conditional Aggregation
Master the case statement in sql: use CASE WHEN and SUM(CASE WHEN ...) to pivot data, categorize distributions, and aggregate conditionally in a single scan.
SQL Cheat Sheet: Commands, Queries, and Window Functions Reference
Bookmark this comprehensive sql cheat sheet: essential syntax for SELECT, JOINs, aggregations, Window Functions, CTEs, and query order of execution.
SQL COUNT Function: COUNT(*), COUNT(1) & COUNT(DISTINCT) Guide
Master the SQL COUNT function with examples of COUNT(*), COUNT(1), COUNT(DISTINCT), NULL handling, and conditional counting techniques.
SQL for Data Analyst: Complete Guide, Key Skills & Queries
Master SQL for data analyst roles with real-world query patterns, window functions, aggregations, cohort analysis, and practical workflows.
SQL Performance Tuning: 7 Proven Strategies to Accelerate Slow Queries
Master SQL performance tuning with execution plan analysis (EXPLAIN ANALYZE), indexing best practices, sargable queries, and join optimizations.
SQL Projects for All Levels: Beginner to Advanced Portfolio Guide
Stand out to hiring managers with these 6 real-world SQL projects for beginner, intermediate, and advanced data analysts with datasets and code.
SQL RANK Function: RANK vs DENSE_RANK vs ROW_NUMBER Guide
Master the SQL RANK function with side-by-side comparisons of RANK, DENSE_RANK, and ROW_NUMBER, PARTITION BY logic, and Top-N group queries.
Subquery in SQL: Single-Row, Correlated, and Nested Queries (with Examples)
Master subquery in sql: understand nested queries across SELECT, FROM, and WHERE clauses, correlated vs non-correlated subqueries, and performance fixes.
What Is SQL? The Complete Beginner to Pro Database Guide (2026)
What is SQL? Learn how Structured Query Language works, relational database concepts, SELECT queries, JOINs, DDL vs DML commands, and analyst workflows.
Amazon Data Analyst Interview Questions 2026: SQL, Cases & Solutions
Comprehensive 2026 guide to Amazon data analyst and analytics interviews. Round breakdowns, live SQL problem scenarios with code solutions, and compensation bands.
Flipkart Data Analyst Interview Questions 2026: SQL, Cases & Solutions
Comprehensive 2026 guide to Flipkart data analyst and analytics interviews. Round breakdowns, live SQL problem scenarios with code solutions, and compensation bands.
Google Data Analyst Interview Questions 2026: SQL, Cases & Solutions
Comprehensive 2026 guide to Google data analyst and analytics interviews. Round breakdowns, live SQL problem scenarios with code solutions, and compensation bands.
JPMorgan Chase Data Analyst Interview Questions 2026: SQL, Cases & Solutions
Comprehensive 2026 guide to JPMorgan Chase data analyst and analytics interviews. Round breakdowns, live SQL problem scenarios with code solutions, and compensation bands.
Razorpay Data Analyst Interview Questions 2026: SQL, Cases & Solutions
Comprehensive 2026 guide to Razorpay data analyst and analytics interviews. Round breakdowns, live SQL problem scenarios with code solutions, and compensation bands.
Swiggy Data Analyst Interview Questions 2026: SQL, Cases & Solutions
Comprehensive 2026 guide to Swiggy data analyst and analytics interviews. Round breakdowns, live SQL problem scenarios with code solutions, and compensation bands.
Uber Data Analyst Interview Questions 2026: SQL, Cases & Solutions
Comprehensive 2026 guide to Uber data analyst and analytics interviews. Round breakdowns, live SQL problem scenarios with code solutions, and compensation bands.
Walmart Global Tech Data Analyst Interview Questions 2026: SQL, Cases & Solutions
Comprehensive 2026 guide to Walmart Global Tech data analyst and analytics interviews. Round breakdowns, live SQL problem scenarios with code solutions, and compensation bands.
Zepto Data Analyst Interview Questions 2026: SQL, Cases & Solutions
Comprehensive 2026 guide to Zepto data analyst and analytics interviews. Round breakdowns, live SQL problem scenarios with code solutions, and compensation bands.
Zomato Data Analyst Interview Questions 2026: SQL, Cases & Solutions
Comprehensive 2026 guide to Zomato data analyst and analytics interviews. Round breakdowns, live SQL problem scenarios with code solutions, and compensation bands.
Connect VS Code to PostgreSQL with SQLTools (Step-by-Step)
Connect Visual Studio Code to PostgreSQL using SQLTools in 4 steps: install drivers, configure host/port credentials, fix search_path errors, and run queries.
DATE_TRUNC vs EXTRACT in SQL: Date Functions & Syntax Guide
Master DATE_TRUNC vs EXTRACT in SQL. Learn exact syntax for monthly trends, seasonality, INTERVAL rolling windows, and avoiding the BETWEEN timestamp trap.
WHERE vs HAVING in SQL: Execution Order & Key Differences
Master WHERE vs HAVING in SQL. Learn why WHERE filters before GROUP BY, why aggregate functions fail in WHERE, and the full 7-step query execution order.
30 SQL Interview Questions for Data Analysts (2026 Guide)
Master the top 30 SQL interview questions for data analysts. Includes verified code solutions for JOIN fan-out, Window Functions, CTEs, and cohort retention.
SQL JOINs Explained with Examples: The Complete Guide
Learn every SQL JOIN type with clear examples and visual explanations. INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, self-joins, and anti-join patterns.
SQL JOIN Fan-Out: What It Is, Why SUM Breaks & 2 Proven Fixes
Learn what SQL JOIN fan-out is, why one-to-many joins silently duplicate rows and break SUM/AVG totals, and how to fix it with pre-aggregation and DISTINCT.
SQL NULL Guide: How IS NULL, COUNT & COALESCE Actually Work
Master SQL NULL: learn why = NULL fails, how COUNT(column) silently skips missing data, when to use COALESCE, and how to avoid the empty-string trap.
ROW_NUMBER vs RANK vs DENSE_RANK in SQL (Tie Examples)
Compare ROW_NUMBER vs RANK vs DENSE_RANK in SQL. See exact tie handling (1,2,3 vs 1,2,2,4 vs 1,2,2,3), deduplication patterns, and interview query examples.
SQL Subqueries Explained: Scalar, Correlated & Syntax Guide
Master the 3 types of SQL subqueries: scalar, multi-row (IN/EXISTS), and correlated. Avoid the NOT IN NULL trap and learn when to refactor to readable CTEs.
SQL vs NoSQL: Complete Guide for Data Analysts
Understand the differences between SQL and NoSQL databases. Learn when to use each and which to learn first.
SQL Window Functions: Complete Guide with Examples (2026)
Master SQL window functions from complete basics. Understand why GROUP BY collapses rows, how OVER() preserves row details, and how to use ROW_NUMBER, RANK, LAG, LEAD, and running totals with real sample tables.
Python Database Connectivity: SQLite to BigQuery Without Hardcoding Passwords
Connect Python to SQLite, PostgreSQL, MySQL, Snowflake and BigQuery with SQLAlchemy and pandas read_sql — securely via .env files.
Pandas Advanced Masterclass: Merge, Rank, and Window Functions Like SQL
Advanced Pandas — set_index, merge joins, rank vs dense_rank, shift/lead-lag, and groupby window functions mirroring SQL.
Tableau Relationships vs Joins: Which Should You Use & Why?
Compare Tableau Relationships vs Physical Joins. Learn how the logical layer (noodles) stops duplicated rows and inflated sums, and when to use classic joins.