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

57 articles in this topic

Interview Prep

5 Window Traps That Lie

Basket-split LAG gaps, ghost orders, nondeterministic ROW_NUMBER, RANK gaps, unframed running totals: 5 window traps with fixes and SQL included.

2 min readRead
Interview Prep

30 SQL Interview Questions, Free

The 30 SQL patterns analyst interviews repeat — JOINs, windows, GROUP BY traps, NULLs, dates, CTEs — indexed by pattern with live practice links.

1 min readRead
Interview Prep

4 GROUP BY Traps, Wrong vs Right

WHERE vs HAVING, nullable grouping keys, bare SELECT columns: 4 GROUP BY traps that run without errors yet fail take-homes, each with the fix.

2 min readRead
Tutorial

Nested Query to CTE in 4 Steps

Turn a 3-level nested subquery into a readable CTE interviewers can maintain at 2am: a 4-step refactor worksheet with before-and-after SQL code.

1 min readRead
Interview Prep

5 SQL Date Patterns for Interviews

Month-over-month growth, rolling averages, cohorts, weekday splits, days-between events: the 5 SQL date patterns analyst JDs repeat, with queries.

1 min readRead
Tutorial

Excel to SQL: Full Translation Map

VLOOKUP to JOIN, PivotTables to GROUP BY, filters to WHERE: every Excel skill mapped one-to-one to SQL, with a live practice path included inside.

1 min readRead
Interview Prep

RANK vs DENSE_RANK: Tie-Traps

Top-3-per-group with ties: ROW_NUMBER vs RANK vs DENSE_RANK explained side by side, plus 5 tie-trap drills with full answer keys for interviews.

2 min readRead
Career Guide

Data Analyst Skills Roadmap (2026): What to Learn First

The modern 2026 data analyst skills roadmap. Learn the optimal order to master SQL, Excel, Python, and Tableau with free courses and real-world projects.

22 min readRead
Tutorial

SQL Date Functions Guide: Practical Examples (2026)

Master sql date functions with practical examples. Learn DATE_TRUNC, EXTRACT, interval rolling windows, and how to avoid the timestamp BETWEEN trap.

10 min readRead
Tutorial

Window Functions in SQL: Practical Guide & Examples

Master window functions in sql with practical examples. Learn OVER, PARTITION BY, running totals, rankings, and lead lag calculations step by step.

12 min readRead
Interview Prep

SQL Interview Questions for Experienced (2026 Guide)

Ace sql interview questions for experienced data analysts. Master window functions, query optimization, join fan-out, and scenario CTEs with code.

16 min readRead
Tutorial

Understanding Null Semantics In Sql: 2026 Guide & Examples

Master three-valued logic and traps by understanding null semantics in sql. Learn NOT IN pitfalls, WHERE vs HAVING filtering, and safe COALESCE math.

12 min readRead
Tutorial

Full Outer Join In Sql: 2026 Guide & Examples

Master the full outer join in sql with practical examples, billing reconciliation queries, syntax rules, and NULL handling for data analysts.

21 min readRead
Tutorial

LEFT JOIN vs LEFT OUTER JOIN in SQL: Key Differences

Is there any difference between LEFT JOIN and LEFT OUTER JOIN in SQL? Learn ANSI syntax rules, performance benchmarks, and common WHERE clause traps.

8 min readRead
Interview Prep

Data Analyst Interview Questions 2026: Complete Preparation Guide

30+ real data analyst interview questions with schemas, solutions & pitfalls — SQL OAs vs live technical rounds, Python, modern data stack, product cases & behavioral.

28 min readRead
Interview Prep

SQL Interview Questions for Data Analyst (2026 Guide)

Master 2026 SQL interview questions for data analysts. Real queries, window functions, joins, common traps, and runnable code solutions.

16 min readRead
Interview Prep

SQL Joins Practice Exercises: 15 Real Queries & Answers

Master SQL joins with 15 real business practice exercises. Solve INNER, LEFT, RIGHT, FULL OUTER, CROSS, and SELF JOINs with schemas and expected outputs.

31 min readRead
Interview Prep

SQL Practice Questions: 25 Real Business Queries & Answers

Practice 25 real-world SQL queries with solutions, schema diagrams, and expected outputs. Master joins, window functions, and aggregations for interviews.

33 min readRead
Tutorial

ROW_NUMBER vs RANK vs DENSE_RANK in SQL (Tie Examples)

Understand the exact difference between ROW_NUMBER(), RANK(), and DENSE_RANK() in SQL. See how ties are handled (1,2,3 vs 1,2,2,4 vs 1,2,2,3) with interactive queries.

9 min readRead
Tutorial

SQL CTE Guide: WITH Clause Syntax, Chaining & Examples

Master SQL CTEs (Common Table Expressions). Learn WITH clause syntax, how to chain multiple CTEs, build recursive queries, and practice in our live sandbox.

12 min readRead
Interview Prep

30 SQL Interview Questions for Freshers & Analysts (2026)

Master top 30 SQL interview questions for freshers and analysts. Includes verified SQL queries for JOINs, Window Functions, CTEs, and GROUP BY.

20 min readRead
Tutorial

SQL JOIN Fan-Out: How to Fix Duplicate Rows & Broken SUM

Fix duplicate rows and inflated SUM/AVG totals in SQL joins. Learn what causes join fan-out, how to pre-aggregate data, and solve classic interview traps.

10 min readRead
Tutorial

UNION vs UNION ALL in SQL: Key Differences

Learn the difference between UNION and UNION ALL in SQL, why UNION ALL is faster, when deduplication matters, and how to avoid costly sorting overhead.

8 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
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.

6 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.

6 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.

8 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.

4 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.

8 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.

3 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.

6 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.

4 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.

8 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.

8 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.

15 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

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
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

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