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 SHOPS ( SHOP INT, DOC_NUMBER VARCHAR(50), DAY DATE, SHIPMENT VARCHAR(50) ); INSERT INTO SHOPS (SHOP, DOC_NUMBER, DAY, SHIPMENT) VALUES (1220, '1123-4553-08', '2021-12-27', 'COU'), (1221, '0811-4553-08', '2021-11-24', 'PNT'), (1222, '0043-4553-14', '2021-12-25', 'LCTN'), (1320, '2333-4553-16', '2021-10-20', 'PNT'), (1330, '1000-4553-10', '2021-12-27', 'COU'), (1450, '0999-4553-14', '2021-09-26', 'PNT'), (1520, '1499-4553-08', '2021-12-22', 'COU'); CREATE TABLE WAREHOUSE ( WAREHOUSE VARCHAR(15), ID INT, DOCUMENT VARCHAR(15), MONTH INT ); INSERT INTO WAREHOUSE (WAREHOUSE, ID, DOCUMENT, MONTH) VALUES ('',11231521,'', 0), ('',08111221,'', 0), ('',00431022,'', 0), ('',23331320,'', 0), ('',10001330,'', 0), ('',09991450,'', 0), ('',14991520,'', 0); WITH T1 AS (SELECT SHOPS.SHOP FROM SHOPS JOIN WAREHOUSE ON SUBSTRING(WAREHOUSE.ID, 5, 4) = SHOPS.SHOP) UPDATE WAREHOUSE SET WAREHOUSE = CASE WHEN WAREHOUSE.WAREHOUSE = '' AND SUBSTRING(WAREHOUSE.ID, 5, 4) IN (SELECT SHOP FROM T1) THEN (SELECT SUBSTRING(SHOPS.DOC_NUMBER, 11, 2) FROM SHOPS WHERE SUBSTRING(WAREHOUSE.ID, 5, 4) = SHOPS.SHOP) END, DOCUMENT = CASE WHEN WAREHOUSE.DOCUMENT = '' AND SUBSTRING(WAREHOUSE.ID, 5, 4) IN (SELECT SHOP FROM T1) THEN (SELECT (SUBSTRING(SHOPS.DOC_NUMBER, 6, 7) + '-' + SUBSTRING(CAST(SHOPS.DAY AS CHAR), 6, 5)) FROM SHOPS WHERE SUBSTRING(WAREHOUSE.ID, 5, 4) = SHOPS.SHOP) END, MONTH = CASE WHEN WAREHOUSE.MONTH = 0 AND SUBSTRING(WAREHOUSE.ID, 5, 4) IN (SELECT SHOP FROM T1) THEN (SELECT (SUBSTRING(CAST(SHOPS.DAY AS CHAR), 6, 2)) FROM SHOPS WHERE SUBSTRING(WAREHOUSE.ID, 5, 4)= SHOPS.SHOP) END; SELECT COUNT(WAREHOUSE) FROM WAREHOUSE WHERE WAREHOUSE IS NOT NULL AND SUBSTRING(WAREHOUSE.DOCUMENT, 12, 2) >= 24;
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