Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Food Delivery Website SQL Analysis
CREATE TABLE D_Merchants ("merchant_id" int, "merchant_name" varchar(20),"merchant_state" varchar(20),"merchant_city" varchar(20)) ; INSERT INTO D_Merchants ("merchant_id", "merchant_name","merchant_state", "merchant_city") VALUES (187432, 'Joes Diner', 'ID','Boise'), (192643, 'Slice of Pie', 'CA','San Francisco'), (173444, 'Toms Cake', 'NY','Brooklyn') ; CREATE TABLE D_Orders ("order_id" int, "order_date" timestamp,"merchant_id" int) ; INSERT INTO D_Orders ("order_id", "order_date","merchant_id") VALUES (187432, '2017-12-10', 187432), (192643, '2018-04-03', 192643), (173444, '2018-11-10', 786512) ; select * from D_Merchants; select * from D_Orders; --How would you add merchant_name to each order from the Orders table? SELECT a.order_id, a.order_date, a.merchant_id, a.merchant_id, b.merchant_name FROM D_Orders a LEFT JOIN D_Merchants b ON a.merchant_id = b.merchant_id;
run
|
edit
|
history
|
help
0
Return IDs where there are exactly 3 occurrences1
ds
nested array to table
Count total records
Leet Code 185
Assignment 1(SET A)
Sample tables
Library Query
test
FINALE fdjfnkds