Question: In Northwind Database 2. List the CustomerID and the average Freight cost for each customer. Name the Freight column Average Freight Cost. Display the Average
In Northwind Database
2. List the CustomerID and the average Freight cost for each customer. Name the Freight column "Average Freight Cost." Display the "Average Freight Cost" with two decimal places.
SELECT CustomerID, avg(Freight) as "Average Freight Cost" FROM orders GROUP BY CustomerID; *I need to display 2 decimal places here for Average Freight cost*
3. List the same information in step 2 but only for customers who have an average freight cost more than $100. Again, ensure to display the "Average Freight Cost" with two decimal places.
SELECT CustomerID, avg(Freight) as "Average Freight Cost" FROM orders GROUP BY CustomerID HAVING avg(Freight) >100; *Same as number 2, but also need to display 2 decimal places*
4. List each Employees ID along with their first and last name and their most recent order date. Name the column that shows the most recent order date as "Most Recent Order". (Hint: This will require the use of two tables, the employees and orders tables.) *Mainly just need this question* Thanks for you help
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
