INNER JOIN Result
Predict Output Easy
Question
What does this SQL produce?
Code
-- orders: (1,"A",cust=1), (2,"B",cust=2)
-- customers: (1,"X"), (2,"Y"), (3,"Z")
SELECT o.name, c.name FROM orders o
INNER JOIN customers c ON o.cust = c.id;
Hint
INNER JOIN matches orders to customers by id.
Explanation
INNER JOIN matches each order to its customer. Order A (cust=1) matches customer X (id=1). Order B (cust=2) matches customer Y (id=2). Customer Z (id=3) has no orders and is excluded. Result: A-X, B-Y.
Related Resources
Related Lessons
- JOINs
Learn JOINs.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.