Blog Topic

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

Tutorial

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.

12 min readRead
Tutorial

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.

8 min readRead
Interview Prep

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.

14 min readRead
Tutorial

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.

8 min readRead
Tutorial

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.

8 min readRead
Tutorial

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.

8 min readRead
Tutorial

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.

9 min readRead
Tutorial

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.

8 min readRead
Tutorial

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.

9 min readRead
Tutorial

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.

8 min readRead
Tutorial

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.

10 min readRead
Tutorial

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.

9 min readRead
Tutorial

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.

8 min readRead
Tutorial

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.

8 min readRead
Tutorial

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.

8 min readRead
Tutorial

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.

8 min readRead
Tutorial

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.

9 min readRead
Tutorial

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.

9 min readRead
Tutorial

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.

16 min readRead
Career Guide

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.

14 min readRead
Career Guide

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.

14 min readRead
Career Guide

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.

14 min readRead
Career Guide

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.

14 min readRead
Career Guide

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.

14 min readRead
Career Guide

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.

14 min readRead
Career Guide

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.

14 min readRead
Career Guide

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.

14 min readRead
Career Guide

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.

14 min readRead
Career Guide

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.

14 min readRead
Tutorial

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.

8 min readRead
Tutorial

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.

8 min readRead
Tutorial

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.

9 min readRead
Interview Prep

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.

20 min readRead
Tutorial

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.

10 min readRead
Tutorial

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.

10 min readRead
Tutorial

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.

9 min readRead
Tutorial

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.

9 min readRead
Tutorial

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.

10 min readRead
Tutorial

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.

15 min readRead
Tutorial

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.

14 min readRead
Tutorial

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.

4 min readRead
Tutorial

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.

4 min readRead
Tutorial

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.

9 min readRead