Quick Answer

SQL has 6 join types you need to know for real work and interviews: Inner Join (only matches), Left Join (everything from the left table), Right Join (everything from the right table), Full Outer Join (everything from both), Cross Join (every row × every row), and Self Join (a table joined to itself). Each one answers a different business question — this guide shows you exactly which one to reach for, with tables, Venn diagrams and ready-to-run queries.

5 Things to Know Before You Start

  1. Every join question is really asking one thing: "What should happen to rows that don't have a match?" Once you can answer that, you know which join to use.
  2. Inner Join is the most common join in real work — and the one interviewers expect you to reach for by default.
  3. Left Join is the second most common — "give me everything on the left, plus whatever matches on the right."
  4. NULL is not "zero" or "blank" — it means no matching row was found. This single idea trips up more SQL learners than anything else.
  5. A Self Join is not a special keyword — it's just a normal join where a table is joined to a copy of itself, using two different aliases.
Want expert mentorship while you practise SQL? Linkskill Academy's SQL & Data Analytics courses are built around exactly this kind of hands-on, query-first learning. Enroll Now → or WhatsApp us for current batch fees & EMI options.

Don't Memorise. Visualise.

Most learners try to memorise SQL join syntax — LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN — as if they were unrelated facts to cram before an interview. That's why the knowledge doesn't stick. Two weeks later, under interview pressure, it's gone.

The fix is to stop memorising and start visualising. Every join is really just an answer to one question: when a row in one table doesn't have a matching row in the other table, what happens to it?

Every section below uses the same two tables — Employee and Department — so you can see exactly how the same data produces a completely different result depending on which join you choose.

All 6 Joins at a Glance

JoinWhat It ReturnsUnmatched Rows BecomeBest For
Inner JoinOnly rows that match in both tablesDropped entirelyReports that should only show complete, valid data
Left JoinEvery row from the left table + matches from the rightNULL on the right side"Show me everyone, and their department if they have one"
Right JoinEvery row from the right table + matches from the leftNULL on the left sideSame as Left Join, mirrored — rarely used since you can just swap table order
Full Outer JoinEvery row from both tablesNULL on whichever side has no matchData audits — "show me every mismatch in both directions"
Cross JoinEvery row from table A paired with every row from table BN/A — no matching key usedGenerating all possible combinations (e.g. sizes × colours)
Self JoinA table joined to itself using two aliasesDepends on the join type used (usually Left)Hierarchies — employees and their managers, categories and parent categories
02 / 08

Inner Join

Inner Join handwritten journal page: returns only the matching rows from both tables, with Employee and Department example tables and SQL query

From the Linkskill Academy visual SQL joins journal — page 02/08.

What it does: returns only the rows where the join column matches in both tables. If a row in either table has no match, it's left out of the result completely.

Think of it like: "Show me only the matches."

Employee

EmpIDEmployeeDeptID
1Anu10
2Bala20
3Charu30
4DivyaNULL
5Eshan40

Department

DeptIDDepartment
10HR
20Finance
30IT
50Marketing
SELECT e.EmpID, e.Employee, d.Department
FROM   Employee e
INNER JOIN Department d
  ON   e.DeptID = d.DeptID;

Result (Inner Join)

EmpIDEmployeeDepartment
1AnuHR
2BalaFinance
3CharuIT

Notice what's missing: Divya (no DeptID at all) and Eshan (DeptID 40 doesn't exist in Department) are both dropped. So is Marketing — no employee belongs to it. Inner Join only keeps rows where both sides agree.

Interview tip: Inner Join is the most common join — and the default choice unless the question specifically calls for unmatched rows too.
03 / 08

Left Join

Left Join handwritten journal page: keeps every row from the left table and matching rows from the right table, with example tables and SQL query

From the Linkskill Academy visual SQL joins journal — page 03/08.

What it does: keeps every row from the left table (the one listed right after FROM), and attaches matching data from the right table wherever it exists. Where there's no match, the right-hand columns come back as NULL.

Think of it like: "Keep left, add right if available."

SELECT e.EmpID, e.Employee, d.Department
FROM   Employee e
LEFT JOIN Department d
  ON   e.DeptID = d.DeptID;

Result (Left Join)

EmpIDEmployeeDepartment
1AnuHR
2BalaFinance
3CharuIT
4DivyaNULL
5EshanNULL

All 5 employees are present this time — Divya and Eshan just get NULL instead of a department name, since neither has a matching DeptID. Marketing still doesn't appear anywhere, because Left Join only protects rows from the left table.

Takeaway: the left table always stays, in full, no matter what.
04 / 08

Right Join

Right Join handwritten journal page: keeps every row from the right table and matching rows from the left table, with example tables and SQL query

From the Linkskill Academy visual SQL joins journal — page 04/08.

What it does: the mirror image of Left Join — keeps every row from the right table, and attaches matching data from the left table wherever it exists.

SELECT e.EmpID, e.Employee, d.Department
FROM   Employee e
RIGHT JOIN Department d
  ON   e.DeptID = d.DeptID;

