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
/*select s.seat_no, b.seat_no, ticket_no --count(s.seat_no) total_seats, --count(b.ticket_no) occupied_seats from boarding_passes b right join flights f on b.flight_id = f.flight_id right join seats s on f.aircraft_code = s.aircraft_code and (b.seat_no = s.seat_no or s.seat_no is null) where b.flight_id = 30625 --or (b.flight_id is null and b.ticket_no is null) --group by f.aircraft_code order by LPAD(SUBSTRING(s.seat_no FROM '^[0-9]+'), 2, '0'), SUBSTRING(s.seat_no FROM '[A-Z]+$'); */ /* select * from seats s left join flights f on f.aircraft_code = s.aircraft_code left join boarding_passes b on b.flight_id = f.flight_id and s.seat_no = b.seat_no where b.flight_id = 30625 or b.ticket_no is null --select * from seats where aircraft_code = '773' */ SELECT COUNT(DISTINCT s.seat_no) AS total_seats, COUNT(bp.seat_no) AS occupied_seats FROM flights f JOIN seats s ON f.aircraft_code = s.aircraft_code LEFT JOIN boarding_passes bp ON f.flight_id = bp.flight_id AND s.seat_no = bp.seat_no WHERE f.flight_id = 30625; ; select * from query_cost('/*select s.seat_no, b.seat_no, ticket_no --count(s.seat_no) total_seats, --count(b.ticket_no) occupied_seats from boarding_passes b right join flights f on b.flight_id = f.flight_id right join seats s on f.aircraft_code = s.aircraft_code and (b.seat_no = s.seat_no or s.seat_no is null) where b.flight_id = 30625 --or (b.flight_id is null and b.ticket_no is null) --group by f.aircraft_code order by LPAD(SUBSTRING(s.seat_no FROM ''^[0-9]+''), 2, ''0''), SUBSTRING(s.seat_no FROM ''[A-Z]+$''); */ /* select * from seats s left join flights f on f.aircraft_code = s.aircraft_code left join boarding_passes b on b.flight_id = f.flight_id and s.seat_no = b.seat_no where b.flight_id = 30625 or b.ticket_no is null --select * from seats where aircraft_code = ''773'' */ SELECT COUNT(DISTINCT s.seat_no) AS total_seats, COUNT(bp.seat_no) AS occupied_seats FROM flights f JOIN seats s ON f.aircraft_code = s.aircraft_code LEFT JOIN boarding_passes bp ON f.flight_id = bp.flight_id AND s.seat_no = bp.seat_no WHERE f.flight_id = 30625;');
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