linfo2172-databases/P3/queries/query5.sql

10 lines
291 B
MySQL
Raw Normal View History

2024-04-24 11:31:15 +02:00
-- Author: Anatole Huet
-- Determine the total number of purchases for each product. List the number of the product, as well as the total number of purchases.
SELECT product, Count(*) as cnt
FROM Purchases
where time > date((SELECT MAX(time) FROM Purchases),'-10 days')
GROUP BY product
;