Easy
Rookie
SpeedRun
joins
inner-join
fundamentals
SQL: Counting INNER JOIN Rows
+100 XP · 6 min · attempt 1
Problem
Given these two tables:
users(id) -> 1, 2, 3, 4
orders(user_id) -> 1, 1, 2, 2, 2, 5
How many rows does the following query return?
SELECT u.id, o.user_id
FROM users u
INNER JOIN orders o ON o.user_id = u.id;
Enter a single integer.
Starter
-- Inner join keeps only rows whose join key exists on BOTH sides.
-- Each match emits one output row per (left, right) pair.
Your answer
Playing as a guest — you'll be asked for a display name on submit. Log in to keep your XP across devices.