i am currently practicing my SQL skills. I wanted to get all data in the past 1 minutes.
The query is SELECT * FROM menfesses WHERE created_at >= NOW() - INTERVAL 1 MINUTE;
But somehow, it returns all data.
I have also use date_add approach and nothing works
What did i do wrong? Thanks

>Solution :
Probably your server time that’s not what you think it is.
This work with a 5 min laps.
MySQL 5.6 Schema Setup:
CREATE TABLE t1
(`c_date` datetime)
;
INSERT INTO t1
(`c_date`)
VALUES
(NOW() - INTERVAL 30 MINUTE),
(NOW() - INTERVAL 2 MINUTE),
(NOW() - INTERVAL 1 MINUTE)
;
Query 1:
SELECT *,NOW() FROM t1 WHERE c_date >= NOW() - INTERVAL 5 MINUTE
| c_date | NOW() |
|----------------------|----------------------|
| 2023-02-09T15:44:05Z | 2023-02-09T15:46:20Z |
| 2023-02-09T15:45:05Z | 2023-02-09T15:46:20Z |