Question: MYSQL DATABASE: 1) Using a subquery, return a list of customers who bought items priced 10 or more. Youll want to use the OrderItems table
MYSQL DATABASE:
1) Using a subquery, return a list of customers who bought items priced 10 or more. Youll want to use the OrderItems table to find the matching order numbers (order_num), and then the Orders table to retrieve the customer id (cust_id) for those matched orders.
2) Using a subquery, list all product names (prod_name) from the Products table, along with a derived field named quant_sold containing the total number of this item sold (retrieved by using a subquery on the OrderItems table).
orderitems table:
| order_num | int(11) PK |
| order_item | int(11) PK |
| prod_id | char(10) |
| quantity | int(11) |
| item_price | decimal(8,2) |
orders table:
Columns:
| order_num | int(11) PK |
| order_date | DateTime |
| cust_id | char(10) |
products table:
Columns:
| prod_id | char(10) PK |
| vend_id | char(10) |
| prod_name | char(255) |
| prod_price | decimal(8,2) |
| prod_desc | text |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
