Orders With Names
orders only knows its customer by number. Return, for every order, its id, the customer's name and the amount. Rows may come in any order.
Example 1
customers
| id | name |
|---|---|
| 1 | Ada |
| 2 | Ben |
| 3 | Cy |
orders
| id | customer_id | amount |
|---|---|---|
| 10 | 2 | 50.0 |
| 11 | 1 | 20.5 |
| 12 | 2 | 7.0 |
returns
| id | name | amount |
|---|---|---|
| 10 | Ben | 50.0 |
| 11 | Ada | 20.5 |
| 12 | Ben | 7.0 |
Constraints
- Up to 6 customers and 10 orders
- Every order belongs to a customer in the table
Write it in your browser, against the clock. The model query, with a note on each piece of it, comes after.
More SQL problems
- Pay With BonusEasy
- Small, Medium, LargeEasy
- Total per SymbolEasy
- Totals by MonthEasy
- Above the AverageMedium
- Best Paid in Each DepartmentMedium
- Bought but Never SoldMedium
- Change From the Day BeforeMedium