课程: SQL Practice: Basic Queries

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Solution: Retrieve aggregated data

Solution: Retrieve aggregated data - SQL教程

课程: 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…

内容