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 (custID integer, custName char(25), custPhone varchar(12), custAdd varchar(50), custPayID integer, constraint Customer_PK PRIMARY KEY (custID)); create table Resteraunt (restID integer, restName char(25), restPhone char(12), restAdd varchar(50), restPayID integer, cuisine varchar(20), constraint Resteraunt_PK PRIMARY KEY (restID)); create table OrderedFrom (custID integer, restID integer, CONSTRAINT OrderedFrom_PK PRIMARY KEY(custID, restID), CONSTRAINT OrderedFrom_Resteraunt_FK FOREIGN KEY(restID) REFERENCES Resteraunt(restID), CONSTRAINT OrderedFrom_Customer_FK FOREIGN KEY(custID) REFERENCES Customer(custID)); create table Driver (driverID integer, driverName char(25), driverPhone char(14), plateNumb varchar(10), license varchar(9), driverPayID integer, driverStatus varchar(15), constraint Driver_PK PRIMARY KEY (driverID)); create table Ord (orderID integer, orderTime varchar(25), orderStatus char(15), restID integer, driverID integer, constraint Ord_PK PRIMARY KEY (orderID), CONSTRAINT Resteraunt_FK FOREIGN KEY (restID) REFERENCES Resteraunt (restID), CONSTRAINT Driver_FK FOREIGN KEY (driverID) REFERENCES Driver (driverID)); insert into Customer(custID, custName, custPhone, custAdd, custPayID) values(1, "April Ludgate", "402-553-4397", "123 S 55 Ave, Omaha, NE 68132", 23456), (2, "April Ludgate", "402-553-4397", "123 S 55 Ave, Omaha, NE 68132", 23456), (3, "Leslie Knope", "234-432-5437", "4387 Waffles Drive, Pawnee, IN, 46011", 98754), (4, "Ron Swanson", "456-987-3265", "987 Bacon Avenue, Pawnee, IN 46011", 234789), (5, "Andy Dwyer", "", "2468 The Pit, Pawnee, IN 46011", 12390); insert into Resteraunt(restID, restName, restPhone, restAdd, restPayID, cuisine) values(1, "Paunch, Burger", "678-893-1568", "6872 Lard Lane, Pawnee, IN 46011", 4826, "Fast food"), (2, "Paunch, Burger", "678-893-1568", "6872 Lard Lane, Pawnee, IN 46011", 4826, "Fast food"), (3, "JJ's Diner", "456-987-3185", "23428 Main St. Pawnee, IN 46011", 78623, "Breakfast "), (4, "Mulligan's", "786-235-4862", "6876 Classy Rd., Indianapolis, IN 46077", 48623, "Steakhouse"), (5, "JJ's Diner", "456-987-3185", "23428 Main St. Pawnee, IN 46011", 78623, "Breakfast "); insert into OrderedFrom(custID, restID) values(1, 1), (2, 2), (3, 3), (4, 4), (5, 5); insert into Driver(driverID, driverName, driverPhone, plateNumb, license, driverPayID, driverStatus) values(1, "Henry Roth", "(286) 937-2250", "IUC989", "C04790049", 444862, "active"), (2, "Charity Osborne", "(815) 605-0336", "REW222", "D89973937", 959227, "active"), (3, "Fritz Macias", "(943) 893-6193", "XUA177", "U06119817", 718371, "active"), (4, "Brenden Hill", "(513) 284-9064", "IOL455", "X22173227", 334452, "active"), (5, "Henry Roth", "(286) 937-2250", "IUC989", "C04790049", 444862, "active"), (6, "Leah Peters", "(909) 477-8843", "AJA879", "V44276914", 603268, "inactive"); insert into Ord(orderID, orderTime, orderStatus, restID, driverID) value(1, "9/30/2020 6:44", "out", 1, 1), (2, "9/30/2020 10:44", "placed", 2, 2), (3, "9/30/2020 10:54", "fulfilled", 3, 3), (4, "9/30/2020 10:46", "placed", 4, 4), (5, "9/30/2020 11:44", "cancelled", 5, 5); select * from Customer c right outer join OrderedFrom of on c.custID = of.custID right outer join Resteraunt r on of.restID = r.restID right outer join Ord o on r.restID = o.restID right outer join Driver d on o.driverID = d.driverID ;
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