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 `WORKERS` ( `Id_worker` INT(6) NOT NULL AUTO_INCREMENT, `Name` varchar(25) NOT NULL, `Surname` varchar(25) NOT NULL, `Role` INT(1) NOT NULL, `Username` varchar(25) NOT NULL UNIQUE, `Password` varchar(25) NOT NULL, `Password_changed` INT(1) NOT NULL DEFAULT '0', `Date_born` DATE NOT NULL, `Mail` varchar(255) NOT NULL, PRIMARY KEY (`Id_worker`) ); CREATE TABLE `CUSTOMERS` ( `Vat_number` varchar(25) NOT NULL, `Name` varchar(255) NOT NULL, `Address` varchar(100) NOT NULL, `Location` varchar(25) NOT NULL, `Country` varchar(25) NOT NULL, `Date` DATE NOT NULL, PRIMARY KEY (`Vat_number`) ); CREATE TABLE `CUSTOMERS_REGISTRED` ( `Vat_number` varchar(25) NOT NULL, `Id_worker` INT(6) NOT NULL ); CREATE TABLE `ROBOTS` ( `Serial_number` varchar(25) NOT NULL UNIQUE, `Production_batch` varchar(25) NOT NULL, `Code` varchar(25) NOT NULL, `Weight` DECIMAL(10) NOT NULL, PRIMARY KEY (`Serial_number`) ); CREATE TABLE `ROBOT_FEATURES` ( `Serial_number` varchar(25) NOT NULL, `Berable_weight` DECIMAL(10) NOT NULL, `Cut_resistance` DECIMAL(10) NOT NULL, `Compression` DECIMAL(10) NOT NULL, `Torque` DECIMAL(10) NOT NULL ); CREATE TABLE `ROBOT_SELLED` ( `Serial_number` varchar(25) NOT NULL, `Vat_number` varchar(25) NOT NULL, `Date` DATE NOT NULL ); CREATE TABLE `ROBOTS_WORK` ( `Serial_number` varchar(25) NOT NULL, `Id_worker` INT(6) NOT NULL, `Work` varchar(255) NOT NULL, `State_decay` INT(2) NOT NULL, `Date_work` DATETIME NOT NULL ); ALTER TABLE `CUSTOMERS_REGISTRED` ADD CONSTRAINT `CUSTOMERS_REGISTRED_fk0` FOREIGN KEY (`Vat_number`) REFERENCES `CUSTOMERS`(`Vat_number`); ALTER TABLE `CUSTOMERS_REGISTRED` ADD CONSTRAINT `CUSTOMERS_REGISTRED_fk1` FOREIGN KEY (`Id_worker`) REFERENCES `WORKERS`(`Id_worker`); ALTER TABLE `ROBOT_FEATURES` ADD CONSTRAINT `ROBOT_FEATURES_fk0` FOREIGN KEY (`Serial_number`) REFERENCES `ROBOTS`(`Serial_number`); ALTER TABLE `ROBOT_SELLED` ADD CONSTRAINT `ROBOT_SELLED_fk0` FOREIGN KEY (`Serial_number`) REFERENCES `ROBOTS`(`Serial_number`); ALTER TABLE `ROBOT_SELLED` ADD CONSTRAINT `ROBOT_SELLED_fk1` FOREIGN KEY (`Vat_number`) REFERENCES `CUSTOMERS`(`Vat_number`); ALTER TABLE `ROBOTS_WORK` ADD CONSTRAINT `ROBOTS_WORK_fk0` FOREIGN KEY (`Serial_number`) REFERENCES `ROBOTS`(`Serial_number`); -- ALTER TABLE `ROBOTS_WORK` ADD CONSTRAINT `ROBOTS_WORK_fk1` FOREIGN KEY (`Id_worker`) REFERENCES `WORKERS`(`Id_worker`); INSERT INTO ROBOTS ( Serial_number, Production_batch, Code, Weight ) VALUES ( 'SN0000272865XYZ567890A324', '567809', 'er45', '550' ); INSERT INTO ROBOT_FEATURES ( Serial_number, Berable_weight, Cut_resistance, Compression, Torque ) VALUES ( 'SN0000272865XYZ567890A324', '750', '45', '36', '5' ); INSERT INTO ROBOTS_WORK ( Serial_number, Id_Worker, Work, State_decay, Date_work ) VALUES ( 'SN0000272865XYZ567890A324', '3', 'Installation', '100', '2022-04-16 12:41:05' );
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