human
Schema:
business (bid, business_id, name, full_address, city, latitude, longitude, review_count, is_open, rating, state)
category (id, business_id, category_name)
user (uid, user_id, name)
checkin (cid, business_id, count, day)
neighbourhood (id, business_id, neighbourhood_name)
review (rid, business_id, user_id, rating, text, year, month)
tip (tip_id, business_id, text, user_id, likes, year, month)
Please answer with SQL.
assistant
Sure, I understand.
human
Find all Dallas restaurant with a rating above 4.5
assistant
SELECT t1.name FROM category AS t2 JOIN business AS t1 ON t2.business_id = t1.business_id WHERE t1.city = 'Dallas' AND t1.rating > 4.5 AND t2.category_name = 'restaurant';
human
How many Starbucks are there in Dallas Texas ?
assistant
SELECT COUNT ( DISTINCT business_id ) FROM business WHERE city = 'Dallas' AND name = 'Starbucks' AND state = 'Texas';
human
Find the total checkins in ' Brighton Heights ' neighbourhood
assistant
SELECT SUM ( t3.count ) FROM checkin AS t3 JOIN business AS t1 ON t3.business_id = t1.business_id JOIN neighbourhood AS t2 ON t2.business_id = t1.business_id WHERE t2.neighbourhood_name = 'Brighton Heights';
human
Return me the number of businesses that are restaurant .
assistant
SELECT COUNT ( DISTINCT t1.name ) FROM category AS t2 JOIN business AS t1 ON t2.business_id = t1.business_id WHERE t2.category_name = 'restaurant';
human
Find the cities of businesses rated below 1.5
assistant
SELECT city FROM business WHERE rating < 1.5;
human
Return me the number of cities that has ' Panda Express ' .
assistant
SELECT COUNT( DISTINCT city ) FROM business WHERE name = "Panda Express" ;