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 date as ( select date('20050701') as date UNION ALL select date+1 from date where date+1 <= date('20050731')) SELECT date, ifnull(sum(rented_at_store_1), 0) rented_at_store_1, ifnull(sum(returned_at_store_1), 0) returned_at_store_1, ifnull(sum(rented_at_store_2), 0) rented_at_store_2, ifnull(sum(returned_at_store_2), 0) returned_at_store_2, ifnull(sum(total_rented), 0) total_rented, ifnull(sum(total_returned), 0) total_returned FROM (SELECT date(rental_date) date1, count(CASE WHEN store_id = 1 THEN rental_date END) rented_at_store_1, count(CASE WHEN store_id = 2 THEN rental_date END) rented_at_store_2, count(rental_id) total_rented, 0 returned_at_store_1, 0 returned_at_store_2, 0 total_returned FROM rental JOIN inventory USING(inventory_id) WHERE date(rental_date) BETWEEN '2005-07-01' AND '2005-07-31' GROUP BY date(rental_date), store_id UNION SELECT date(return_date) date2, 0 rented_at_store_1, 0 rented_at_store_2, 0 total_rented, count(CASE WHEN store_id = 1 THEN return_date END) returned_at_store_1, count(CASE WHEN store_id = 2 THEN return_date END) returned_at_store_2, count(return_date) total_returned FROM rental JOIN inventory USING(inventory_id) WHERE date(return_date) BETWEEN '2005-07-01' AND '2005-07-31' GROUP BY date(return_date), store_id) b right join date on date = date1 GROUP BY date ORDER BY date; SHOW STATUS LIKE 'Last_query_cost';
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
SQLite 3 Preloaded
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