duration NULL oid name dishcost 4 fresh lemonade sandwich 33.98

Similar documents
Pollinating almonds: how many bees do you need?

Marionberry Refresher

2005 Commander SAAZ Interplanetary Homebrew Blastoff Medal Results

STELLA S FISH CAFÉ PRIVATE DINING MENU

Yelp Chanllenge. Tianshu Fan Xinhang Shao University of Washington. June 7, 2013

Department of Planning & Development Services

CellarTracker! For Crestron. Screen Shots

PPP1001/PPP100 UNIVERSITY OF CALIFORNIA-SYSTEMWIDE PAGE NO RETN: SEE RPTS DISP SCHEDULE/DIST. DATA BASE MAINTENANCE RUN DATE 07/09/07

Jesse James (Outlaws And Lawmen Of The Wild West) By Carl R. Green;William R. Sanford READ ONLINE

Hever Castle Triathlon Saturday 27th September 2014 The 'Elizabeth 1' (8-10 yrs) - 100m/4km/1.3km

2018 BASKETBALL SKILLS SCORES Boys 5yrs and under Bulls Drive Location Connor Michael Lazar 6 Chicago Bulls Summer Camp (5-12 y) Clarendon Hills -

01. Beans-dry Shelled A. Edible Soybean. 1 Esther Mishler. B. Horticulture. B. Horticulture. 2 Lilly Whitacre. C. Kidney. D. Lima. E.

Prelude to Wertman Family Reunion. Gettysburg, September 27-28, 2019

What makes a good muffin? Ivan Ivanov. CS229 Final Project

1) Revisit the list of filtering terms taking into consideration the list of most popular search terms

Notes

6 th & WALL. 521 Wall Street Seattle, WA HIGHLIGHTS

datcp PEST SURVEY rogra 2014 INSECT SURVEYS AND OUTLOOK FOR 2015 KRISTA HAMILTON, DATCP ENTOMOLOGIST

Notes

WOK OF FURY: HOW TO COOK CHINESE BY KHOAN VONG DOWNLOAD EBOOK : WOK OF FURY: HOW TO COOK CHINESE BY KHOAN VONG PDF

Offical Record. Tennessee State Fair. F -Creative Arts - Adult Bakery - Adults. Class: A-01 - Pie - Chess Alcorn, Debbie - 174

DoubleTree. del mar. hors d oeuvres & stations catering menu El Camino Real. San Diego, CA Phone: (858)

1.00 entrance fee at the gate - Under 16 s are free Entry from 2pm

KAREN ROBARDS BOOKS PDF

MENU REVIEW IDENTIFYING HEALTHY ITEMS - AssetMark

Love, Lattes And Danger (Mutants Book 2) By Sandra Cox READ ONLINE

Table For Two - Back For Seconds By Warren Caterson READ ONLINE

An Introduction to DBIx::Class. Tom Hukins

Soup It Up: A Collection Of Simple Thai Soup Recipes By PJ Group Publishing

SAP Fiori UX Design and Build Assignment SOMMELIER

NED BROOKS Senior Vice President

Descendants of Aaron FURMINGER

SRM: 9.0 AVAILABILITY:

Upside Rooftop bar. 127 Brunswick St, Fitzroy PH

US Foods Online and Mobile App Technology Update

PRIVATE DINING YEAR A RARE EXPERIENCE, WELL DONE.

The Crimean War. Oct 5, 1853 Mar 30, 1856

Current Current Appt. List Custodian/Engineer Assg. Title Date Rating Number Choice. 1. Jorge Corniel X460 CE1R 03/24/06 4.

Low Carb Greek Recipes And Low Carb Indian Recipes: 2 Book Combo (The Low Carb Bibles) By Tina Palmarchetty READ ONLINE

BarkeepOnline Managing Recipes

Hamburgers. Sandwiches. P r i m e r i b s a n d w i c h. C h e e s e b u r g e r. P h i l l y c h e e s e s t e a k. B a c o n c h e e s e b u r g e r

Urban Prairie Cuisine 200 River Ave, Winnipeg, Manitoba Tel. (204) ext 143

Association Rule Mining

/ GLOPAK 2016 Glopak Wine & Spirits Corp.

Eucharistic Ministers and Lectors Sep 1 - Oct 1

Resources and Information for Beanalicious Living

Casual Coastal Cuisine. blackbeards.restaurant

Miami-Dade County Public Schools Department of Food and Nutrition Olga V. Botero, Director Shilesa Chandler, Region Supervisor Marcela Tan, Region

THE OYSTER HARBOUR PEARL

