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 task ( employee_id integer, application_id integer, client_id integer, application_begin_date date, issuance_date date ); insert into task values (1, 12, 5, to_date('01.01.2023', 'dd.mm.yyy'), null), (2, 23, 5, to_date('02.02.2023', 'dd.mm.yyy'), null), (3, 34, 5, to_date('15.03.2023', 'dd.mm.yyy'), null), (4, 45, 5, to_date('25.03.2023', 'dd.mm.yyy'), to_date('01.04.2023', 'dd.mm.yyy')), (5, 65, 6, to_date('01.01.2023', 'dd.mm.yyy'), null), (6, 68, 6, to_date('15.01.2023', 'dd.mm.yyy'), to_date('25.01.2023', 'dd.mm.yyy')), (7, 78, 7, to_date('01.01.2023', 'dd.mm.yyy'), null), (8, 97, 7, to_date('02.02.2023', 'dd.mm.yyy'), null), (9, 90, 8, to_date('01.01.2023', 'dd.mm.yyy'), null), (19, 80, 8, to_date('02.02.2023', 'dd.mm.yyy'), null), (11, 98, 8, to_date('15.02.2023', 'dd.mm.yyy'), to_date('20.02.2023', 'dd.mm.yyy')), (12, 96, 9, to_date('01.01.2023', 'dd.mm.yyy'), null), (13, 46, 9, to_date('03.03.2023', 'dd.mm.yyy'), null); select * from task; select employee_id, application_id, client_id, application_begin_date, i_dt as issuance_date from ( select *, row_number() over(partition by client_id order by application_begin_date, application_id) as rn from ( select *, max(issuance_date) over(partition by client_id) as i_dt from task )t where i_dt - application_begin_date <= 30 ) foo where rn = 1
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