From the course: SQL Practice: Basic Queries
Unlock this course with a free trial
Join today to access over 24,400 courses taught by industry experts.
Solution: Retrieve aggregated data - SQL Tutorial
From the course: SQL Practice: Basic Queries
Solution: Retrieve aggregated data
- [Instructor] In this code challenge, you're asked to find the three customers that have the most orders historically over time. You'll work with two tables in this database, the customers table and the orders table. These two tables are linked together by the CustomerID columns. That's the primary key in the customers table and the second column in the orders table. The initial SQL statement just selects data from the customers table. I'll test the code and see, incorrect output, which is expected but see that the customer table has those three columns. CUSTOMERID, FIRSTNAME, and LASTNAME. Now I'm going to select everything from the orders table. The orders table has 1,000 rows and only some of them are displayed here. But you'll see that there's an ORDERID, a CUSTOMERID and an ORDERDATE. Now I'll show you my solution to this challenge. The challenge asked me to return the three customers who have made the most…
Contents
-
-
-
Solution: Get sorted data from a table1m 35s
-
(Locked)
Solution: Retrieve data from multiple tables1m 29s
-
(Locked)
Solution: Retrieve data filtered on a range1m 41s
-
(Locked)
Solution: Retrieve aggregated data2m 12s
-
(Locked)
Solution: Get data filtered with a string pattern1m 31s
-
(Locked)
Solution: Find the most expensive order1m 55s
-
(Locked)
Solution: Find the average of orders2m 5s
-
-