Chinastark/bird_dataset huggingface dataset:
Database: public_review_platform
Note: ambience_trendy attribute refers to attribute_name = 'ambience_trendy' AND attribute_value = 'false';
Question: In how many businesses with the ambience_trendy attribute?
SQL: SELECT count(business_attributes.business_id) FROM attributes INNER JOIN business_attributes ON attributes.attribute_id = business_attributes.attribute_id WHERE attributes.attribute_name = 'ambience_trendy' AND business_attributes.attribute_value IN ('none', 'no', 'false')
Database: public_review_platform
Note: businesses that opened on Sunday refers to day_of_week = 'Sunday'; businesses that opened at 12PM refers to opening_time = '12PM';
Question: How many businesses in the city of Scottsdale open on Sunday at 12PM?
SQL: SELECT count(DISTINCT business_hours.business_id) FROM business INNER JOIN business_hours ON business.business_id = business_hours.business_id INNER JOIN days ON business_hours.day_id = days.day_id WHERE business.city = 'Scottsdale' AND days.day_of_week = 'Sunday' AND business_hours.opening_time = '12PM'
Database: public_review_platform
Note: Obstetricians & Gynecologists category refers to category_name = 'Obstetricians & Gynecologists'; calculation = AVG(stars);
Question: What is the average number of stars for businesses in the Obstetricians & Gynecologists category?
SQL: SELECT cast(sum(business.stars) AS REAL) / count(business.business_id) FROM business INNER JOIN business_categories ON business.business_id = business_categories.business_id INNER JOIN categories ON business_categories.category_id = categories.category_id WHERE categories.category_name = 'Obstetricians & Gynecologists'
Database: public_review_platform
Note: users with a high number of fans refers to user_fans = 'High'; 2011 refers to actual_year = 2011; Calculation = DIVIDE(elite.user_id where user_fans = 'High' AND actual_year = 2011, elite.user_id where actual_year = 2011) * 100;
Question: Calculate the percentage of users with a high number of fans who were elite in 2011.
SQL: SELECT cast(sum(CASE WHEN users.user_fans = 'High' THEN 1 ELSE 0 END) AS REAL) * 100 / count(users.user_fans) FROM years INNER JOIN elite ON years.year_id = elite.year_id INNER JOIN users ON elite.user_id = users.user_id WHERE years.actual_year = 2011
Database: public_review_platform
Note: Surprise is a city;
Question: How many of the businesses are in Surprise?
SQL: SELECT count(business_id) FROM business WHERE city = 'Surprise'
Database: public_review_platform
Note: Tempe is a city; high review count refers to review_count = 'High';
Question: List down the business ID with a high review count in Tempe.
SQL: SELECT business_id FROM business WHERE review_count = 'High' AND city = 'Tempe'
Database: public_review_platform
Note: active businesses refers to active = 'true'; AZ is a state; medium review count refers to review_count = 'Medium';
Question: What is the total number of active businesses in AZ with a medium review count?
SQL: SELECT count(business_id) FROM business WHERE review_count = 'Medium' AND state = 'AZ' AND active = 'true'
Database: public_review_platform
Note: businesses with a star range from 3 to 5 refers to stars BETWEEN 3 AND 5; Chandler is a city;
Question: List down the business ID with a star range from 3 to 5, located at Chandler.
SQL: SELECT business_id FROM business WHERE stars >= 3 AND stars < 6 AND city = 'Chandler'
Database: public_review_platform
Note: users in yelping since 2009 to 2011 refers to user_yelping_since_year BETWEEN 2009 AND 2011; low count of fans refers to user_fans = 'Low';
Question: In users yelping since 2009 to 2011, how many of them have low count of fans?
SQL: SELECT count(user_id) FROM users WHERE user_yelping_since_year >= 2009 AND user_yelping_since_year < 2012 AND user_fans = 'Low'
Database: public_review_platform
Note: review length refers to review_length; user 11021 refers to user_id = 11021; business ID 3 refers to business_id = 3;
Question: What is the review length of user 11021 to business with business ID 3?
SQL: SELECT review_length FROM reviews WHERE user_id = 11021 AND business_id = 3
Database: public_review_platform
Note: Tempe is a city; high review count refers to review_count = 'High';
Question: Among the businesses in Tempe, list the attribute of the business with a medium review count.
SQL: SELECT DISTINCT attributes.attribute_name FROM business INNER JOIN business_attributes ON business.business_id = business_attributes.business_id INNER JOIN attributes ON business_attributes.attribute_id = attributes.attribute_id WHERE business.city = 'Tempe' AND business.review_count = 'Medium'
Database: public_review_platform
Note: category of food refers to category_name = 'Food'; star rating below 3 refers to stars < 3;
Question: In businesses with a category of food, how many of them have a star rating below 3?
SQL: SELECT count(DISTINCT business.business_id) FROM business INNER JOIN business_categories ON business.business_id = business_categories.business_id INNER JOIN categories ON business_categories.category_id = categories.category_id WHERE categories.category_name = 'Food' AND business.stars < 3
Database: public_review_platform
Note: active business ID refers to active = 'true'; category of Food refers to category_name = 'Food';
Question: List the active business ID and its stars of the businesses fall under the category of Food.
SQL: SELECT DISTINCT business.business_id, business.stars FROM business INNER JOIN business_categories ON business.business_id = business_categories.business_id INNER JOIN categories ON business_categories.category_id = categories.category_id WHERE categories.category_name = 'Food' AND business.active = 'true'
Database: public_review_platform
Note: category of the business refers to category_name; attributes of the business refers to attribute_name; the highest star rating refers to MAX(stars);
Question: What is the category and attributes of businesses with highest star rating?
SQL: SELECT DISTINCT categories.category_name, attributes.attribute_name FROM business INNER JOIN business_categories ON business.business_id = business_categories.business_id INNER JOIN categories ON business_categories.category_id = categories.category_id INNER JOIN business_attributes ON business_categories.business_id = business_attributes.business_id INNER JOIN attributes ON business_attributes.attribute_id = attributes.attribute_id WHERE business.stars = ( SELECT max(stars) FROM business )
Database: public_review_platform
Note: category of the business refers to category_name; short review length refers to review_length = 'Short'; the highest star rating refers to MAX(stars); business ID from 7 to 14 refers to business_id BETWEEN 7 AND 14;
Question: What is the category of the business with short review length and highest review stars within business ID from 7 to 14?
SQL: SELECT DISTINCT categories.category_name FROM reviews INNER JOIN business_categories ON reviews.business_id = business_categories.business_id INNER JOIN categories ON business_categories.category_id = categories.category_id WHERE business_categories.business_id >= 7 AND business_categories.business_id < 15 AND reviews.review_length = 'Short' AND reviews.review_stars = ( SELECT max(review_stars) FROM reviews )
Database: public_review_platform
Note: active business ID refers to active = 'true'; category of Food refers to category_name = 'Food'; attribute of BYOB refers to attribute_name = 'BYOB'; high review count refers to review_count = 'High';
Question: Count the active businesses that has an attribute of BYOB with high review count.
SQL: SELECT count(DISTINCT business.business_id) FROM business INNER JOIN business_attributes ON business.business_id = business_attributes.business_id INNER JOIN attributes ON business_attributes.attribute_id = attributes.attribute_id WHERE attributes.attribute_name = 'BYOB' AND business.review_count = 'High' AND business.active = 'true'
Database: public_review_platform
Note: Glendale is a city; the highest star rating refers to MAX(stars);
Question: What is the closing and opening time of businesses located at Glendale with highest star rating?
SQL: SELECT business_hours.opening_time, business_hours.closing_time FROM business INNER JOIN business_hours ON business.business_id = business_hours.business_id WHERE business.city = 'Glendale' ORDER BY business.stars DESC LIMIT 1
Database: public_review_platform
Note: active business ID refers to active = 'true'; Goodyear is a city; AZ is a state; high review count refers to review_count = 'High';
Question: Among the active businesses located at Goodyear, AZ, list the category and atrributes of business with a high review count.
SQL: SELECT categories.category_name, attributes.attribute_name FROM business INNER JOIN business_categories ON business.business_id = business_categories.business_id INNER JOIN categories ON business_categories.category_id = categories.category_id INNER JOIN business_attributes ON business.business_id = business_attributes.business_id INNER JOIN attributes ON business_attributes.attribute_id = attributes.attribute_id WHERE business.review_count = 'High' AND business.city = 'Goodyear' AND business.state = 'AZ' AND business.active = 'true'
Database: public_review_platform
Note: active business ID refers to active = 'true'; categories refers to category_name; Glendale is a city; AZ is a state;
Question: List the categories of active businesses in Glendale, AZ.
SQL: SELECT DISTINCT categories.category_name FROM business_categories INNER JOIN business ON business_categories.business_id = business.business_id INNER JOIN categories ON business_categories.category_id = categories.category_id WHERE business.active = 'true' AND business.state = 'AZ' AND business.city = 'Glendale'
Database: public_review_platform
Note: location of business refers to city; business hours from 7am to 7pm refers to opening_time = '7AM' AND closing_time = '7PM'; Wednesday refers to day_of_week = 'Wednesday';
Question: Find the location of businesses that has business hours from 7 am to 7 pm every Wednesday.
SQL: SELECT DISTINCT business.city FROM business INNER JOIN business_hours ON business.business_id = business_hours.business_id INNER JOIN days ON business_hours.day_id = days.day_id WHERE business_hours.opening_time = '7AM' AND business_hours.closing_time = '7PM' AND days.day_of_week = 'Wednesday'
Database: public_review_platform
Note: active business ID refers to active = 'true'; low review count refers to review_count = 'Low'; 3 stars refers to stars = 3; Goodyear is a city; AZ is a state;
Question: What is the attribute value of an active business with a low review count and 3 stars which is located at Goodyear, AZ?
SQL: SELECT DISTINCT business_attributes.attribute_value FROM business INNER JOIN business_attributes ON business.business_id = business_attributes.business_id INNER JOIN attributes ON business_attributes.attribute_id = attributes.attribute_id WHERE business.state = 'AZ' AND business.city = 'Goodyear' AND business.active = 'true' AND business.stars = 3 AND business.review_count = 'Low'
Database: public_review_platform
Note: active business ID refers to active = 'true'; Glendale is a city; medium review count refers to review_count = 'Medium';
Question: What is the opening time of the active businesses in Glendale that have a medium review count.
SQL: SELECT DISTINCT business_hours.opening_time FROM business INNER JOIN business_hours ON business.business_id = business_hours.business_id INNER JOIN days ON business_hours.day_id = days.day_id WHERE business.city = 'Glendale' AND business.review_count = 'Medium' AND business.active = 'true'
Database: public_review_platform
Note: category of food refers to category_name = 'Food'; calculation = DIVIDE(COUNT(stars > 3), SUM(stars));
Question: Among the businesses with a category of Food, what is the percentage of the business with greater than 3 stars?
SQL: SELECT cast(sum(CASE WHEN business.stars > 3 THEN 1 ELSE 0 END) AS REAL) * 100 / count(business.stars) FROM business INNER JOIN business_categories ON business.business_id = business_categories.business_id INNER JOIN categories ON business_categories.category_id = categories.category_id WHERE categories.category_name = 'Food'
Database: public_review_platform
Note: active business ID refers to active = 'true'; Goodyear is a city; Calculation = AVG(stars) * 0.8; businesses with stars greater than 80% of average star rating refers to stars > AVG(stars) * 0.8;
Question: List the closing time and day of week of active businesses in Goodyear with stars greater than the 80% of average age of star rating.
SQL: SELECT DISTINCT business_hours.closing_time, days.day_of_week FROM business INNER JOIN business_hours ON business.business_id = business_hours.business_id INNER JOIN days ON business_hours.day_id = days.day_id WHERE business.active = 'true' AND business.city = 'Goodyear' AND business.stars > ( SELECT avg(stars) * 0.8 FROM business WHERE active = 'true' AND city = 'Goodyear' )
Database: citeseer
Note: classification refers to class_label; class_label = 'Agents'; percentage = (divide(count(paper_id where class_label = 'Agents')), (count(paper_id)))*100;
Question: Among all the citation, what is the percentage of paper ID under the Agents classification?
SQL: SELECT cast(count(CASE WHEN class_label = 'Agents' THEN paper_id ELSE NULL END) AS REAL) * 100 / count(paper_id) FROM paper
Database: citeseer
Note: most cited word refers to max(count(word_cited_id);
Question: What is the most cited word? How many papers was that word cited in?
SQL: SELECT word_cited_id, count(paper_id) FROM content GROUP BY word_cited_id ORDER BY count(word_cited_id) DESC LIMIT 1
Database: citeseer
Question: What is the total number of word cited under that class labelled 'AI'?
SQL: SELECT count(DISTINCT content.word_cited_id) FROM paper INNER JOIN content ON paper.paper_id = content.paper_id WHERE paper.class_label = 'AI'
Database: citeseer
Question: For all words cited in paper ID 315017, state the other paper ID and class label which also cited those words.
SQL: SELECT paper.class_label, content.word_cited_id FROM paper INNER JOIN content ON paper.paper_id = content.paper_id WHERE paper.paper_id = 315017
Database: citeseer
Note: class type refers to class_label; class_label = 'DB'; word that is most frequently cited refers to max(count(word_cited_id);
Question: Among all the DB class type citation, which word is the most frequently cited?
SQL: SELECT content.word_cited_id FROM paper INNER JOIN content ON paper.paper_id = content.paper_id WHERE paper.class_label = 'DB' GROUP BY content.word_cited_id ORDER BY count(content.word_cited_id) DESC LIMIT 1
Database: citeseer
Note: percentage = (divide(count(word_cited_id where class_label = 'Agents')), (count(word_cited_id)))*100;
Question: Calculate the percentage of words used in Agents class label.
SQL: SELECT cast(count(DISTINCT CASE WHEN paper.class_label = 'Agents' THEN content.word_cited_id ELSE NULL END) AS REAL) * 100 / count(DISTINCT content.word_cited_id) FROM paper INNER JOIN content ON paper.paper_id = content.paper_id
Database: citeseer
Note: most cited word refers to max(word_cited_id);
Question: Which paper ID cited the most word? In which class label does it belongs to?
SQL: SELECT paper.paper_id, paper.class_label FROM paper INNER JOIN content ON paper.paper_id = content.paper_id GROUP BY paper.paper_id, paper.class_label ORDER BY count(content.word_cited_id) DESC LIMIT 1
Database: citeseer
Note: class type refers to class_label;
Question: List all the paper ID and its class type that cited the word 'word1002'.
SQL: SELECT paper.paper_id, paper.class_label FROM paper INNER JOIN content ON paper.paper_id = content.paper_id WHERE content.word_cited_id = 'word1002'
Database: citeseer
Question: List all words cited in the AI class label.
SQL: SELECT DISTINCT content.word_cited_id FROM paper INNER JOIN content ON paper.paper_id = content.paper_id WHERE paper.class_label = 'AI'
Database: citeseer
Question: What is the class label of paper ID 'chakrabarti01integrating'. How many words were cited by this paper ID?
SQL: SELECT DISTINCT paper.class_label, count(content.word_cited_id) FROM paper INNER JOIN content ON paper.paper_id = content.paper_id WHERE paper.paper_id = 'chakrabarti01integrating' GROUP BY paper.class_label
Database: citeseer
Note: class type refers to class_label; count(word_cited_id)>20;
Question: List all paper ID and its class type with more than 20 cited words.
SQL: SELECT DISTINCT paper.paper_id, paper.class_label FROM paper INNER JOIN content ON paper.paper_id = content.paper_id GROUP BY content.paper_id, paper.class_label HAVING count(content.word_cited_id) > 20
Database: citeseer
Question: List the words that are cited in both AI and IR class label.
SQL: SELECT DISTINCT content.word_cited_id FROM paper INNER JOIN content ON paper.paper_id = content.paper_id WHERE paper.class_label = 'AI' OR paper.class_label = 'IR'
Database: citeseer
Question: Name the paper which is cited most times and the paper which is cited least times? Also, find the number of times each one is cited.
SQL: SELECT cited_paper_id, count(cited_paper_id), ( SELECT cited_paper_id FROM cites GROUP BY cited_paper_id ORDER BY count(cited_paper_id) ASC LIMIT 1 ), ( SELECT count(cited_paper_id) FROM cites GROUP BY cited_paper_id ORDER BY count(cited_paper_id) ASC LIMIT 1 ) FROM cites GROUP BY cited_paper_id ORDER BY count(cited_paper_id) DESC LIMIT 1
Database: citeseer
Note: class refers to class_label; average = divide(count(paper_id where class_label = 'M')), (count(paper_id)));
Question: On average, how many papers are under the ML class?
SQL: SELECT cast(count(CASE WHEN class_label = 'ML' THEN paper_id ELSE NULL END) AS REAL) / count(paper_id) FROM paper
Database: citeseer
Note: paper cited by refers to citing_paper_id; citing_paper_id = 'sima01computational';
Question: Find the words cited in papers that are cited by sima01computational?
SQL: SELECT DISTINCT content.word_cited_id FROM cites INNER JOIN content ON cites.cited_paper_id = content.paper_id WHERE cites.citing_paper_id = 'sima01computational'
Database: citeseer
Note: paper cited by refers to citing_paper_id; citing_paper_id = 'schmidt99advanced';
Question: How many papers were cited by schmidt99advanced cited word3555?
SQL: SELECT count(content.paper_id) FROM cites INNER JOIN content ON cites.cited_paper_id = content.paper_id WHERE cites.citing_paper_id = 'schmidt99advanced' AND content.word_cited_id = 'word3555'
Database: citeseer
Question: Under what classification do the papers that cited word1163 belong?
SQL: SELECT DISTINCT paper.class_label FROM paper INNER JOIN content ON paper.paper_id = content.paper_id WHERE content.word_cited_id = 'word1163'
Database: citeseer
Note: classification refers to class_label; class_label = 'DB';
Question: Among the papers under DB classification, which paper has the highest number of words cited?
SQL: SELECT paper.paper_id FROM paper INNER JOIN content ON paper.paper_id = content.paper_id WHERE paper.class_label = 'DB' GROUP BY paper.paper_id ORDER BY count(content.word_cited_id) DESC LIMIT 1
Database: citeseer
Note: classification refers to class_label; paper cited by refers to citing_paper_id; citing_paper_id = 'butz01algorithmic';
Question: In the papers classified as ML, how many cited butz01algorithmic?
SQL: SELECT count(paper.paper_id) FROM paper INNER JOIN cites ON paper.paper_id = cites.citing_paper_id WHERE paper.class_label = 'ML' AND cites.cited_paper_id = 'butz01algorithmic'
Database: simpson_episodes
Note: oldest refers to Min(birthdate);
Question: Which crew member of the simpson 20s is the oldest?
SQL: SELECT name FROM person WHERE birthdate IS NOT NULL ORDER BY birthdate ASC LIMIT 1;
Database: simpson_episodes
Note: "Dan Castellaneta" is the name of person;
Question: What's the nickname for Dan Castellaneta?
SQL: SELECT nickname FROM person WHERE name = 'Dan Castellaneta';
Database: simpson_episodes
Note: born in New York city refers to birth_region = 'New York'; born after year 1970 refers to ('%Y', birthdate) > 1970;
Question: Among the crew members of the simpson 20s born in the New York city, how many of them were born after the year 1970?
SQL: SELECT count(name) FROM person WHERE birth_region = 'New York' AND substr(birthdate, 1, 4) > '1970';
Database: simpson_episodes
Note: "Outstanding Voice-Over Performance" is the award; 2009 refers to year = 2009; 'Winner' is the result; country refers to birth_country;
Question: In which country was the winner of the Outstanding Voice-Over Performance award of 2009 born?
SQL: SELECT person.birth_country FROM person INNER JOIN award ON person.name = award.person WHERE award.award = 'Outstanding Voice-Over Performance' AND award.year = 2009 AND award.result = 'Winner';
Database: simpson_episodes
Note: award won refers to result = 'Winner';
Question: Please list the names of all the awards won by the crew member whose nickname is Doofus.
SQL: SELECT award.award FROM person INNER JOIN award ON person.name = award.person WHERE person.nickname = 'Doofus' AND award.result = 'Winner';
Database: simpson_episodes
Note: born in USA refers to birth_country = 'USA'; were nominated refers to result = 'Nominee'; 'Outstanding Animated Program (For Programming Less Than One Hour)' is the award; in 2009 refers to year = 2009;
Question: How many crew members who were born in the USA were nominated for the Outstanding Animated Program (For Programming Less Than One Hour) award in 2009?
SQL: SELECT count(*) FROM person INNER JOIN award ON person.name = award.person WHERE person.birth_country = 'USA' AND award.result = 'Nominee' AND award.award = 'Outstanding Animated Program (For Programming Less Than One Hour)' AND award.year = 2009;
Database: simpson_episodes
Note: won refers to result = 'Winner';
Question: Which character won the Outstanding Voice-Over Performance award in 2009?
SQL: SELECT DISTINCT character_award.character FROM character_award INNER JOIN award ON character_award.award_id = award.award_id WHERE award.award = 'Outstanding Voice-Over Performance' AND award.year = 2009 AND award.result = 'Winner';
Database: simpson_episodes
Note: "Lost Verizon" is the title of episode;
Question: Please list all the keywords of the episode Lost Verizon.
SQL: SELECT keyword.keyword FROM episode INNER JOIN keyword ON episode.episode_id = keyword.episode_id WHERE episode.title = 'Lost Verizon';
Database: simpson_episodes
Note: aired on 2008/10/19 refers to air_date = '2008-10-19';
Question: How many keywords does the episode that was aired on 2008/10/19 have?
SQL: SELECT count(keyword.keyword) FROM episode INNER JOIN keyword ON episode.episode_id = keyword.episode_id WHERE episode.air_date = '2008-10-19';
Database: simpson_episodes
Note: "Dan Castellaneta" is the person;  2009 is year;  won refers result = 'Winner';
Question: What's the rating of the episode in which Dan Castellaneta won the Outstanding Voice-Over Performance award in 2009?
SQL: SELECT episode.rating FROM award INNER JOIN episode ON award.episode_id = episode.episode_id WHERE award.award = 'Outstanding Voice-Over Performance' AND substr(award.year, 1, 4) = '2009' AND award.person = 'Dan Castellaneta';
Database: simpson_episodes
Note: 7-stars vote refers to stars = 7; 'Lost Verizon' is the title of episode;
Question: How many 7-star votes in star score did the episode Lost Verizon have?
SQL: SELECT count(*) FROM episode INNER JOIN vote ON vote.episode_id = episode.episode_id WHERE episode.title = 'Lost Verizon' AND vote.stars = 7;
Database: simpson_episodes
Note: "Lost Verizon" is the title of episode; most voters refers to Max(votes);
Question: How many stars did most of the voters give in star score for the episode Lost Verizon?
SQL: SELECT vote.stars FROM episode INNER JOIN vote ON vote.episode_id = episode.episode_id WHERE episode.title = 'Lost Verizon' ORDER BY vote.votes DESC LIMIT 1;
Database: simpson_episodes
Note: over 200 votes refers to votes > 200; 10 in star score refers to stars = 10;
Question: Please list the titles of the episodes that have over 200 voters voting a 10 in star score.
SQL: SELECT episode.title FROM episode INNER JOIN vote ON vote.episode_id = episode.episode_id WHERE vote.votes > 200 AND vote.stars = 10;