从下面的events
表中,如何选择不到15分钟前创建的events
?
CREATE TABLE events (
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);
答案 0 :(得分:56)
SELECT created_at FROM events WHERE created_at > NOW() - INTERVAL '15 minutes';
答案 1 :(得分:9)
SELECT * FROM events WHERE age(now(), created_at) < '15 minutes';