SQLize
Online
/
PHPize Online
/
SQLtest Online
A
A
A
Share
Donate
Blog
Popular
Donate
A
A
A
Share
Blog
Popular
SQLize.online is a free online SQL environment for quickly running, experimenting with and sharing code.
You can run your SQL code on top of the most popular RDBMS including MySQL, MariaDB, SQLite, PostgreSQL, Oracle and Microsoft SQL Server.
SQL code:
Upload
Copy
Format
Clear
WITH RECURSIVE t1(v, o) AS ( SELECT rental_date, return_date FROM rental WHERE customer_id = 1 ), t2(d, c) AS ( SELECT v, 1 FROM t1 UNION SELECT o, -1 FROM t1 ORDER BY 1 ), t3(n, d, c) AS ( SELECT ROW_NUMBER() OVER (ORDER BY d), d, c FROM t2 ), t4(n, t) AS ( SELECT 0, 0 UNION SELECT t4.n + 1, t4.t + t3.c FROM t4 JOIN t3 ON t4.n + 1 = t3.n ), t5(n, t, s) AS ( SELECT *, IF(LAG(t) OVER(ORDER BY n) = 0, 1, 0) FROM t4 ), t6 AS ( SELECT * FROM t5 WHERE n > 0 AND (t = 0 OR s = 1) ), t7(n, e) AS ( SELECT n, IF(s = 1, LAG(n) OVER(ORDER BY n), NULL) FROM t6 ) SELECT * FROM t6
SQL
Server:
MariaDB 11.4
MariaDB 11.5
MariaDB 10
MariaDB 10 Sakila (ReadOnly)
MySQL 5.7
MySQL 5.7 Sakila (ReadOnly)
MySQL 8.0
MySQL 8.0 Sakila (ReadOnly)
SQLite 3
PostgreSQL 10 Bookings (ReadOnly)
PostgreSQL 11
PostgreSQL 12
PostgreSQL 13
PostgreSQL 14
PostgreSQL 15
MS SQL Server 2017
MS SQL Server 2019
MS SQL Server 2022
MS SQL Server 2022 AdventureWorks (ReadOnly)
Firebird 4.0
Firebird 4.0 (Employee)
Oracle Database 19c (HR)
Oracle Database 21c
Oracle Database 23c Free
SOQOL
Version
ER Diagram
Preserve result
Stuck with a problem?
Got Error?
Ask ChatGPT!
Result:
Copy
Clear