Schema:
CREATE TABLE "business" (
"bid" int,
"business_id" text,
"name" text,
"full_address" text,
"city" text,
"latitude" text,
"longitude" text,
"review_count" int,
"is_open" int,
"rating" real,
"state" text,
primary key("bid")
);
CREATE TABLE "category" (
"id" int,
"business_id" text,
"category_name" text,
primary key("id"),
foreign key("business_id") references `business`("business_id")
);
CREATE TABLE "user" (
"uid" int,
"user_id" text,
"name" text,
primary key("uid")
);
CREATE TABLE "checkin" (
"cid" int,
"business_id" text,
"count" int,
"day" text,
primary key("cid"),
foreign key("business_id") references `business`("business_id")
);
CREATE TABLE "neighbourhood" (
"id" int,
"business_id" text,
"neighbourhood_name" text,
primary key("id"),
foreign key("business_id") references `business`("business_id")
);
CREATE TABLE "review" (
"rid" int,
"business_id" text,
"user_id" text,
"rating" real,
"text" text,
"year" int,
"month" text,
primary key("rid"),
foreign key("business_id") references `business`("business_id"),
foreign key("user_id") references `user`("user_id")
);
CREATE TABLE "tip" (
"tip_id" int,
"business_id" text,
"text" text,
"user_id" text,
"likes" int,
"year" int,
"month" text,
primary key("tip_id")
foreign key("business_id") references `business`("business_id"),
foreign key("user_id") references `user`("user_id")

);

Question: List all the businesses with more than 4.5 stars
SQL:
SELECT name FROM business WHERE rating  >  4.5;

Question: List all businesses with rating 3.5
SQL:
SELECT name FROM business WHERE rating  =  3.5;

Question: List all user ids with name Michelle
SQL:
SELECT user_id FROM USER WHERE name  =  "Michelle";

Question: Find all states in which there is a Whataburger
SQL:
SELECT state FROM business WHERE name  =  "Whataburger";

Question: Find all cities in which there is a restaurant called " MGM Grand Buffet "
SQL:
SELECT t1.city FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.name  =  "MGM Grand Buffet" AND t2.category_name  =  "category_category_name0";

Question: Find the cities of businesses rated below 1.5
SQL:
SELECT city FROM business WHERE rating  <  1.5;

Question: Find all cities which has a " Taj Mahal " .
SQL:
SELECT city FROM business WHERE name  =  "Taj Mahal";

Question: List all the reviews which rated a business less than 1
SQL:
SELECT text FROM review WHERE rating  <  1;

Question: List all the restaurant rated more than 3.5
SQL:
SELECT t1.name FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.rating  >  3.5 AND t2.category_name  =  "restaurant";

Question: find all cities which has a " Taj Mahal " restaurant
SQL:
SELECT t1.city FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.name  =  "Taj Mahal" AND t2.category_name  =  "restaurant";

Question: list all the reviews by Niloofar
SQL:
SELECT t1.text FROM USER AS t2 JOIN review AS t1 ON t2.user_id  =  t1.user_id WHERE t2.name  =  "Niloofar";

Question: list all the businesses which have a review by Niloofar
SQL:
SELECT 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 t3.name  =  "Niloofar";

Question: list all the businesses which Niloofar rated 5
SQL:
SELECT 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.rating  =  5 AND t3.name  =  "Niloofar";

Question: List all the reviews by Michelle for Italian restaurant
SQL:
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";

Question: find the number of reviews written for " Cafe Zinho " restaurant in Texas
SQL:
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";

Question: List all 5 star Italian restaurant
SQL:
SELECT t1.name 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 WHERE t1.rating  =  5 AND t2.category_name  =  "Italian" AND t3.category_name  =  "restaurant";

Question: List all the neighbourhoods with Italian restaurant in Madison
SQL:
SELECT t1.neighbourhood_name FROM category AS t3 JOIN business AS t2 ON t3.business_id  =  t2.business_id JOIN category AS t4 ON t4.business_id  =  t2.business_id JOIN neighbourhood AS t1 ON t1.business_id  =  t2.business_id WHERE t2.city  =  "Madison" AND t3.category_name  =  "Italian" AND t4.category_name  =  "restaurant";