Result (Right Join)

EmpIDEmployeeDepartment
1AnuHR
2BalaFinance
3CharuIT
NULLNULLMarketing

This time Marketing shows up (with NULL employee columns, since nobody belongs to it), while Divya and Eshan disappear entirely — they have no department, so they're not protected by a Right Join.

Common mistake: people forget that unmatched right-side rows can still leave unmatched left-side rows behind. In practice, most teams avoid Right Join altogether and just swap the table order in a Left Join instead — it reads more naturally.
05 / 08

Full Outer Join

Full Outer Join handwritten journal page: returns all rows from both tables, matched and unmatched, with example tables and SQL query

From the Linkskill Academy visual SQL joins journal — page 05/08.

What it does: returns everything — matched rows, left-only rows, and right-only rows, all in one result set. Anywhere there's no match, the missing side comes back as NULL.

Think of it like: matched + left-only + right-only, combined.

SELECT e.EmpID, e.Employee, d.Department
FROM   Employee e
FULL OUTER JOIN Department d
  ON   e.DeptID = d.DeptID;

Result (Full Outer Join)

EmpIDEmployeeDepartment
1AnuHR
2BalaFinance
3CharuIT
4DivyaNULL
5EshanNULL
NULLNULLMarketing

Every employee and every department appears somewhere — nothing is dropped. This is the join to reach for when you're auditing data quality and need to see every mismatch in both directions at once.

Note: MySQL doesn't support FULL OUTER JOIN directly — you simulate it with a LEFT JOIN UNION RIGHT JOIN. SQL Server, PostgreSQL and Oracle all support it natively.
06 / 08

Cross Join

Cross Join handwritten journal page: combines every row from the first table with every row from the second table, with example tables and SQL query

From the Linkskill Academy visual SQL joins journal — page 06/08.

What it does: pairs every row in the first table with every row in the second table. There's no matching key at all — it's pure multiplication. 3 rows × 3 rows = 9 rows out.

Employee

EmpIDEmployee
1Anu
2Bala
3Charu

Department

DeptIDDepartment
10HR
20Finance
30IT
SELECT e.Employee, d.Department
FROM   Employee e
CROSS JOIN Department d;

Result (3 employees × 3 departments = 9 rows)

EmployeeDepartment
AnuHR
AnuFinance
AnuIT
BalaHR
BalaFinance
BalaIT
CharuHR
CharuFinance
CharuIT
Useful for: generating every possible combination — think size × colour grids for a retail catalogue, or every date × every store for a reporting calendar. It's rare in day-to-day reporting, but a fast way to build combination tables when you need one.
07 / 08

Self Join

Self Join handwritten journal page: joins a table to itself using different aliases, with an Employee-Manager hierarchy example and SQL query

From the Linkskill Academy visual SQL joins journal — page 07/08.

What it does: joins a table to itself, using two different aliases so SQL can treat one table as if it were two. This is the standard way to model hierarchies — most commonly, employees and their managers, where the manager is also a row in the same Employees table.

Think of it like: one table can play two roles at once.

Employees

EmpIDEmployeeManagerID
1AshaNULL
2Bala1
3Charu1
4Divya2
5Eshan3

ManagerID simply points to another row's EmpID in the same table — that's the whole trick behind a self join.

SELECT e.Employee AS EmployeeName,
       m.Employee AS ManagerName
FROM   Employees e
LEFT JOIN Employees m
  ON   e.ManagerID = m.EmpID;

Result

EmployeeManager
AshaNULL
BalaAsha
CharuAsha
DivyaBala
EshanCharu

