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 Customer (customer_id integer NOT NULL, first_name VARCHAR(25), last_name VARCHAR(25), street_address VARCHAR(30), city VARCHAR(30), state_name VARCHAR(2), zip_code integer NOT NULL, phone_number VARCHAR(20), payment_id integer NOT NULL, CONSTRAINT Customer_PK PRIMARY KEY (customer_id)); CREATE TABLE Restaurant (restaurant_id integer NOT NULL, restaurant_name VARCHAR(25), street_address VARCHAR(25), city VARCHAR(30), state_name VARCHAR(25), zip_code integer NOT NULL, phone_number VARCHAR(25), cuisine_type VARCHAR(25), rest_payment_id integer NOT NULL, CONSTRAINT Restaurant_PK PRIMARY KEY (restaurant_id)); CREATE TABLE Driver (driver_id integer NOT NULL, driver_fname VARCHAR(25), driver_lname VARCHAR(25), phone_number VARCHAR(20), license_plate VARCHAR(7), drv_license_number VARCHAR(20), drv_payment_id integer NOT NULL, driver_status VARCHAR(8), CONSTRAINT Driver_PK PRIMARY KEY (driver_id)); CREATE TABLE Orders (order_id integer NOT NULL, time_stamp VARCHAR(15), order_status VARCHAR(10), restaurant_id integer NOT NULL, customer_id integer NOT NULL, driver_id integer NOT NULL, CONSTRAINT Order_PK PRIMARY KEY(order_id), CONSTRAINT Order_Restaurant_FK FOREIGN KEY(restaurant_id) REFERENCES Restaurant(restaurant_id), CONSTRAINT Order_Customer_FK FOREIGN KEY(customer_id) REFERENCES Customer(customer_id), CONSTRAINT Order_Driver_FK FOREIGN KEY(driver_id) REFERENCES Driver(driver_id)); insert into Customer (customer_id, first_name, last_name, street_address, city, state_name, zip_code, phone_number, payment_id) values (1, "April", "Ludgate", "123 S 55 Ave", "Omaha", "NE", "68132", "402-553-4397", "23456"), (2, "Leslie", "Knope", "4387 Waffles Drive", "Pawnee", "IN", "46011", "234-432-5437", "98754"), (4, "Ron", "Swanson", "987 Bacon Avenue", "Pawnee", "IN", "46011", "456-987-3265", "234789"), (5, "Andy", "Dwyer", "2468 The Pit", "Pawnee", "IN", "46011", NULL, "12390"); insert into Restaurant (restaurant_id, restaurant_name, street_address, city, state_name, zip_code, phone_number, cuisine_type, rest_payment_id) values (6, "Paunch Burger", "6872 Lard Lane", "Pawnee", "IN", "46011", "678-893-1568", "Fast Food", "4826"), (7, "JJ's Diner", "23428 Main St.", "Pawnee", "IN", "46011", "456-987-3185", "Breakfast", "78623"), (8, "Mulligan's", "6876 Classy RD.", "Indianapolis", "IN", "46077", "786-235-4862", "Steakhouse", "48623"); insert into Driver (driver_id, driver_fname, driver_lname, phone_number, license_plate, drv_license_number, drv_payment_id, driver_status) values (9, "Henry", "Roth", "(286) 937-2250", "IUC989", "CO4790049", "444862", "active"), (10, "Charity", "Osborne", "(815) 605-0336", "REW222", "D89973937", "959227", "active"), (11, "Fritz", "Macias", "(943) 893-6193", "XUA177", "U06119817", "718371", "active"), (12, "Brenden", "Hill", "(513) 284-9064", "IOL455", "X22173227", "334452", "active"), (13, "Leah", "Peters", "(909) 477-8843", "AJA879", "V44276914", "603268", "inactive"); insert into Orders (order_id, time_stamp, order_status, restaurant_id, customer_id, driver_id) values (14, "9/30/2020 6:44", "out", 6, 1, 9), (15, "9/30/2020 10:44", "placed", 6, 1, 10), (16, "9/30/2020 10:54", "fulfilled", 7, 2, 11), (17, "9/30/2020 10:46", "placed", 8, 4, 12), (18, "9/30/2020 11:44", "cancelled", 7, 5, 9);
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