SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
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 ChatGPT!

Copy Clear