From the course: SQL Practice: Basic Queries

Unlock this course with a free trial

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

Solution: Find the most expensive order

Solution: Find the most expensive order - SQL Tutorial

From the course: SQL Practice: Basic Queries

Solution: Find the most expensive order

- [Instructor] In this code challenge, you're asked to retrieve the most expensive order in this dataset and display the result including the name of the customer who made the order. The Orders table in this dataset doesn't have any information about the value of the order, so you have to calculate it on the fly. And I'm going to do that by linking to the Dishes table that has a price through the OrdersDishes table that has foreign keys for both the OrderID and the DishID. Now, there isn't any information in this data set about the quantity of dishes in each order so we're going to assume for this challenge that each dish in an order has a quantity of one. And then I'm going to link from the Orders table to the Customers table by the CustomerID from Orders to Dishes through the OrdersDishes table and calculate the total value returning the most expensive order. Here's my solution to this challenge. Notice that I start with…

Contents