INNER JOIN: Match Orders With Customer Names

Basics
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_idcustomer_idamount
102280
101150
1039920

Input — customers

customer_idcustomer_name
1Alice
2Bob

Expected Output

order_idcustomer_nameamount
101Alice50
102Bob80

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 BY order is checked by the grader.
  • Query type: Write a single read-only Standard SQL SELECT (or WITH ... SELECT) query.

Constraints & Evaluation Criteria

  • Return `order_id, customer_name, amount` ordered by `order_id ASC`.

Hints

SQL
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)