Question
SQL: NORTHWIND - Create a summary query that will display the number of orders, the earliest order date, the latest order date by country for
SQL: NORTHWIND
- Create a summary query that will display the number of orders, the earliest order date, the latest order date by country for Canada, United States, the UK, and Mexico.
- Display the average unit price, the average quantity, the average product sales, the total product sales for all orders. Product Sales is a calculate field: Unit Price * Quantity * (1Discount). Use the Products table Unit Price. There should be only one row.
- Create the following summary query for each ProductName for all Beverage products: List the average quantity ordered, the highest quantity ordered, the average product sales amount, and the total product sales amount (Product Sales is a calculate field: Unit Price * Quantity * (1 Discount)). Use the Unit Price at the time of the sale (Order Details table).
- You are to create a query that will display the number of orders grouped by territory description. This should only include territories where the number of orders are 120 and over. You will need to use the Having clause.
- Create a query that will return the customer id, company name and country for those customers with, at least, one order. Use the In operator with a subquery .
- Using the ALL keyword create a query that returns orders that have a quantity larger than the quantities ordered for the product named Chang. Display the Order ID, Order date, Product ID, Quantity ordered, Unit price and discount. The subquery should return all of the quantities ordered for product named Chang.
- Create a query that will display the order id, customer id, order date, shipped date and the ship freight cost (freight) for those orders that are less than or equal to the freight average of all orders for the CustomerID = QUICK. The subquery should determine what the freight average is and pass that to the outer query.
- Create a query using a subquery within the FROM clause to retrieve the top 8 customers based on the number of orders received. The outer query should display the customer id, the date of the first order, the date of the last order and the total number of orders received.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started