QA
Beginner LevelSQL & MySQL

What are INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN?

❓ Interview Prompt: Explain relational JOIN types, Venn diagram representation, matching key criteria, and handling missing NULL fields.

Relational JOINs combine columns from one or more tables based on matching key relationships:

4 Core Join Types:

1
INNER JOIN: Returns rows ONLY when there is a matching key in BOTH tables.
2
LEFT (OUTER) JOIN: Returns ALL rows from the left table, plus matching rows from the right table. Unmatched right table columns return 'NULL'.
3
RIGHT (OUTER) JOIN: Returns ALL rows from the right table, plus matching rows from the left table.
4
FULL (OUTER) JOIN: Returns all rows when there is a match in EITHER left or right table.

Code Implementation Example

sql
-- INNER JOIN vs LEFT JOIN example
SELECT u.id, u.name, o.order_date, o.total_amount
FROM users u
LEFT JOIN orders o ON u.id = o.user_id
WHERE u.status = 'ACTIVE';
💡Joining user and order tables with a LEFT JOIN.
🎯 Interview Key Takeaway

Use INNER JOIN to fetch matching records only, and LEFT JOIN to preserve all records from the primary left table.

#SQL#Joins#INNER JOIN#LEFT JOIN#Beginner
Back to all SQL & MySQL Questions→

More SQL & MySQL Interview Questions

Beginner LevelSQL & MySQL

How do B-Tree Indexes work in SQL/MySQL and how do you optimize slow queries using EXPLAIN?

Beginner LevelSQL & MySQL

How do SELECT, WHERE, ORDER BY, and LIMIT clauses filter relational datasets?

Beginner LevelSQL & MySQL

How do GROUP BY and HAVING clauses work alongside aggregate functions (COUNT, SUM, AVG)?