Question: List all the neighbourhoods with Italian restaurant rated less than 2.5 in Madison
SQL:
SELECT t1.neighbourhood_name FROM category AS t3 JOIN business AS t2 ON t3.business_id  =  t2.business_id JOIN category AS t4 ON t4.business_id  =  t2.business_id JOIN neighbourhood AS t1 ON t1.business_id  =  t2.business_id WHERE t2.city  =  "Madison" AND t2.rating  <  2.5 AND t3.category_name  =  "Italian" AND t4.category_name  =  "restaurant";

Question: find all the restaurant in Pennsylvania
SQL:
SELECT t1.name FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.state  =  "Pennsylvania" AND t2.category_name  =  "restaurant";

Question: List all businesses that are restaurant in Pennsylvania .
SQL:
SELECT t1.name FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.state  =  "Pennsylvania" AND t2.category_name  =  "restaurant";

Question: Find all the reviews for all Pet Groomers with more than 100 reviews
SQL:
SELECT 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.review_count  >  100 AND t2.category_name  =  "Pet Groomers";

Question: What are all the breweries in " Los Angeles " ?
SQL:
SELECT t1.name FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.city  =  "Los Angeles" AND t2.category_name  =  "breweries";

Question: Find all breweries in Los Angeles
SQL:
SELECT t1.name FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.city  =  "Los Angeles" AND t2.category_name  =  "breweries";

Question: Find all breweries in " Los Angeles "
SQL:
SELECT t1.name FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.city  =  "Los Angeles" AND t2.category_name  =  "breweries";

Question: Find all users who reviewed restaurant " Mesa Grill "
SQL:
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 t1.name  =  "Mesa Grill" AND t2.category_name  =  "restaurant";

Question: List the addresses of all Walmart in " Los Angeles "
SQL:
SELECT full_address FROM business WHERE city  =  "Los Angeles" AND name  =  "Walmart";

Question: Find all restaurant reviewed by Patrick in " Dallas "
SQL:
SELECT t1.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 t2.category_name  =  "restaurant" AND t4.name  =  "Patrick";

Question: Which restaurant in Dallas were reviewed by user Patrick ?
SQL:
SELECT t1.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 t2.category_name  =  "restaurant" AND t4.name  =  "Patrick";

Question: Find all Bars reviewed by Patrick
SQL:
SELECT t1.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  =  "Bars" AND t4.name  =  "Patrick";

Question: Find all Bars reviewed by Patrick with at least 3 stars
SQL:
SELECT t1.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.rating  >=  3 AND t2.category_name  =  "Bars" AND t4.name  =  "Patrick";

Question: Find all users who have written tips for " Barrio Cafe " in 2015
SQL:
SELECT t3.name FROM tip 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 t1.name  =  "Barrio Cafe" AND t2.year  =  2015;

Question: Find all businesses in Texas with a rating below 2
SQL:
SELECT name FROM business WHERE rating  <  2 AND state  =  "Texas";

Question: Find all restaurant Seafood in Los Angeles
SQL:
SELECT t1.name 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 WHERE t1.city  =  "Los Angeles" AND t2.category_name  =  "Seafood" AND t3.category_name  =  "restaurant";

Question: List all the Seafood restaurant in " Los Angeles "
SQL:
SELECT t1.name 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 WHERE t1.city  =  "Los Angeles" AND t2.category_name  =  "Seafood" AND t3.category_name  =  "restaurant";

Question: Find all restaurant that serve Seafood in " Los Angeles "
SQL:
SELECT t1.name 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 WHERE t1.city  =  "Los Angeles" AND t2.category_name  =  "Seafood" AND t3.category_name  =  "restaurant";

Question: Find all reviews by Patrick with a rating above 4
SQL:
SELECT t1.text FROM USER AS t2 JOIN review AS t1 ON t2.user_id  =  t1.user_id WHERE t1.rating  >  4 AND t2.name  =  "Patrick";

