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
List all users who reviewed businesses that are restaurant in 2010 .
assistant
SELECT t4.name FROM category AS t2 JOIN business AS t1 ON t2.business_id = t1.business_id JOIN review AS t3 ON t3.business_id = t1.business_id JOIN USER AS t4 ON t4.user_id = t3.user_id WHERE t2.category_name = 'restaurant' AND t3.year = 2010;
human
List all users who reviewed businesses that are restaurant .
assistant
SELECT t4.name FROM category AS t2 JOIN business AS t1 ON t2.business_id = t1.business_id JOIN review AS t3 ON t3.business_id = t1.business_id JOIN USER AS t4 ON t4.user_id = t3.user_id WHERE t2.category_name = 'restaurant';
human
What is the number of checkins for ' Cafe Zinho ' on Friday
assistant
SELECT t2.count FROM checkin AS t2 JOIN business AS t1 ON t2.business_id = t1.business_id WHERE t1.name = 'Cafe Zinho' AND t2.day = 'Friday';
human
Find all tips for ' Cafe Zinho ' in Texas .
assistant
SELECT t2.text FROM tip AS t2 JOIN business AS t1 ON t2.business_id = t1.business_id WHERE t1.name = 'Cafe Zinho' AND t1.state = 'Texas';
human
How many people reviewed the restaurant ' Texas de Brazil ' in Dallas Texas ?
assistant
SELECT COUNT ( DISTINCT t4.name ) FROM category AS t2 JOIN business AS t1 ON t2.business_id = t1.business_id JOIN review AS t3 ON t3.business_id = t1.business_id JOIN USER AS t4 ON t4.user_id = t3.user_id WHERE t1.city = 'Dallas' AND t1.name = 'Texas de Brazil' AND t1.state = 'Texas' AND t2.category_name = 'restaurant';
human
find the number of reviews written for ' Cafe Zinho ' restaurant in Texas
assistant
SELECT COUNT( DISTINCT t3.text ) FROM category AS t2 JOIN business AS t1 ON t2.business_id = t1.business_id JOIN review AS t3 ON t3.business_id = t1.business_id WHERE t1.name = "Cafe Zinho" AND t1.state = "Texas" AND t2.category_name = "restaurant" ;