Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
CREATE TABLE `Customer` ( `customerId` INTEGER, `firstName` VARCHAR(20), `lastName` VARCHAR(20), `street` VARCHAR(35), `city` VARCHAR(35), `state` CHAR(2), `zip` CHAR(10), `phoneNumber` BIGINT, PRIMARY KEY (`customerId`) ); CREATE TABLE `Restaurant` ( `restaurantId` INTEGER, `restaurantName` VARCHAR(35), `cuisine` VARCHAR(20), `street` VARCHAR(35), `city` VARCHAR(35), `state` CHAR(2), `zip` CHAR(10), `phoneNumber` VARCHAR(12), PRIMARY KEY (`restaurantId`) ); CREATE TABLE `Driver` ( `driverId` INTEGER, `firstName` VARCHAR(20), `lastName` VARCHAR(20), `status` VARCHAR(10), `phoneNumber` BIGINT, `license` CHAR(10), PRIMARY KEY (`driverId`) ); CREATE TABLE `Payment` ( `paymentId` INTEGER, `status` VARCHAR(20), `date` DATE, `time` TIME, `customerId` INTEGER, `restaurantId` INTEGER, `driverId` INTEGER, PRIMARY KEY (`paymentId`) ); INSERT INTO Customer (customerId, firstName, lastName, street, city, state, zip, phoneNumber) VALUES (1, "April", "Ludgate", "123 5 55 Ave", "Omaha", 'NE', 68132, 4025534397), (2, "Leslie", "Knope", "4387 Waffles Drive", "Pawnee", 'IN', 46011, 234432537), (3, "Ron", "Swanson", "987 Bacon Avenue", "Pawnee", 'IN', 46011, 4569873265), (4, "Andy", "Dwyer", "2468 The Pit", "Pawnee", 'IN', 46011, null); INSERT INTO Restaurant (restaurantId, restaurantName, cuisine, street, city, state, zip, phoneNumber) VALUES (1, "Paunch Burger", "Fast Food", "6872 Lard Lane", "Pawnee", 'IN', 46011, 2869372250), (2, "JJ's Diner", "Breakfast", "23428 Main St.", "Pawnee", 'IN', 46011, 4569873185), (3, "Mulligan's", "Steakhouse", "6872 Classy Rd.", "Indianopolis", "IN", 46077, 7862354862); INSERT INTO Driver (driverId, firstName, lastName, status, license, phoneNumber) VALUES (1, "Henry", "Roth", "active", "C04790049", 2869372250), (2, "Charity", "Osborne", "active", "D89973937", 8156050336), (3, "Fritz", "Macias", "active", "U06119817", 9438936193), (4, "Brenden", "Hill", "active", "X22173227", 5132849064), (5, "Leah", "Peters", "inactive", "V44276914", 9094778843); INSERT INTO Payment (paymentId, status, date, time, customerId, restaurantId, driverId) VALUES (1, "out", "2020-09-30", "06:44", 1, 1, 1), (2, "placed", "2020-09-30", "10:44", 1, 1, 2), (3, "fulfilled", "2020-09-30", "10:54", 2, 2, 3), (4, "placed", "2020-09-30", "10:46", 3, 3, 4), (5, "cancelled", "2020-09-30", "11:44", 4, 2, 1); SELECT * FROM Payment; SELECT * FROM Driver; SELECT * FROM Restaurant; SELECT * FROM Customer;

Stuck with a problem? Got Error? Ask AI support!

Copy Clear