lemmatoolsAll tools →
🗄️

SQL Reference

sqljoinswindow functionscte

26 of 26 commands shown

How to Use the SQL Reference

Navigate via tabs: Basics, JOINs, Aggregates, Subqueries, Window Functions, CTEs, Indexes, Interview Q&A. Click a JOIN type in the visualiser to see the diagram and example query. Use the search to find specific patterns.

SQL Reference Formula

INNER JOIN: rows matching in both | LEFT JOIN: all left + matching right | RIGHT JOIN: all right + matching left | FULL OUTER: all rows from both

Example Calculation

Find duplicates in a table:

SELECT col, COUNT(*) FROM table GROUP BY col HAVING COUNT(*) > 1

Returns all values that appear more than once

Frequently Asked Questions

What is the difference between INNER JOIN and LEFT JOIN?

INNER JOIN returns only rows where the join condition matches in BOTH tables. LEFT JOIN returns ALL rows from the left table plus matching rows from the right table — rows with no match show NULL values.

When should I use WHERE vs HAVING in SQL?

WHERE filters rows BEFORE grouping (works on individual rows). HAVING filters AFTER grouping (works on aggregated values). Rule: WHERE filters raw data, HAVING filters grouped results.

What is the difference between RANK, DENSE_RANK, and ROW_NUMBER?

ROW_NUMBER: unique sequential numbers (1,2,3,4). RANK: same rank for ties, skips numbers (1,1,3,4). DENSE_RANK: same rank for ties, no gaps (1,1,2,3). Use DENSE_RANK when you do not want gaps in your ranking.

Related Calculators