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
--drop table AAA; --drop table BBB; create table AAA as select * from ( values (1,'qqww') , (2,'ttwe') , (3,'yaya') ) as t(id, str); select * from AAA; create table BBB as select * from ( values (3, '2024-01-22'::timestamp ) , (8, '2024-02-05'::timestamp ) , (2, '2024-11-11'::timestamp ) ) as t( id, dt ); select * from BBB; create table CCC as select * from BBB union all select id, now() as dt from BBB ; select max(rn), id from ( select row_number() over(partition by id) rn, id, dt from CCC group by id, dt ) t group by id ; select id, dt from ( select c1.dt, c1.id, c2.id as ttid from CCC c1 left join CCC c2 on c1.id = c2.id and c1.dt>c2.dt ) t where ttid is not null ; select * from ccc; select id, dt, lag(dt, id) over(order by dt) prev from CCC; select id, dt from ( select max(dt) over(partition by id ) maxdt, id, dt from CCC )t where dt = maxdt ; with t as ( select row_number() over(partition by id order by dt) rn, id, dt from CCC group by id, dt ) select rn, id, dt from ( select max(rn) over(partition by id) mrn, rn, id, dt from t )t2 where mrn = rn ; --over(partition by id, dt) with t as ( select row_number() over(partition by id order by dt) rn, id, dt from CCC group by id, dt ) select * from t ; --t1.max(rn), t1id, (select distinct t.dt from t where id = t.id ) --from t t1 join t t2 om t1.id = t2.id --group by id select * from CCC; explain select id from BBB where not exists(select id from AAA where BBB.id = AAA.id); explain select id from BBB where id not in (select id from AAA where BBB.id = AAA.id); explain select BBB.id from BBB join AAA on BBB.id!= AAA.id; explain select BBB.id from BBB left join AAA on BBB.id= AAA.id; explain select * from ( select AAA.id as a1, BBB.id as b1 from BBB left join AAA on AAA.id=BBB.id ) t where a1 is not null; /** tests ~~~ - написать анти-джойн - получить план запроса / обсудить - убрать дубли - функции в PG SQL - что такое курсор # OLAP - использование индексов - способы оптимизации # SAS (для L3) , bash - роабота с БД (path-throught vs proc sql + lib ) - логи SAS - как найти наиболее свежий ф-л # webapp / python (AF) / - общая архитектура (что и для чего) **/
SQL
Server:
MySQL 5.7
MySQL 5.7 Sakila (ReadOnly)
MySQL 8.0
MySQL 8.0 Sakila (ReadOnly)
MariaDB 11.5
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