Medium
Given the following 'orders' and 'order_items' tables:
orders:
| order_id | customer_id |
|----------|-------------|
| 1 | 1 |
| 2 | 2 |
| 3 | 1 |
order_items:
| order_item_id | order_id | product_id | quantity |
|---------------|----------|------------|----------|
| 1 | 1 | 1 | 2 |
| 2 | 1 | 2 | 1 |
| 3 | 2 | 1 | 1 |
Which SQL query retrieves the order_id and total number of items for each order?
Author: Vincent CotroStatus: PublishedQuestion passed 1794 times
Edit
3
Community EvaluationsNo one has reviewed this question yet, be the first!
10
Write the SQL query to delete a column from a table12
Write a SQL query to insert data into a table10
Write a SQL query to retrieve the products with a price less than 1000 and sort the results in descending order of price.32
Write a SQL query to retrieve the list of employees with a salary greater than 5100.12
Which SQL keyword is used to sort the result of a SELECT statement?15
Select only distinct values in a column using SQL15
Update a column in an SQL table