Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
CREATE TABLE `users` ( `id` int primary key auto_increment, `name` varchar(64), `created_at` timestamp ); INSERT INTO users(`name`, `created_at`) VALUES ('User1', '2023-02-02 13:00:00'), ('User2', '2023-02-02 13:01:00'), ('User3', '2023-02-02 13:06:00'), ('User4', '2023-02-02 13:50:46'); (SELECT * FROM `users` WHERE `created_at` > '2023-02-02 13:05:46' ORDER BY `created_at` ASC LIMIT 1) UNION ALL (SELECT * FROM `users` WHERE `created_at` < '2023-02-02 13:05:46' ORDER BY `created_at` DESC LIMIT 1)

Stuck with a problem? Got Error? Ask AI support!

Copy Clear