REMARKABLE SERVICE BY THE CULINARY INSTITUTE OF AMERICA (CIA) DOWNLOAD EBOOK : REMARKABLE SERVICE BY THE CULINARY INSTITUTE OF AMERICA (CIA) PDF

MANGO PERFORMANCE BENCHMARK REPORT

CITY OF EL PASO DE ROBLES

Ruth: From Bitter To Sweet (Welwyn Commentary) (Welwyn Commentaries) By John Currid

December 7, Dear Lectors: Please find enclosed the lector schedule for the period: January 1st through April 1st (Easter Sunday).

Celebrate footy finals with these specials! ctn SAVE UP TO $10. ctn. CORONA STUB 24x355ML BONUS

The Bread Ovens. of Quebec. To Paul and Rachelle Carpentier

OPEN 24 HOURS. We are licensed to sell alcohol until 4am. Potato Wedges Add a smothering of cheese sauce & bacon bits Garlic Roll Add cheddar cheese

Corona del Mar Chamber of Commerce presents the 35th Annual. Corona del Mar Scenic 5K. June 3, 2017 RESTAURANT ROW

ambush paparazzi The Club Scene ~ New Orleans, Metairie ~ Photos by Charles Jenkins, Tony Leggio, Paul Melancon, Darwin Reed

Database Systems CSE 414. Lecture 7: SQL Wrap-up

Phone: Mobile: Web:

VITICULTURE & ENOLOGY SCHOLARSHIP APPLICATION & INSTRUCTIONS

Served until 2pm daily. EGGS YOUR WAY $7.95 Two eggs plus bacon or sausage patties, breakfast potatoes and toast

Eucharistic Ministers and Lectors Jun 1 - Jul 1

Summary: The 4-Hour Workweek: Escape 9-5, Live Anywhere, And Join The New Rich By Timothy Ferriss By Billionaire Mind Publishing, 30 Minutes Flip

Staples High School: MARCH 2017

Abacus. Antoni s Italian Café. Azteca s Mexican Cuisine. Bailey s Seafood & Grill. BJ s Pizza & Deli. Blu Basil Wine & Grill.

THE 900 DAYS - THE SIEGE OF LENINGRAD "SALISBURY BY HARRISON E." 14.8

Welcome to Silks Restaurant at Bulle Rock!

Analyses of HQCF quality at NRI in Aurelie Bechoff & Louise Abayomi

Healthy Menu Choices Act, 2015 Application of the Act in Restaurants. What is a standard food item? Where must calories be displayed?

Frogs Into Princes: Neuro Linguistic Programming By John Grinder, Richard Bandler READ ONLINE

BILLINGS NEW LICENSE License No TOWN AND COUNTRY SUPPLY BRIDGER, 209 North Main Street, Bridger, Carbon County, Montana.

LYNX GAS GRILL REPLACEMENT PARTS E- BOOK

Monster Stuffed Shrimp 3 1/2 oz. ($5.29 Each) Crab wrapped around a wild, steamed shrimp in a mild Imperial sauce. Lightly breaded.

SCI International Slalom

Brazos Bottom Newsletter

Chattanooga, TN; 7:30 AM 6/3/2017; Weather: 70 F Clear ********** AWARDS LIST ************** ********** MALE OVERALL WINNER ***********

LiveTiles CSP Partner Program Guide. Version: 1.0

Chesapeake Bay Seafoods Industries Association (CBSIA)

Pepper Research for Adaptation to the Delmarva Region 2017

The Mexican Slow Cooker: Recipes For Mole, Enchiladas, Carnitas, Chile Verde Pork, And More Favorites By Deborah Schneider READ ONLINE

September 5, Dear Lectors: Please find enclosed the lector schedule for the period: October 1st through December 31st, 2018.

Receptions. Stationed & Passed Hors D Oeuvres

School Grown Harvest Guide

Public Oyster Shoal Survey - Spring 1992

PURE ROCK & ROLL EASY REGENERATION. tips. step by step ROCK & ROLL

Group Brewer Co-Brewer Rank Club BOS Benjamin Mosher Santiago Rubino BOS Strong Bitter Bay Area Mashers Light Lager Benjamin Mosher Santiago Rubino 1


NOVEMBER Office November is

PLENTY TO SHARE HAND CRAFTED $3.99 /$5.99

O N E S YO U L L E AT! LESSON 2 & FRUITS ARE THE

2011 Isabella s Blanc de Blanc Sparkling 15 60

m-neat Section Worksheets Fast Food Restaurant

2017 Trophy Winners - Manchester

Duncan Hines Complete Cake Mix Magic By Jill Snider

ACT Amateur Brewing Championships Full Results

