EquiJoin — SQL Technical Interview Questions & Answers
EquiJoin
EquiJoin
- Equijoin means the ON uses equality: ON s.roll = m.roll. Almost every student JOIN is an equijoin. The word shows up in MCQs versus theta join (>, <) which is rare.
- Inner + equal keys = equijoin. You already know it if you can write JOIN … ON a = b.
- Trap: treating ‘equijoin’ as a separate MySQL keyword. It is not. It is a description.
- On the example next to this theory: EquiJoin: create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.
Technical Interview Tip: Equijoin = ON left.col = right.col. No special keyword.
Code Examples for EquiJoin
EquiJoin — sample query
-- EquiJoin
CREATE TABLE demo (
id INTEGER PRIMARY KEY,
label TEXT NOT NULL,
qty INTEGER DEFAULT 0
);
INSERT INTO demo (id, label, qty) VALUES
(1, 'alpha', 2),
(2, 'beta', 5);
SELECT label, qty FROM demo WHERE qty >= 2 ORDER BY qty DESC;EquiJoin: create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.
How to Explain EquiJoin to an Interviewer
What is an equijoin?
Join on equality ON s.roll = m.roll