Question: Find all Apple Store in " Los Angeles "
SQL:
SELECT business_id FROM business WHERE city  =  "Los Angeles" AND name  =  "Apple Store";

Question: Find all Dallas restaurant with a rating above 4.5
SQL:
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";

Question: What neighbourhood is restaurant " Flat Top Grill " in ?
SQL:
SELECT t1.neighbourhood_name FROM category AS t3 JOIN business AS t2 ON t3.business_id  =  t2.business_id JOIN neighbourhood AS t1 ON t1.business_id  =  t2.business_id WHERE t2.name  =  "Flat Top Grill" AND t3.category_name  =  "category_category_name0";

Question: Find all tips about " Vintner Grill " that received more than 9 likes
SQL:
SELECT t2.text FROM tip AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.name  =  "Vintner Grill" AND t2.likes  >  9;

Question: Find all reviews about " Kabob Palace " in year 2014
SQL:
SELECT t2.text FROM review AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.name  =  "Kabob Palace" AND t2.year  =  2014;

Question: Find all users who have written tips about businesses in Dallas
SQL:
SELECT t3.name FROM tip 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 t1.city  =  "Dallas";

Question: Find all cities in Texas in which there is a restaurant called " MGM Grand Buffet "
SQL:
SELECT t1.city FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.name  =  "MGM Grand Buffet" AND t1.state  =  "Texas" AND t2.category_name  =  "restaurant";

Question: Find the users who have given tips on Pet Groomers
SQL:
SELECT t4.name FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id JOIN tip AS t3 ON t3.business_id  =  t1.business_id JOIN USER AS t4 ON t4.user_id  =  t3.user_id WHERE t2.category_name  =  "Pet Groomers";

Question: Find all tips for " Cafe Zinho " in Texas .
SQL:
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";

Question: List all users who reviewed businesses that are restaurant .
SQL:
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";

Question: List all tips for " Cafe Zinho " in Pennsylvania in 2010 .
SQL:
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  =  "Pennsylvania" AND t2.year  =  2010;

Question: List all users who reviewed businesses that are restaurant in 2010 .
SQL:
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;

Question: Find all the tips from a user who has written a review in 2012
SQL:
SELECT t2.text FROM USER AS t3 JOIN review AS t1 ON t3.user_id  =  t1.user_id JOIN tip AS t2 ON t3.user_id  =  t2.user_id WHERE t1.year  =  2012;

Question: Find all reviews for businesses rated 2.5
SQL:
SELECT t2.text FROM review AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.rating  =  2.5;

Question: find the number of escape games in Madison
SQL:
SELECT COUNT ( DISTINCT t1.name ) FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.city  =  "Madison" AND t2.category_name  =  "escape games";

Question: What is the number of escape games in Madison
SQL:
SELECT COUNT ( DISTINCT t1.name ) FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.city  =  "Madison" AND t2.category_name  =  "escape games";

Question: How many escape games exist in Madison
SQL:
SELECT COUNT ( DISTINCT t1.name ) FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.city  =  "Madison" AND t2.category_name  =  "escape games";

Question: What is the number of escape games in " Madison " ?
SQL:
SELECT COUNT ( DISTINCT t1.name ) FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.city  =  "Madison" AND t2.category_name  =  "escape games";

Question: How many escape games are there in Madison ?
SQL:
SELECT COUNT ( DISTINCT t1.name ) FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.city  =  "Madison" AND t2.category_name  =  "escape games";

Question: find the number of restaurant rated more than 3.5
SQL:
SELECT COUNT ( DISTINCT t1.name ) FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.rating  >  3.5 AND t2.category_name  =  "restaurant";

Question: find the total checkins in Moroccan restaurant in " Los Angeles "
SQL:
SELECT SUM ( t4.count ) 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 checkin AS t4 ON t4.business_id  =  t1.business_id WHERE t1.city  =  "Los Angeles" AND t2.category_name  =  "restaurant" AND t3.category_name  =  "Moroccan";

