BasicsINNER JOINGoogleAmazonMeta
Tables
orders(order_id INT, customer_id INT, amount INT)customers(customer_id INT, customer_name VARCHAR)
Task
Join orders(order_id, customer_id, amount) with customers(customer_id, customer_name) using INNER JOIN and return order_id, customer_name, amount ordered by order_id ASC.
Why It Matters: INNER JOIN enriches transactional fact tables (orders) with human-readable attributes from dimension tables (customers).
Output columns: order_id, customer_name, amount
Example
Input — orders
| order_id | customer_id | amount |
|---|---|---|
| 102 | 2 | 80 |
| 101 | 1 | 50 |
| 103 | 99 | 20 |
Input — customers
| customer_id | customer_name |
|---|---|
| 1 | Alice |
| 2 | Bob |
Expected Output
| order_id | customer_name | amount |
|---|---|---|
| 101 | Alice | 50 |
| 102 | Bob | 80 |
Explanation: Matches each order to its customer by key; any unmatched rows on either side are excluded by the inner join.
Requirements
- Exact output columns:
order_id,customer_name,amount - Row order: Exact
ORDER BYorder is checked by the grader. - Query type: Write a single read-only Standard SQL
SELECT(orWITH ... SELECT) query.
Constraints & Evaluation Criteria
- Return `order_id, customer_name, amount` ordered by `order_id ASC`.
Hints
SQL⌘/Ctrl+Enter to Run · ⌘/Ctrl+Shift+Enter to Submit
Loading Code Editor...
+1 Hidden Submit Case
Input / Scenario
orders (3 rows), customers (2 rows)
Expected Output / Criteria
2 row(s): (101, Alice, 50); (102, Bob, 80)