Caloundra Golf Club. Function PACKAGES

Publicity Report - Premium Placing Standard

German Chocolate Cake & Other Baking Recipes [Kindle Edition] By Nicole Spohn

Transcription:

1. [10pts] Return the end- to- end (i.e., start to finish) processing time of the last order added (the one with id:21). SELECT TIMEDIFF(O2.order_status_datetime, O1.order_status_datetime) AS duration FROM Orders_track_status O1, Orders_track_status O2 WHERE O1.oid=21 AND O2.oid=21 AND O1.order_status_code=1 AND O2.order_status_code=4; duration NULL 2. [10pts] Return the restaurant id and the name of each restaurant along with the number of dishes that it serves. SELECT r.id, r.name, COUNT(*) FROM Restaurants r, Dishes d WHERE r.rid = d.rid GROUP BY d.rid; rid name COUNT(*) 1 Pat Urban Seoul 3 2 Dan Urban Plates 3 3 Ken Fish Grill 3 4 Ric Miyabi Shabu Shabu Grill 3 5 Sar Tang 190 3 6 Ann Falasophy 3 7 Nat Sandwich Plus 3 8 Rom Del Sushi 3 9 Kri Dhaba 3 10 Nor Kingchops 3 3. [10pts] For those orders where a customer ordered at least three different dishes in a single order transaction, return the order id, the name of each dish, and the cost associated with that dish (i.e., price * quantity) in the order. SELECT o.oid, oc.name, SUM(d.price * quantity) AS dishcost FROM Orders_Contain_Dishes OC, Orders O, Dishes D WHERE d.rid = oc.rid AND d.name = oc.name AND oc.oid = o.oid GROUP BY oid, name HAVING oid IN (SELECT oid FROM Orders_Contain_Dishes GROUP BY oid HAVING COUNT(*) > 2); oid name dishcost 4 fresh lemonade 25.98 4 sandwich 33.98 1

4 the thai wrap 26 8 hummus 139.9 8 the burger combo 164.95 8 the karma burger 54 12 salmon 260 12 skewered shrimp 219.8 12 swordfish 230 4. [10pts] Find the ids and ratings of restaurants whose average rating is greater than the overall average rating (i.e., for above average restaurants). SELECT rid, AVG(rating) FROM Customers_review GROUP BY rid HAVING AVG(rating) >= (SELECT AVG(rating) FROM Customers_review); Rid avgrating 2 3.1667 4 5.0000 5 5.0000 7 5.0000 8 4.0000 10 4.0000 5. [15pts] Return the customer nicknames along with order ids and total amounts for all orders placed by customers. Include all customers in the result, even customers that have placed no orders. Sort the final result by customer nickname. SELECT c.nickname, o.oid, o.total_amount FROM Customers c LEFT JOIN Orders o ON c.cid = o.cid ORDER BY c.nickname; nickname oid total_amount Alien Leader 3 96.5 Alien Leader 6 62.5 Blimey Billy Blackstroker NULL NULL Bloody Lena Stoker NULL NULL Brutus Pale Klek 19 32.5 Dana Hawkins 9 59.95 El Agent NULL NULL Elastic Mustard NULL NULL Forsaken Captain 1 22.5 Forsaken Captain 4 85.96 Forsaken Captain 11 173.94 Forsaken Captain 12 709.8 2

Forsaken Captain 13 1199.5 Forsaken Captain 14 569.88 Forsaken Captain 15 129.9 Forsaken Captain 16 41.97 Forsaken Captain 17 315 Forsaken Captain 18 2913 Forsaken Captain 20 210 Gargoyle Bad 2 115 Gargoyle Bad 5 153.97 Gold Jacob Silverbeard NULL NULL Gold Kala Fargloom 10 1379.7 Heavy Major 7 22.5 Joe Harker NULL NULL Mars Lieutenant NULL NULL Nana Deadwood 8 358.85 Poseidon Arrow NULL NULL Stony Prince NULL NULL The Brave Boy NULL NULL The Gladiator NULL NULL The Oyster NULL NULL 6. [15pts] Return the restaurant ids, restaurant names, reviewer names, and ratings that each restaurant has received. The id and the name of each restaurant should be returned even if no customer has rated that restaurant yet. Sort the results by restaurant name. SELECT r.rid, r.name AS restaurant_name, u.name AS customer_name, cr.rating FROM Restaurants r LEFT JOIN Customers_review cr ON r.rid = cr.rid LEFT JOIN Users u ON cr.cid = u.id ORDER BY r.name; rid restaurant_name customer_name rating 6 Ann Falasophy Joyce J. Rayo 1 6 Ann Falasophy Timothy A. German 2 2 Dan Urban Plates Patrick M. Tyler 1 2 Dan Urban Plates Kenneth B. Knight 4 2 Dan Urban Plates Joyce J. Rayo 2 2 Dan Urban Plates Sophia D. Williams 3 2 Dan Urban Plates Michael R. Deane 4 2 Dan Urban Plates Raul A. Dicarlo 5 3 Ken Fish Grill Patrick M. Tyler 3 3 Ken Fish Grill Danny C. Malveaux 1 3 Ken Fish Grill Kenneth B. Knight 1 3

