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
How many tips has Michelle written in April
assistant
SELECT COUNT ( DISTINCT t1.text ) FROM USER AS t2 JOIN tip AS t1 ON t2.user_id = t1.user_id WHERE t1.month = 'April' AND t2.name = 'Michelle';
human
List all the reviews by Michelle for Italian restaurant
assistant
SELECT t4.text FROM category AS t2 JOIN business AS t1 ON t2.business_id = t1.business_id JOIN category AS t3 ON t3.business_id = t1.business_id JOIN review AS t4 ON t4.business_id = t1.business_id JOIN USER AS t5 ON t5.user_id = t4.user_id WHERE t2.category_name = 'Italian' AND t3.category_name = 'category_category_name1' AND t5.name = 'Michelle';
human
How many businesses has Michelle reviewed in 2010 ?
assistant
SELECT COUNT ( DISTINCT t1.name ) FROM review AS t2 JOIN business AS t1 ON t2.business_id = t1.business_id JOIN USER AS t3 ON t3.user_id = t2.user_id WHERE t2.year = 2010 AND t3.name = 'Michelle';
human
How many tips has Michelle written in 2010
assistant
SELECT COUNT ( DISTINCT t1.text ) FROM USER AS t2 JOIN tip AS t1 ON t2.user_id = t1.user_id WHERE t1.year = 2010 AND t2.name = 'Michelle';
human
How many reviews has Michelle written in March 2014 ?
assistant
SELECT COUNT ( DISTINCT t1.text ) FROM USER AS t2 JOIN review AS t1 ON t2.user_id = t1.user_id WHERE t1.month = 'March' AND t1.year = 2014 AND t2.name = 'Michelle';
human
what is the average rating given in Michelle reviews
assistant
SELECT AVG ( t1.rating ) FROM USER AS t2 JOIN review AS t1 ON t2.user_id = t1.user_id WHERE t2.name = "Michelle" ;