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 CERVEZAS table CREATE TABLE CERVEZAS ( CODC VARCHAR2(5), ENVASE VARCHAR2(20), CAPACIDAD NUMBER(5,2), STOCK NUMBER(6,0), CONSTRAINT CPCERVEZAS PRIMARY KEY (CODC) ); -- Insert data into CERVEZAS table INSERT INTO CERVEZAS VALUES ('01', 'Botella', 0.2, 3600); INSERT INTO CERVEZAS VALUES ('02', 'Botella', 0.33, 1200); INSERT INTO CERVEZAS VALUES ('03', 'Lata', 0.33, 2400); INSERT INTO CERVEZAS VALUES ('04', 'Botella', 1, 288); INSERT INTO CERVEZAS VALUES ('05', 'Barril', 60, 30); -- Create BARES table CREATE TABLE BARES ( CODB VARCHAR2(5), NOMBRE VARCHAR2(30), CIF VARCHAR2(12), LOCALIDAD VARCHAR2(30), CONSTRAINT CPBARES PRIMARY KEY (CODB) ); -- Insert data into BARES table INSERT INTO BARES VALUES ('001', 'Stop', '11111111X', 'Villa Botijo'); INSERT INTO BARES VALUES ('002', 'Las Vegas', '22222222Y', 'Villa Botijo'); INSERT INTO BARES VALUES ('003', 'Club Social', NULL, 'Las Ranas'); INSERT INTO BARES VALUES ('004', 'Otra Ronda', '33333333Z', 'La Esponja'); -- Create EMPLEADOS table CREATE TABLE EMPLEADOS ( CODE VARCHAR2(5), NOMBRE VARCHAR2(30), SUELDO NUMBER(6,2), CONSTRAINT CPEMPLEADOS PRIMARY KEY (CODE) ); -- Insert data into EMPLEADOS table INSERT INTO EMPLEADOS VALUES ('1', 'Prudencio Caminero', 1200); INSERT INTO EMPLEADOS VALUES ('2', 'Vicente Merario', 1100); INSERT INTO EMPLEADOS VALUES ('3', 'Valentín Siempre', 1000); -- Create REPARTO table CREATE TABLE REPARTO ( CODE VARCHAR2(5), CODB VARCHAR2(5), CODC VARCHAR2(5), FECHA DATE, CANTIDAD NUMBER(5,0), CONSTRAINT CPREPARTO PRIMARY KEY (CODE, CODB, CODC, FECHA), CONSTRAINT CAEMPLEADO FOREIGN KEY (CODE) REFERENCES EMPLEADOS(CODE), CONSTRAINT CABARES FOREIGN KEY (CODB) REFERENCES BARES(CODB), CONSTRAINT CACERVEZAS FOREIGN KEY (CODC) REFERENCES CERVEZAS(CODC) ); -- Insert data into REPARTO table INSERT INTO REPARTO VALUES ('1', '001', '01', TO_DATE('10/12/17', 'DD/MM/YY'), 240); INSERT INTO REPARTO VALUES ('1', '001', '02', TO_DATE('10/12/17', 'DD/MM/YY'), 48); INSERT INTO REPARTO VALUES ('1', '002', '03', TO_DATE('14/12/17', 'DD/MM/YY'), 60); INSERT INTO REPARTO VALUES ('1', '004', '05', TO_DATE('14/12/17', 'DD/MM/YY'), 4); INSERT INTO REPARTO VALUES ('2', '002', '03', TO_DATE('14/12/17', 'DD/MM/YY'), 48); INSERT INTO REPARTO VALUES ('2', '002', '05', TO_DATE('18/12/17', 'DD/MM/YY'), 2); INSERT INTO REPARTO VALUES ('2', '004', '01', TO_DATE('18/12/17', 'DD/MM/YY'), 480); INSERT INTO REPARTO VALUES ('2', '004', '02', TO_DATE('22/12/17', 'DD/MM/YY'), 72); INSERT INTO REPARTO VALUES ('3', '003', '03', TO_DATE('22/12/17', 'DD/MM/YY'), 48); INSERT INTO REPARTO VALUES ('3', '003', '04', TO_DATE('28/12/17', 'DD/MM/YY'), 20); INSERT INTO REPARTO VALUES ('3', '003', '02', TO_DATE('10/01/18', 'DD/MM/YY'), 75); update EMPLEADOS set Sueldo=Sueldo*1.10; select * from reparto, empleados, bares where empleados.nombre = 'Prudencio Caminero' and bares.localidad = 'La Esponja'; select * from reparto, empleados, bares, cervezas where cervezas.envase='Lata' and empleados.sueldo>1000; select empleados.code, * from reparto, empleados group by empleados.code;
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