Question: find the total checkins in Moroccan restaurant in " Los Angeles " on Friday
SQL:
SELECT SUM ( t4.count ) 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 checkin AS t4 ON t4.business_id  =  t1.business_id WHERE t1.city  =  "Los Angeles" AND t2.category_name  =  "Moroccan" AND t3.category_name  =  "restaurant" AND t4.day  =  "Friday";

Question: find the total checkins in Moroccan restaurant in " Los Angeles " per day
SQL:
SELECT t4.day  ,  SUM ( t4.count ) 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 checkin AS t4 ON t4.business_id  =  t1.business_id WHERE t1.city  =  "Los Angeles" AND t2.category_name  =  "Moroccan" AND t3.category_name  =  "restaurant" GROUP BY t4.day;

Question: find the total checkins in Italian Delis in each state on Sunday
SQL:
SELECT t1.state  ,  SUM ( t4.count ) 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 checkin AS t4 ON t4.business_id  =  t1.business_id WHERE t2.category_name  =  "Italian" AND t3.category_name  =  "Delis" AND t4.day  =  "Sunday" GROUP BY t1.state;

Question: How many reviews has Niloofar written in 2015
SQL:
SELECT COUNT ( DISTINCT t1.text ) FROM USER AS t2 JOIN review AS t1 ON t2.user_id  =  t1.user_id WHERE t1.year  =  2015 AND t2.name  =  "Niloofar";

Question: what is the average rating given in Michelle reviews
SQL:
SELECT AVG ( t1.rating ) FROM USER AS t2 JOIN review AS t1 ON t2.user_id  =  t1.user_id WHERE t2.name  =  "Michelle";

Question: What is the number of checkins for " Cafe Zinho " on Friday
SQL:
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";