Asha has no manager (she's at the top), so her row correctly returns NULL — using a Left Join here means she still appears, instead of being silently dropped by an Inner Join.

Interview tip: aliases make this easy. The moment you see "employee and their manager" or "category and parent category" in a question, think Self Join.

Practice Dataset — Try Every Join Yourself

Reading solved examples only gets you so far. Copy the two tables below into Excel, Google Sheets or your own SQL database, and try writing all 6 joins yourself before checking the answers.

Orders

OrderIDCustomerIDAmount
10112500
10221800
1032950
10443200
105NULL500

Customers

CustomerIDCustomerName
1Ravi
2Meena
3Suresh
4Priya

Notice the deliberate edge cases: Order 105 has no CustomerID (a walk-in sale), and Suresh (CustomerID 3) has never placed an order. A good practice dataset always includes at least one row on each side with no match — that's exactly where join logic gets tested in interviews.

Question 1 — Inner Join

Write a query that returns only orders that have a valid, matching customer.

Show answer
SELECT o.OrderID, c.CustomerName, o.Amount
FROM   Orders o
INNER JOIN Customers c
  ON   o.CustomerID = c.CustomerID;

Returns 4 rows (Order 105 is dropped — it has no CustomerID to match on).

Question 2 — Left Join

Write a query that lists every order, even ones with no linked customer.

Show answer
SELECT o.OrderID, c.CustomerName, o.Amount
FROM   Orders o
LEFT JOIN Customers c
  ON   o.CustomerID = c.CustomerID;

Returns all 5 orders. Order 105 shows NULL for CustomerName.

Question 3 — Right Join

Write a query that lists every customer, even ones who haven't ordered anything yet.

Show answer
SELECT o.OrderID, c.CustomerName, o.Amount
FROM   Orders o
RIGHT JOIN Customers c
  ON   o.CustomerID = c.CustomerID;

Returns 5 rows. Suresh appears with NULL OrderID and Amount, since he has never ordered.

Question 4 — Full Outer Join

Write a query that shows every order and every customer, matched or not, in one result.

Show answer
SELECT o.OrderID, c.CustomerName, o.Amount
FROM   Orders o
FULL OUTER JOIN Customers c
  ON   o.CustomerID = c.CustomerID;

Returns 6 rows: all 5 orders, plus Suresh with no matching order.

Question 5 — Cross Join

Write a query that pairs every customer with every possible order amount tier: ('Low'), ('Medium'), ('High').

Show answer
SELECT c.CustomerName, t.Tier
FROM   Customers c
CROSS JOIN (VALUES ('Low'), ('Medium'), ('High')) AS t(Tier);

Returns 12 rows: 4 customers × 3 tiers. Handy for building a complete grid before filling in actual values.

Question 6 — Self Join

Add a ReferredBy column to Customers (pointing to another CustomerID) and write a query that shows each customer next to the name of the person who referred them.

Show answer
SELECT c1.CustomerName AS Customer,
       c2.CustomerName AS ReferredBy
FROM   Customers c1
LEFT JOIN Customers c2
  ON   c1.ReferredBy = c2.CustomerID;

Same pattern as the Employee/Manager example above — only the column names change.

Common SQL Join Interview Questions

  1. "What's the difference between WHERE and ON in a join?"ON defines the matching condition and runs during the join itself (so it can still preserve unmatched rows in an outer join). WHERE filters the joined result afterward — using it to filter the "outer" side of a Left/Right Join can accidentally turn it into an Inner Join.
  2. "Can you get the same result from a Right Join using a Left Join?" — Yes, always. Just swap the table order. This is why most style guides recommend sticking to Left Join for consistency.
  3. "How would you find employees with no manager?" — A self join with WHERE m.EmpID IS NULL after a Left Join — the classic "anti-join" pattern.
  4. "What happens if you forget the ON clause on a join?" — In most databases, omitting it turns your join into an accidental Cross Join — every row paired with every row. This is a common cause of "why does my report suddenly have a million rows" bugs.
  5. "When would you use a Full Outer Join in real work?" — Data reconciliation: comparing two systems (e.g., CRM vs. billing) to find records that exist in one but not the other.

Frequently Asked Questions

Which SQL join is used most often in real jobs?

Inner Join and Left Join together cover roughly 90% of real-world queries. Right Join is rarely used in practice since a Left Join with swapped table order does the same job.

Does every database support Full Outer Join?

No — MySQL does not support FULL OUTER JOIN natively; you simulate it with LEFT JOIN ... UNION ... RIGHT JOIN. SQL Server, PostgreSQL and Oracle all support it directly.

Is a Self Join a different keyword from JOIN?

No — there's no SELF JOIN keyword. It's a completely normal JOIN (usually Left or Inner) where a table is joined to itself using two different aliases.

What's the difference between Cross Join and a Cartesian product caused by a missing ON clause?

They produce the same result, but a Cross Join is intentional and explicit. A Cartesian product from a forgotten ON clause is almost always a bug.

How many joins can I use in one query?

As many as you need — you can chain multiple JOIN clauses to pull in data from many tables in a single query. Just make sure each join has its own clear ON condition.

Are joins tested in Data Analyst interviews?

Yes — SQL joins are one of the most frequently asked topics in Data Analyst and Business Analyst interviews in India, alongside GROUP BY, window functions and subqueries.

Want the Detailed SQL Joins Guide?

Want the detailed SQL joins guide? Comment SQLJOINS journal page with a list of all six join types and a sample query

Get the full handwritten guide with tables, Venn diagrams, SQL Server queries, shortcuts and interview tips.

Don't memorise. Visualise.

Practise all 6 joins on the dataset above, then explain each one out loud — that's what actually sticks before an interview.

Ready to Master SQL for Your Analyst Career?

At Linkskill Academy, mentor Sreemathy Sampath and our team teach SQL the way this guide is written — one visual, interview-ready concept at a time, backed by real practice datasets.

SQL & Data Analytics Courses

Enroll Now →

Free Demo Class

Book Free Demo

WhatsApp Sreemathy

Chat Now

Comment "SQLJOINS" to get the detailed handwritten guide

DM or WhatsApp the word SQLJOINS to Linkskill Academy and we'll send you the full guide — tables, Venn diagrams, SQL Server queries, shortcuts and interview tips, all in one place.

Send "SQLJOINS" on WhatsApp

Mentor: Sreemathy Sampath · Linkskill Academy · www.linkskillacademy.live · Phone / WhatsApp: 90874 96799