From the course: Querying Microsoft SQL Server 2022

Unlock the full course today

Join today to access over 24,200 courses taught by industry experts.

Challenge: Obtain order summaries

Challenge: Obtain order summaries - SQL Server Tutorial

From the course: Querying Microsoft SQL Server 2022

Challenge: Obtain order summaries

(upbeat music) - [Instructor] It's time for another challenge. And this time we're going to use aggregate functions to get summary calculations. The Sales.SalesOrderHeader table contains information about every order that's been made. This includes the customer ID that placed the order and the total amount due. Since many customers have placed multiple orders, I want you to summarize this data to find the customers that have spent the most money at AdventureWorks. I'd also like to know their lowest, highest, and average purchase amount. You'll need to use what you've seen with the SUM function and apply it to the MIN, MAX, and AVG functions to find these values. Finally, include the actual first and last name of each customer. You'll need to create a join to the Person.Person table, but the related columns have different names in both tables. So here's a hint. The related field is Sales.OrderHeader.CustomerID is…

Contents