Question: Write the SQL queries that answer the questions below (and on the reverse) using the following diagram: List the order numbers and total number of
Write the SQL queries that answer the questions below (and on the reverse) using the following diagram:
-
List the order numbers and total number of items from each order number. Ensure each field is labeled.
-
List the country and the number of vendors in each country. Sort the list by the number of vendors in each country, greatest first. Ensure each field is labeled.
-
List the vendors (by ID only) and the number of products they offer that come with an accessory/ accessories (listed as within the product description). Sort the list by the number of products, greatest first. Ensure each field is labeled.
It Orders PK order_num int(11) order_date datetime FK cust_id char(10) Orderitems OPK/FK order_num int(11) PK order_item int(11) FK prod_id char(10) quantity int(11) item_price decimal(8,2) Products + PK prod_id char(10) prod_name char(255) prod_price decimal(8.2) prod_desc text FK vend_id char(10) Customers PK cust_id char(10) cust_name char(50) cust_address char(50) cust_city char(50) cust_state char(5) cust_zip char(10) cust_country char(50) cust_contact char(50) cust_email char(255) Vendors + PK vend_id char(10) vend name char(50) vend_address char(50) vend_city char(50) vend_state char(5) vend_zip char(10) vend_country char(50)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
