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 customers ( id INT AUTO_INCREMENT PRIMARY KEY, first_name NVARCHAR(15) NOT NULL, last_name NVARCHAR(15) NOT NULL, phone_number NVARCHAR(11) NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); CREATE TABLE rental_details ( id INT AUTO_INCREMENT PRIMARY KEY, rental_date DATETIME DEFAULT CURRENT_TIMESTAMP, return_date DATETIME DEFAULT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); CREATE TABLE shoes ( id INT AUTO_INCREMENT PRIMARY KEY, size DECIMAL(3,1) NOT NULL, is_rentaled BOOLEAN NOT NULL DEFAULT FALSE, created_at DATETIME DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); CREATE TABLE rentals ( customer_id INT NOT NULL, rental_detail_id INT NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (customer_id, rental_detail_id), FOREIGN KEY (customer_id) REFERENCES customers (id), FOREIGN KEY (rental_detail_id) REFERENCES rental_details (id) ); CREATE TABLE rental_shoes ( rental_detail_id INT NOT NULL, shoes_id INT NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (rental_detail_id, shoes_id), FOREIGN KEY (rental_detail_id) REFERENCES rental_details (id), FOREIGN KEY (shoes_id) REFERENCES shoes (id) ); INSERT INTO customers (first_name, last_name, phone_number) VALUES ('Taro', 'Tanaka', '09012345678'); SELECT * FROM customers; DELIMITER // CREATE PROCEDURE shoes_insert(IN i INT, IN s DECIMAL(3,1)) BEGIN DECLARE count INT DEFAULT 0; WHILE count < i DO SET count = count + 1; INSERT INTO shoes (size) VALUES (s); END WHILE; END // DELIMITER ; CALL shoes_insert(6, 20.0); CALL shoes_insert(10, 21.0); CALL shoes_insert(12, 22.0); CALL shoes_insert(15, 23.0); CALL shoes_insert(15, 23.5); CALL shoes_insert(15, 24.0); CALL shoes_insert(18, 24.5); CALL shoes_insert(18, 25.0); CALL shoes_insert(18, 25.5); CALL shoes_insert(20, 26.0); CALL shoes_insert(15, 26.5); CALL shoes_insert(15, 27.0); CALL shoes_insert(12, 28.0); SELECT * FROM shoes; SELECT size, count(size) FROM shoes WHERE is_rentaled = False GROUP BY size;
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