linfo2172-databases/P3/queries/query6.sql

11 lines
383 B
MySQL
Raw Normal View History

2024-04-24 10:38:32 +02:00
-- Determine the total number of purchases for each of the last ten days. List the date, as well as the total number of purchases.
-- Expected Heading: RELATION {time INTEGER, cnt INTEGER}
-- How do you treat the default case as showed in the instructions?
SELECT time, COUNT(*) AS cnt
FROM Purchases
where time > date((SELECT MAX(time) FROM Purchases),'-10 days')
GROUP BY time
;