
In DBMS, SQL Joins are frequently asked in ECET exams. They are important for solving queries that combine data from multiple tables. This topic guarantees scoring questions, especially with examples.
📘 Concept Notes – SQL Joins
🌐 What are SQL Joins?
A Join in SQL is used to combine rows from two or more tables, based on a related column between them.
⚙️ Types of Joins
- INNER JOIN
- Returns only the matching rows between two tables.
SELECT S.name, M.marks
FROM Students S
INNER JOIN Marks M ON S.id = M.student_id;
- LEFT JOIN (LEFT OUTER JOIN)
- Returns all rows from the left table + matching rows from right.Non-matching rows from right appear as
NULL
.
- Returns all rows from the left table + matching rows from right.Non-matching rows from right appear as
SELECT S.name, M.marks
FROM Students S
LEFT JOIN Marks M ON S.id = M.student_id;
- RIGHT JOIN (RIGHT OUTER JOIN)
- Returns all rows from right table + matching rows from left.
SELECT S.name, M.marks
FROM Students S
RIGHT JOIN Marks M ON S.id = M.student_id;
- FULL OUTER JOIN
- Returns all rows when there is a match in either left or right.Non-matching rows will contain
NULL
.
- Returns all rows when there is a match in either left or right.Non-matching rows will contain
SELECT S.name, M.marks
FROM Students S
FULL OUTER JOIN Marks M ON S.id = M.student_id;
- CROSS JOIN
- Produces Cartesian Product of two tables.If Table A has
rows and Table B has
rows → result =
rows.
- Produces Cartesian Product of two tables.If Table A has
SELECT S.name, C.course
FROM Students S
CROSS JOIN Courses C;
🔋 Formula
If:
- Table A has
rows
- Table B has
rows
Then result of CROSS JOIN = rows.
📐 Example
Students Table
id | name |
---|---|
1 | Ravi |
2 | Neha |
Marks Table
student_id | marks |
---|---|
1 | 80 |
2 | 90 |
3 | 75 |
- INNER JOIN → returns Ravi (80), Neha (90).
- LEFT JOIN → returns Ravi (80), Neha (90), plus unmatched rows from Students if any.
- RIGHT JOIN → returns Ravi (80), Neha (90), plus student_id=3 with NULL name.
- FULL OUTER JOIN → Ravi (80), Neha (90), student_id=3 with NULL name.
🔟 10 Expected MCQs – ECET 2026
Q1. Which SQL Join returns only matching rows between two tables?
A) INNER JOIN
B) LEFT JOIN
C) RIGHT JOIN
D) FULL JOIN
Q2. If Table A has 4 rows, Table B has 5 rows, CROSS JOIN result = ?
A) 9
B) 20
C) 10
D) 25
Q3. In LEFT JOIN, unmatched rows from right table appear as:
A) 0
B) NULL
C) Empty string
D) Duplicate
Q4. Which Join returns all rows from right table + matched rows from left?
A) LEFT JOIN
B) RIGHT JOIN
C) FULL OUTER JOIN
D) CROSS JOIN
Q5. Which SQL Join is not supported directly in MySQL?
A) INNER JOIN
B) LEFT JOIN
C) RIGHT JOIN
D) FULL OUTER JOIN
Q6. If Students=10 rows, Courses=6 rows → CROSS JOIN result = ?
A) 16
B) 60
C) 600
D) 100
Q7. FULL OUTER JOIN returns:
A) Only matching rows
B) All rows from both tables
C) Only left table rows
D) Only right table rows
Q8. INNER JOIN is equivalent to:
A) INTERSECTION of tables
B) UNION of tables
C) Cartesian Product
D) Subtraction
Q9. Which Join ensures no NULLs appear?
A) INNER JOIN
B) LEFT JOIN
C) RIGHT JOIN
D) FULL OUTER JOIN
Q10. For CROSS JOIN formula, result rows = ?
A)
B)
C)
D)
✅ Answer Key
Q.No | Answer |
---|---|
Q1 | A |
Q2 | B |
Q3 | B |
Q4 | B |
Q5 | D |
Q6 | B |
Q7 | B |
Q8 | A |
Q9 | A |
Q10 | C |
🧠 Explanations
- Q1 → A: INNER JOIN gives only common rows.
- Q2 → B:
.
- Q3 → B: Missing values are represented as NULL.
- Q4 → B: RIGHT JOIN = all right + matched left.
- Q5 → D: FULL OUTER JOIN not directly in MySQL.
- Q6 → B:
.
- Q7 → B: FULL OUTER JOIN = all rows from both.
- Q8 → A: INNER JOIN ≈ INTERSECTION.
- Q9 → A: INNER JOIN avoids NULLs.
- Q10 → C: CROSS JOIN result =
.
🎯 Why Practice Matters
- SQL Joins are highly scoring in DBMS.
- ECET papers often ask direct JOIN queries.
- Practicing with formulas + examples makes problem solving easier.