9 Kri Dhaba NULL NULL 7 Nat Sandwich Plus Sophia D. Williams 5 10 Nor Kingchops Raul A. Dicarlo 4 1 Pat Urban Seoul Patrick M. Tyler 4 1 Pat Urban Seoul Anne M. Gurley 1 4 Ric Miyabi Shabu Shabu Grill James K. McGaha 5 8 Rom Del Sushi Michael R. Deane 4 5 Sar Tang 190 Patrick M. Tyler 5 5 Sar Tang 190 Raul A. Dicarlo 5 7. [15pts] Return the restaurant ids, restaurant names, number of ratings, lowest rating, highest rating, and average rating that each restaurant has received. The id and the name of each restaurant should be returned even if there are no ratings yet from a customer for that restaurant. Sort the results by the restaurant name. SELECT r.rid, r.name, COUNT(cr.rating), min(cr.rating), max(cr.rating), AVG(cr.rating) FROM Restaurants r LEFT JOIN Customers_review cr ON r.rid = cr.rid GROUP BY r.rid ORDER BY r.name; rid name COUNT(cr.rating) min(cr.rating) max(cr.rating) AVG(cr.rating) 6 Ann Falasophy 2 1 2 1.5 2 Dan Urban Plates 6 1 5 3.1667 3 Ken Fish Grill 3 1 3 1.6667 9 Kri Dhaba 0 NULL NULL NULL 7 Nat Sandwich Plus 1 5 5 5 10 Nor Kingchops 1 4 4 4 1 Pat Urban Seoul 2 1 4 2.5 Ric Miyabi Shabu Shabu 4 Grill 1 5 5 5 8 Rom Del Sushi 1 4 4 4 5 Sar Tang 190 2 5 5 5 8. [15pts] Show whether each user is a driver, a customer, or both by presenting their id, name, and two additional labeled fields. In the first labeled field, if a given user is a customer, put Customer. If not, leave it NULL. In the second labeled field, if the user is a driver, put Driver. If not, leave it NULL. (E.g., an output row might look like this: 1, Patrick M. Tyler, Customer, Driver.) Hint: In order to do this last query, you may want to have a look at the CASE expression in MySQL s online documentation. SELECT id, name, (CASE WHEN cid IS NOT NULL THEN "Customer" ELSE NULL END) AS ISCustomer, (CASE WHEN did IS NOT NULL THEN "Driver" ELSE NULL END) AS ISDriver FROM Users U LEFT JOIN Customers C ON U.id=C.cid LEFT JOIN Drivers D ON U.id=D.did; 4

id name ISCustomer ISDriver 1 Patrick M. Tyler Customer Driver 2 Danny C. Malveaux Customer Driver 3 Kenneth B. Knight Customer Driver 4 Richard A. Delvalle Customer Driver 5 Gladys B. Hopper Customer Driver 6 Sara T. Wilson Customer Driver 7 Charles M. Gunter Customer Driver 8 Michelle L. Nye Customer Driver 9 Joseph A. Obrien Customer Driver 10 James M. Schwan Customer Driver 11 Kristy H. Hilliard NULL Driver 12 Joyce J. Rayo Customer NULL 13 Roy T. Herbert NULL Driver 14 Sophia D. Williams Customer NULL 15 Timothy M. Wilhelm NULL Driver 16 Michael R. Deane Customer NULL 17 Guadalupe C. Necaise NULL Driver 18 Raul A. Dicarlo Customer NULL 19 Kendrick S. Craig NULL Driver 20 Timothy A. German Customer NULL 21 Kathleen T. Shelly NULL Driver 22 Joel A. Lozano Customer NULL 23 Jeffrey C. Shields NULL Driver 24 Nora W. Hardy Customer NULL 25 Rolando K. Smith NULL Driver 26 James K. McGaha Customer NULL 27 Elizabeth S. Bongiorno NULL Driver 28 Anne M. Gurley Customer NULL 29 Janet A. Ricker NULL Driver 30 Nathan M. Schneider Customer NULL 5