To compare the performance and observe the linear scaling, we will perform a query that will
require heavy processing. The following query calculates the number of items a customer
bought of his or her favorite item. We order it in an ASCENDING fashion based on the Customer
ID and display the first 5.Though at first glance it might look like a simple query, it involves reading and processing a large
amount of data.The query for the total number of items bought by a customer:
Copy
Ask AI
SELECT c.Name, c.Item, COUNT(*) AS NumberOfItemsFROM Customers cJOIN Purchases p ON c.CustomerID = p.CustomerID AND c.Item = p.ItemGROUP BY c.Name, c.Item, c.CustomerIDORDER BY c.CustomerID ASCLIMIT 5;