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
-- Hello. please tell me how to find the minimum range. CREATE TABLE reservation ( during tsrange); INSERT INTO reservation VALUES ('[2024-04-01 03:00:00, 2024-04-01 04:00:00)'), ('[2024-04-01 02:00:00, 2024-04-01 06:00:00)'), ('[2024-04-01 02:00:00, 2024-04-01 06:00:00)'); SELECT *, upper(during) - lower(during) FROM reservation order by upper(during) - lower(during) limit 1;

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

Copy Clear