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
create table sales ( card_id varchar(10) ,saled_date date ) insert into sales (card_id, saled_date) values ('card-1', '2021-02-15') ,('card-1', '2022-03-05') ,('card-1', '2022-03-27') ,('card-1', '2022-05-18') ,('card-1', '2023-06-10') ,('card-2', '2021-01-15') ,('card-2', '2022-05-18') ,('card-2', '2023-06-21') ,('card-3', '2022-05-20') ,('card-4', '2022-05-20') ,('card-5', '2022-05-20') create table activations ( card_id varchar(10) ,activity_date date ) insert into activations (card_id, activity_date) values ('card-1', '2021-02-20') ,('card-1', '2023-07-17') ,('card-2', '2022-05-25') ,('card-3', '2022-08-15') ,('card-5', '2023-01-15') drop table if exists #t select s.card_id ,s.saled_date ,isnull(dateadd(day, - 1, lead(s.saled_date) over (partition by s.card_id order by s.saled_date)), '2099-12-31') [prev_date] into #t from sales s select t.card_id ,t.saled_date --,t.prev_date ,a.activity_date from #t t left join activations a on a.card_id = t.card_id and a.activity_date >= t.saled_date and a.activity_date <= t.prev_date
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