Question: how many users reviewed " Sushi Too " in Pittsburgh
SQL:
SELECT COUNT ( DISTINCT t3.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 t1.city  =  "Pittsburgh" AND t1.name  =  "Sushi Too";

Question: What is the number of restaurant in Pittsburgh rated 4.5
SQL:
SELECT COUNT ( DISTINCT t1.name ) FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.city  =  "Pittsburgh" AND t1.rating  =  4.5 AND t2.category_name  =  "restaurant";

Question: How many tips have been written in 2015
SQL:
SELECT COUNT ( DISTINCT text ) FROM tip WHERE YEAR  =  2015;

Question: What is the total likes on tips from Niloofar
SQL:
SELECT SUM ( t1.likes ) FROM USER AS t2 JOIN tip AS t1 ON t2.user_id  =  t1.user_id WHERE t2.name  =  "Niloofar";

Question: What is the total likes on tips about " Cafe Zinho "
SQL:
SELECT SUM ( t2.likes ) FROM tip AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.name  =  "Cafe Zinho";

Question: What is the total likes on tips from Niloofar about " Cafe Zinho "
SQL:
SELECT SUM ( t2.likes ) FROM tip 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 t1.name  =  "Cafe Zinho" AND t3.name  =  "Niloofar";

Question: How many tips has Michelle written in 2010
SQL:
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";

Question: Return me the number of tips that are written by Michelle in 2010 .
SQL:
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";

Question: How many tips has Michelle written in April
SQL:
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";

Question: what is the number of restaurant in Texas
SQL:
SELECT COUNT ( DISTINCT t1.name ) FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.state  =  "Texas" AND t2.category_name  =  "restaurant";

Question: How many Bars in " Dallas " have a rating above 3.5 ?
SQL:
SELECT COUNT ( DISTINCT t1.name ) FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.city  =  "Dallas" AND t1.rating  >  3.5 AND t2.category_name  =  "Bars";

Question: How many Bars in Dallas have a rating above 3.5 ?
SQL:
SELECT COUNT ( DISTINCT t1.name ) FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.city  =  "Dallas" AND t1.rating  >  3.5 AND t2.category_name  =  "Bars";

Question: How many people reviewed the restaurant " Texas de Brazil " in Dallas Texas ?
SQL:
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";

Question: How many people reviewed " Bistro Di Napoli " in 2015 ?
SQL:
SELECT COUNT ( DISTINCT t3.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 t1.name  =  "Bistro Di Napoli" AND t2.year  =  2015;

Question: How many restaurant are there in the Hazelwood district of Dallas ?
SQL:
SELECT COUNT ( DISTINCT t1.name ) FROM category 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 t1.city  =  "Dallas" AND t3.category_name  =  "restaurant" AND t2.neighbourhood_name  =  "Hazelwood";

Question: How many Starbucks are there in Dallas Texas ?
SQL:
SELECT COUNT ( DISTINCT business_id ) FROM business WHERE city  =  "Dallas" AND name  =  "Starbucks" AND state  =  "Texas";

Question: How many reviews does " Acacia Cafe " have ?
SQL:
SELECT review_count FROM business WHERE name  =  "Acacia Cafe";

Question: Find the average number of checkins in restaurant " Barrio Cafe " per day
SQL:
SELECT AVG ( t3.count )  ,  t3.day FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id JOIN checkin AS t3 ON t3.business_id  =  t1.business_id WHERE t1.name  =  "Barrio Cafe" AND t2.category_name  =  "restaurant" GROUP BY t3.day;

Question: How many businesses are there in the " Stone Meadows " neighbourhood in Madison ?
SQL:
SELECT COUNT ( DISTINCT t1.name ) FROM neighbourhood AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.city  =  "Madison" AND t2.neighbourhood_name  =  "Stone Meadows";

Question: How many reviews has Adrienne written ?
SQL:
SELECT COUNT ( DISTINCT t1.text ) FROM USER AS t2 JOIN review AS t1 ON t2.user_id  =  t1.user_id WHERE t2.name  =  "Adrienne";

Question: How many reviews has Michelle written in March 2014 ?
SQL:
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";

Question: How many businesses has Michelle reviewed in 2010 ?
SQL:
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";

Question: How many businesses in " San Diego " has Christine reviewed in 2010 ?
SQL:
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 t1.city  =  "San Diego" AND t2.year  =  2010 AND t3.name  =  "Christine";

Question: How many Target are there in " Los Angeles " ?
SQL:
SELECT COUNT ( DISTINCT business_id ) FROM business WHERE city  =  "Los Angeles" AND name  =  "Target";

Question: How many users have reviewed Irish Pub in Dallas ?
SQL:
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 t2.category_name  =  "Irish Pub";

Question: What is the average rating of reviews written in year 2014 ?
SQL:
SELECT AVG ( rating ) FROM review WHERE YEAR  =  2014;

Question: How many people reviewed restaurant " Vintner Grill " in 2010 ?
SQL:
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.name  =  "Vintner Grill" AND t2.category_name  =  "category_category_name0" AND t3.year  =  2010;

Question: Find the number of reviews on businesses located in " South Summerlin " neighbourhood
SQL:
SELECT COUNT ( DISTINCT t3.text ) FROM neighbourhood AS t1 JOIN business AS t2 ON t1.business_id  =  t2.business_id JOIN review AS t3 ON t3.business_id  =  t2.business_id WHERE t1.neighbourhood_name  =  "South Summerlin";

Question: Find the number of users called Michelle
SQL:
SELECT COUNT ( DISTINCT name ) FROM USER WHERE name  =  "Michelle";

Question: Return me the number of businesses that are restaurant .
SQL:
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";

Question: Return me the number of cities that has " Panda Express " .
SQL:
SELECT COUNT ( DISTINCT city ) FROM business WHERE name  =  "Panda Express";

Question: Return me the number of tips that are written by Michelle .
SQL:
SELECT COUNT ( DISTINCT t1.text ) FROM USER AS t2 JOIN tip AS t1 ON t2.user_id  =  t1.user_id WHERE t2.name  =  "Michelle";

Question: Find the total checkins in " Brighton Heights " neighbourhood
SQL:
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";

Question: Find the total number of reviews written in March
SQL:
SELECT COUNT ( DISTINCT text ) FROM review WHERE MONTH  =  "March";

Question: Find the number of tips written in each month
SQL:
SELECT COUNT ( DISTINCT text )  ,  MONTH FROM tip GROUP BY MONTH;

Question: How many neighbourhoods have a business with rating 5 in Madison ?
SQL:
SELECT COUNT ( DISTINCT t1.neighbourhood_name ) FROM neighbourhood AS t1 JOIN business AS t2 ON t1.business_id  =  t2.business_id WHERE t2.city  =  "Madison" AND t2.rating  =  5;

Question: Give me all the Moroccan restaurant in Texas
SQL:
SELECT t1.name 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 WHERE t1.state  =  "Texas" AND t2.category_name  =  "Moroccan" AND t3.category_name  =  "restaurant";

Question: which business has the most number of checkins
SQL:
SELECT t1.name FROM checkin AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id GROUP BY t1.name ORDER BY SUM ( t2.count ) DESC LIMIT 1;

Question: which neighbourhood has the most number of businesses in Madison
SQL:
SELECT t1.neighbourhood_name FROM neighbourhood AS t1 JOIN business AS t2 ON t1.business_id  =  t2.business_id WHERE t2.city  =  "Madison" GROUP BY t1.neighbourhood_name ORDER BY COUNT ( DISTINCT t2.name ) DESC LIMIT 1;

Question: Find all Mexican restaurant in Dallas with at least 3.5 stars
SQL:
SELECT t1.name 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 WHERE t1.city  =  "Dallas" AND t1.rating  >  3.5 AND t2.category_name  =  "Mexican" AND t3.category_name  =  "restaurant";

Question: Find all Mexican restaurant in Dallas with a rating above 3.5
SQL:
SELECT t1.name 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 WHERE t1.city  =  "Dallas" AND t1.rating  >  3.5 AND t2.category_name  =  "Mexican" AND t3.category_name  =  "restaurant";

Question: Find all restaurant with Valet Service in Dallas Texas
SQL:
SELECT t1.name 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 WHERE t1.city  =  "Dallas" AND t1.state  =  "Texas" AND t2.category_name  =  "Valet Service" AND t3.category_name  =  "restaurant";

Question: Find all Italian restaurant in the Meadowood neighbourhood of Madison
SQL:
SELECT t1.name FROM category AS t3 JOIN business AS t1 ON t3.business_id  =  t1.business_id JOIN category AS t4 ON t4.business_id  =  t1.business_id JOIN neighbourhood AS t2 ON t2.business_id  =  t1.business_id WHERE t1.city  =  "Madison" AND t3.category_name  =  "Italian" AND t4.category_name  =  "restaurant" AND t2.neighbourhood_name  =  "Meadowood";

Question: Find all Bars in " Los Angeles " with at least 30 reviews and average rating above 3 stars
SQL:
SELECT t1.name FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t1.city  =  "Los Angeles" AND t1.rating  >  3 AND t1.review_count  >  30 AND t2.category_name  =  "Bars";

Question: How many Egyptian restaurant are there in Edinburgh ?
SQL:
SELECT COUNT ( DISTINCT t1.name ) 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 WHERE t1.city  =  "Edinburgh" AND t2.category_name  =  "restaurant" AND t3.category_name  =  "Egyptian";

Question: Find users whose average review rating is below 3
SQL:
SELECT t2.name FROM USER AS t2 JOIN review AS t1 ON t2.user_id  =  t1.user_id GROUP BY t2.name HAVING AVG ( t1.rating )  <  3;

Question: Find the business with the most number of reviews in April
SQL:
SELECT t1.name FROM review AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id WHERE t2.month  =  "April" GROUP BY t1.name ORDER BY COUNT ( DISTINCT t2.text ) DESC LIMIT 1;

Question: Find the business which has the most number of categories
SQL:
SELECT t1.name FROM category AS t2 JOIN business AS t1 ON t2.business_id  =  t1.business_id GROUP BY t1.name ORDER BY COUNT ( DISTINCT t2.category_name ) DESC LIMIT 1;