db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
menu
Provide the numbers of the menu item which includes Fresh lobsters in every style and location where that dish was used on a menu.
Fresh lobsters in every style' is a name of dish; location where the dish was used on a menu = (xpos, ypos);
SELECT T2.menu_id, T1.xpos, T1.ypos FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id INNER JOIN Dish AS T4 ON T1.dish_id = T4.id WHERE T4.name = 'Fresh lobsters in every style'
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
Calculate the total number of students in universities located in Sweden.
located in Sweden refers to country_name = 'Sweden'; number of students refers to num_students
SELECT SUM(T2.num_students) FROM university AS T1 INNER JOIN university_year AS T2 ON T1.id = T2.university_id INNER JOIN country AS T3 ON T3.id = T1.country_id WHERE T3.country_name = 'Sweden'
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
List the dishes that appeared at the left upper corner of the CHAS.BRADLEY'S OYSTER & DINING ROOM"s sponsored menu.
appeared at the left upper corner refers to xpos < 0.25 and ypos < 0.25; CHAS.BRADLEY'S OYSTER & DINING ROOM refers to sponsor = 'CHAS.BRADLEY''S OYSTER & DINING ROOM';
SELECT T4.name FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id INNER JOIN Dish AS T4 ON T1.dish_id = T4.id WHERE T3.sponsor = 'CHAS.BRADLEY''S OYSTER & DINING ROOM' AND T1.xpos < 0.25 AND T1.ypos < 0.25
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
Give the location of the university ID 112.
location refers to country_name
SELECT T2.country_name FROM university AS T1 INNER JOIN country AS T2 ON T1.country_id = T2.id WHERE T1.id = 112
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
university
What is the student staff ratio of Harvard University in 2012?
Harvard University refers to university_name = 'Harvard University'; in 2012 refers to year = 2012
SELECT T1.student_staff_ratio FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T2.university_name = 'Harvard University' AND T1.year = 2012
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
Provide the page IDs and name of the menu which had the highest page count.
page IDs refers to page_number; highest page count refers to MAX(page_count);
SELECT T1.page_number, T2.name FROM MenuPage AS T1 INNER JOIN Menu AS T2 ON T2.id = T1.menu_id ORDER BY T2.page_count DESC LIMIT 1
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
Provide the ranking system of the ranking criteria named Quality of Education Rank.
criteria named Quality of Education Rank refers to criteria_name = 'Quality of Education Rank'; ranking system refers to system_name;
SELECT T1.system_name FROM ranking_system AS T1 INNER JOIN ranking_criteria AS T2 ON T1.id = T2.ranking_system_id WHERE T2.criteria_name = 'Quality of Education Rank'
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
On the menu with the most dishes, how many dishes were there on its second page?
menu with the most dishes refers to menu.id with MAX(dish_count); second page refers to page_number = 2;
SELECT COUNT(T1.dish_id) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id WHERE T2.page_number = 2 GROUP BY T3.name ORDER BY T3.dish_count DESC LIMIT 1
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
List the university ID of the university that scored 100 in 2011.
in 2011 refers to year = 2011; score = 100
SELECT university_id FROM university_ranking_year WHERE score = 100 AND year = 2011
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
university
What is the university ID of Harvard University?
of Harvard University refers to university_name = 'Harvard University';
SELECT id FROM university WHERE university_name = 'Harvard University'
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
Among the dishes on menu page ID 7610, list the names and highest prices of the dishes in menu items that were created on 23rd May 2011.
highest prices of the dishes refers to MAX(price); created on 23rd May 2011 refers to created_at like '2011-05-23%';
SELECT T1.name, T2.price FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T2.created_at LIKE '2011-05-23%' ORDER BY T2.price DESC LIMIT 1
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
Provide the number of international students and number of students in 2013 in university ID 20.
number of international students refers to DIVIDE(MULTIPLY(pct_international_students, num_students), 100); in 2013 refers to year = 2013
SELECT pct_international_students * num_students, num_students FROM university_year WHERE year = 2013 AND university_id = 20
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
List the dishes included on page number 30 with the least in full height.
least in full height refers to MIN(full_height);
SELECT T3.name FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T1.page_number = 30 ORDER BY T1.full_height DESC, T1.full_height ASC LIMIT 1
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
Compute the average percentage of female students.
average percentage of female students refers to avg(pct_female_students)
SELECT AVG(pct_female_students) FROM university_year
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
List the names and menu page IDs of the dishes that first appeared in 1861.
first appeared in 1861 refers to first_appeared = 1861;
SELECT T2.name, T1.dish_id FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T2.id = T1.dish_id WHERE T2.first_appeared = 1861
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
Give the year where a university had the lowest number of students.
had the lowest number of students refers to MIN(num_students)
SELECT year FROM university_year ORDER BY num_students ASC LIMIT 1
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
How many pages were there on the menu created on 17th November 1898?
created on 17th November 1898 refers to date = '1898-11-17';
SELECT SUM(CASE WHEN T1.date = '1898-11-17' THEN 1 ELSE 0 END) FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
What is the university ID of the university with the largest student staff ratio?
the largest student staff ratio refers to max(student_staff_ratio)
SELECT university_id FROM university_year ORDER BY student_staff_ratio DESC LIMIT 1
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
books
What is the language of the book with ISBN 23755004321?
"23755004321" is the isbn13; language refers to language_name
SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T1.isbn13 = 23755004321
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
menu
How many dishes appeared on a menu more than once?
appeared on a menu more than once refers to times_appeared > menus_appeared;
SELECT COUNT(*) FROM Dish WHERE times_appeared > menus_appeared
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
What are the names of the top 5 universities with the highest number of international students?
highest number of international students refers to MAX(DIVIDE(MULTIPLY(num_students, pct_international_students), 100)); name of university refers to university_name;
SELECT DISTINCT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id ORDER BY (CAST(T1.num_students * T1.pct_international_students AS REAL) / 100) DESC LIMIT 5
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
How many menus were created for steamship?
steamship refers to venue = 'STEAMSHIP';
SELECT COUNT(*) FROM Menu WHERE venue = 'STEAMSHIP'
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
How many universities have no less than 20,000 female students in 2016? Identify how many of the said universities are located in the United States of America.
have no less than 20,000 female students refers to DIVIDE(MULTIPLY(pct_female_students, num_students), 100) > 20000; in 2016 refers to year = 2016; located in the United States of America refers to country_name = 'United States of America'
SELECT COUNT(*) , SUM(CASE WHEN T3.country_name = 'United States of America' THEN 1 ELSE 0 END) AS nums_in_usa FROM university AS T1 INNER JOIN university_year AS T2 ON T1.id = T2.university_id INNER JOIN country AS T3 ON T3.id = T1.country_id WHERE T2.year = 2016 AND T2.num_students * T2.pct_female_students / 100 > 20...
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
How many dishes are included in the menu page ID 144?
FALSE;
SELECT COUNT(*) FROM MenuItem WHERE menu_page_id = 144
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
Between 2011 to 2016, in which countries can you find the universities where at least 50% of its students are international students?
Between 2011 to 2016 refers to year BETWEEN 2011 AND 2016; at least 50% of its students are international students refers to pct_international_students > 50; which country refers to country_name
SELECT DISTINCT T3.country_name FROM university AS T1 INNER JOIN university_year AS T2 ON T1.id = T2.university_id INNER JOIN country AS T3 ON T3.id = T1.country_id WHERE T2.pct_international_students > 50 AND T2.year BETWEEN 2011 AND 2016
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
books
What is the total shipping cost of all the orders made by Page Holsey? Indicate how many of the said orders were ordered in 2022.
shipping cost refers to cost; ordered in 2022 refers to order_date LIKE '2022%'
SELECT SUM(T3.cost) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T1.first_name = 'Page' AND T1.last_name = 'Holsey' AND STRFTIME('%Y', T2.order_date) = '2022'
CREATE TABLE order_line ( book_id INTEGER references book, -- price REAL, -- line_id INTEGER primary key autoincrement, order_id INTEGER references cust_order, -- ); CREATE TABLE customer ( customer_id INTEGER primary key, first_name TEXT, -- last_name TEXT, -- email TEXT, -- ); CREATE TABLE book_...
menu
How many menus were used in Dutcher House?
Dutcher House refers to location = 'Dutcher House';
SELECT COUNT(*) FROM Menu WHERE location = 'Dutcher House'
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
List the names of all the universities that have no less than 50,000 students in the year 2012.
have no less than 50,000 students refers to num_students > 50000; name of university refers to university_name;
SELECT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.num_students > 50000 AND T1.year = 2012
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
What is the average price of the dishes on the menu "Zentral Theater Terrace"?
average price = AVG(price); Zentral Theater Terrace refers to menu;
SELECT SUM(T1.price) / COUNT(T1.price) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id WHERE T3.name = 'Zentral Theater Terrace'
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
What are the names of the criteria under Center for World University Rankings?
names of the criteria refers to criteria_name; under Center for World University Rankings refers to system_name = 'Center for World University Rankings';
SELECT T2.criteria_name FROM ranking_system AS T1 INNER JOIN ranking_criteria AS T2 ON T1.id = T2.ranking_system_id WHERE T1.system_name = 'Center for World University Rankings'
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
university
How many times did the Yale University achieve a score of no less than 10 in the Quality of Education Rank?
Yale University refers to university_name = 'Yale University'; a score of no less than 10 refers to score > = 10; in the Quality of Education Rank refers to criteria_name = 'Quality of Education Rank'
SELECT COUNT(*) FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id WHERE T3.university_name = 'Yale University' AND T2.score >= 10 AND T1.criteria_name = 'Quality of Education Rank'
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
Name the dishes that were on the menu page ID 174.
FALSE;
SELECT T2.name FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T2.id = T1.dish_id WHERE T1.menu_page_id = 174
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
Which country is the University of Oxford located?
University of Oxford refers to university_name = 'University of Oxford'; which country refers to country_name
SELECT T2.country_name FROM university AS T1 INNER JOIN country AS T2 ON T1.country_id = T2.id WHERE university_name = 'University of Oxford'
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
university
How many universities scored 0 in Awards between 2005 to 2015?
between 2005 to 2015 refers to year BETWEEN 2005 AND 2015; scored 0 refers to score = 0; in Awards refers to criteria_name = 'Award'
SELECT COUNT(*) FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id WHERE T1.criteria_name = 'Award' AND T2.year BETWEEN 2005 AND 2015 AND T2.score = 0
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
How many menu items were created on 28th March 2011?
created on 28th March 2011 refers to created_at like '2011-03-28%';
SELECT COUNT(*) FROM MenuItem WHERE created_at LIKE '2011-03-28%'
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
In 2016, what is the name of the university in Australia with the highest score in Citations criteria?
In 2016 refers to year = 2016; name of the university refers to university_name; in Australia refers to country_name = 'Australia'; in Citations criteria refers to criteria_name = 'Citations'; highest score refers to MAX(score)
SELECT T3.university_name FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id INNER JOIN country AS T4 ON T4.id = T3.country_id WHERE T1.criteria_name = 'Citations' AND T2.year = 2016 AND T1.id = 4 AND T4.country_...
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
Please list the IDs of the menus that are DIYs of the restaurant and have the dish "Clear green turtle".
IDs of the menus refers to menu_id; menus that are DIYs of the restaurant refers to sponsor is null; Clear green turtle is a name of dish;
SELECT T2.menu_id FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id INNER JOIN Dish AS T4 ON T1.dish_id = T4.id WHERE T4.name = 'Clear green turtle' AND T3.sponsor IS NULL
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
How many universities are there in the United States of America?
in the United States of America refers to country_name = 'United States of America';
SELECT COUNT(*) FROM university AS T1 INNER JOIN country AS T2 ON T1.country_id = T2.id WHERE T2.country_name = 'United States of America'
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
What is the average page number of the menus that have the dish "Clear green turtle"?
average page number = AVG(page_number); Clear green turtle is a name of dish;
SELECT AVG(T1.page_number) FROM MenuPage AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.menu_page_id INNER JOIN Dish AS T3 ON T2.dish_id = T3.id WHERE T3.name = 'Clear green turtle'
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
What is the name of the university that has the lowest number of students of all time?
has the lowest number of students refers to min(num_students); name of the university refers to university_name
SELECT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id ORDER BY T1.num_students LIMIT 1
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
How many dishes are there on the menu "Zentral Theater Terrace"?
Zentral Theater Terrace is a name of menu;
SELECT SUM(CASE WHEN T3.name = 'Zentral Theater Terrace' THEN 1 ELSE 0 END) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
In 2014, what is the name of the university which was considered a leader in the publications rank?
In 2014 refers to year = 2014; leader refers to MAX(score); in the publications rank refers to criteria_name = 'Publications Rank'; name of university refers to university_name;
SELECT T3.university_name FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id WHERE T1.criteria_name = 'Publications Rank' AND T2.year = 2014 AND T1.id = 17 ORDER BY T2.score DESC LIMIT 1
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
How many dishes are there in total in the menus with the name "Waldorf Astoria"?
FALSE;
SELECT SUM(CASE WHEN T3.name = 'Waldorf Astoria' THEN 1 ELSE 0 END) FROM MenuItem AS T1 INNER JOIN MenuPage AS T2 ON T1.menu_page_id = T2.id INNER JOIN Menu AS T3 ON T2.menu_id = T3.id
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
university
What is the name of the university that had the highest number of international students for 6 consecutive years?
had the highest number of international students refers to max(pct_international_students); for 6 consecutive years refers to count(SUBTRACT(year, rm)) > = 6; name of university refers to university_name;
SELECT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id ORDER BY T1.pct_international_students DESC LIMIT 1
CREATE TABLE ranking_system ( id INTEGER not null primary key, system_name TEXT default NULL, -- Example Values: `Times Higher Education World University Ranking`, `Shanghai Ranking`, `Center for World University Rankings` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 ); CREATE TABLE country ( ...
menu
List down the name of dishes from menu created in April.
created in April refers to SUBSTR(created_at, 7, 1) = '4';
SELECT T2.name FROM MenuItem AS T1 INNER JOIN Dish AS T2 ON T2.id = T1.dish_id WHERE SUBSTR(T1.created_at, 7, 1) = '4'
CREATE TABLE Dish ( menus_appeared INTEGER, -- highest_price REAL, -- description TEXT, -- Example Values: `` | Value Statics: Total count 7 - Distinct count 1 - Null count 99993 last_appeared INTEGER, -- name TEXT, -- id INTEGER primary key, first_appeared INTEGER, -- lowest_price REAL, -- time...
movie_3
Which film has a higher replacement cost, ACE GOLDFINGER or ACADEMY DINOSAUR?
higher replacement cost refers to Max(replacement_cost); 'ACE GOLDFIINGER' and 'ACADEMY DINOSAUR' are both the title of film
SELECT title FROM film WHERE title IN ('ACE GOLDFINGER', 'ACADEMY DINOSAUR') ORDER BY replacement_cost DESC LIMIT 1
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
hockey
What is the average height of all the goalies born in the 70s who's a left shooting/catching dominant and to which team do the tallest player/s play for most recently?
goalies refers to pos = 'G'; born in the 70s refers to birthYear between '1970' and '1979'; left shooting/catching dominant refers to shootCatch = 'L'; tallest refers to max(height); average height = avg(height(pos = 'G' & birthYear between '1970' and '1979' & shootCatch = 'L')); most recently refers to max(Teams.year)
SELECT CAST(SUM(T2.height) AS REAL) / COUNT(*) FROM AwardsPlayers AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T2.height IS NOT NULL AND (T2.pos = 'LW' OR T2.pos = 'L/C')
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
synthea
Write down the Social Security numbers of patients who have latex allergies.
Social Security numbers refers to ssn; latex allergies refers to allergies.DESCRIPTION = 'Latex allergy';
SELECT T1.ssn FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Latex allergy'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
social_media
What is the gender of the user who has posted the tweet that got the most likes?
tweet got the most likes refers to Max(Likes)
SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID ORDER BY T1.Likes DESC LIMIT 1
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
movie_3
Which film has the longest duration of film screening? Please give its title.
longest duration of film refers to Max(length)
SELECT title FROM film ORDER BY length DESC LIMIT 1
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
hockey
Which year recorded the most number of goals by a player and how old was the player at the time the most number of goals was achieved by him?
most number of goals refers to max(G); how old refers to age = subtract(year(max(G)), birthYear)
SELECT T1.year, T1.year - T2.birthYear FROM Scoring AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID GROUP BY T1.year, T1.year - T2.birthYear ORDER BY SUM(T1.G) DESC LIMIT 1
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
social_media
Please list the texts of the top 3 tweets with the most number of unique users seeing the tweet.
the most number of unique users seeing refers to Max(Reach)
SELECT text FROM twitter ORDER BY Reach DESC LIMIT 3
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
movie_platform
State the most popular movie? When was it released and who is the director for the movie?
most popular movie refers to MAX(movie_popularity); when it was released refers to movie_release_year; director for the movie refers to director_name;
SELECT movie_title, movie_release_year, director_name FROM movies ORDER BY movie_popularity DESC LIMIT 1
CREATE TABLE ratings_users ( user_cover_image_url TEXT, -- user_avatar_image_url TEXT, -- rating_date_utc TEXT, -- user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S...
movie_3
Please list the titles of the films that are released in 2006 and have a rental rate of $2.99.
released in 2006 refers to release_year = 2006; rental rate of $2.99 refers to rental_rate = 2.99
SELECT title FROM film WHERE release_year = 2006 AND rental_rate = 2.99
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
hockey
How many players, whose shooting/catching hand is both left and right, debuted their first NHL in 2011?
shooting/catching hand is both left and right refers to shootCatch is NULL, debuted their first NHL in 2011 refers to firstNHL = 2011
SELECT COUNT(playerID) FROM Master WHERE shootCatch IS NULL AND firstNHL = '2011'
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
social_media
What is the total number of tweets sent by male users on Mondays?
male user refers to Gender = 'Male; 'Monday' is the Weekday; total number of tweet refers to Count (TweetID)
SELECT COUNT(DISTINCT T1.TweetID) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Weekday = 'Monday'
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
movie_3
How many films have a rental duration of over 6 days?
rental duration of over 6 days refers to rental_duration > 6
SELECT COUNT(film_id) FROM film WHERE rental_duration > 6
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
hockey
In 2006, what is the overall number of october defeats for the team with the most October defeats? Indicate the team ID.
team ID refers to tmID; 'defeats' and 'loses' are synonyms; most October defeats refers to max(OctL)
SELECT OctL, tmID FROM TeamSplits WHERE year = '2006' ORDER BY OctL DESC LIMIT 1
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
synthea
What is the social security number and address of the patient who encountered viral sinusitis symptoms on 6/13/2008?
social security number refers to ssn; encountered viral sinusitis refers to encounters.REASONDESCRIPTION = 'Viral sinusitis (disorder)'; on 6/13/2008 refers to encounters.DATE = '2008-06-13';
SELECT T1.ssn, T1.address FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T2.DATE = '2008-06-13' AND T2.REASONDESCRIPTION = 'Viral sinusitis (disorder)' AND T2.DESCRIPTION = 'Encounter for symptom'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
social_media
Tweets that were posted from Brazil are in what languague?
"Brazil" is the Country; language refers to Lang
SELECT DISTINCT T1.Lang FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.Country = 'Brazil'
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
movie_3
What is the description of the film ACADEMY DINOSAUR?
"ACADEMY DINOSAUR" is the title of film
SELECT description FROM film WHERE title = 'ACADEMY DINOSAUR'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
hockey
How many goals were scored while the goalkeeper was on the ice in the 1924 WCHL by the goalie with the most goals scored?
WCHL is the league's abbreviated name which refers to lgID = 'WCHL'; most goals scored referst to MAX(PostGA); GA is abbreviation for Post Against which means number of goals recorded while the goalie is on the ice. Include all goals against during regulation and overtime play.
SELECT SUM(PostGA) FROM Goalies WHERE lgID = 'WCHL' AND year = '1924' GROUP BY playerID ORDER BY SUM(PostGA) DESC LIMIT 1
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
synthea
Tell me the reason for Lavelle Vandervort's encounter on 11/20/2013?
reason for encounter refers to encounters.REASONDESCRIPTION; on 11/20/2013 refers to encounters.DATE = '2013-11-20';
SELECT T2.REASONDESCRIPTION FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T2.DATE = '2013-11-20' AND T1.first = 'Lavelle' AND T1.last = 'Vandervort'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
social_media
How many tweets in French were posted from Australia?
"French" is the language and refers to Lang = 'fr'; 'Australia' is the Country
SELECT COUNT(DISTINCT T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.Lang = 'fr' AND T2.Country = 'Australia'
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
bike_share_1
Calculate the average duration travelled by subscribers that both started and ended their trip in Mountain View City Hall and indicate the date when the station was first installed.
average duration = DIVIDE(SUM(duration), COUNT(id)); subscribers refers to subscription_type = 'subscriptions'; started and ended their trip at Mountain View City Hall refers to start_station_name = 'Mountain View City Hall' and end_station_name = 'Mountain View City Hall'; when the station was first installed refers t...
SELECT AVG(T1.duration), T2.installation_date FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.start_station_name = 'Mountain View City Hall' AND T1.subscription_type = 'Subscriber' AND T1.end_station_name = 'Mountain View City Hall'
CREATE TABLE weather ( zip_code TEXT, -- Example Values: `94107`, `94063`, `94301`, `94041`, `95113` | Value Statics: Total count 3665 - Distinct count 5 - Null count 0 max_visibility_miles INTEGER, -- Example Values: `10`, `9`, `8`, `20`, `15` | Value Statics: Total count 3652 - Distinct count 11 - Null count 13 ...
hockey
What is the position of the 9th oldest hockey player?
position refers to pos; date of birth refers to birthDay + birthMon + birthYear
SELECT pos FROM Master WHERE birthYear IS NOT NULL ORDER BY birthYear, birthMon, birthDay LIMIT 8
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
synthea
How many patients with shellfish allergies died when they were under 12 years old? Please give their full names.
shellfish allergies refers to allergies.DESCRIPTION = 'Shellfish allergy'; died under 12 years old = DIVIDE(SUBTRACT(julianday(patients.deathdate), julianday(patients.birthdate)), 365) < 12; full names = first, last;
SELECT T1.first, T1.last FROM patients AS T1 INNER JOIN allergies AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Shellfish allergy' AND CAST((strftime('%J', T1.deathdate) - strftime('%J', T1.birthdate)) AS REAL) / 365 < 12
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
social_media
How many reshared tweets have over 100 likes?
over 100 likes refers to Likes > 100; reshare tweet refers to IsReshare = 'TRUE'
SELECT COUNT(DISTINCT TweetID) FROM twitter WHERE IsReshare = 'TRUE' AND Likes > 100
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
bike_share_1
What is the average coldest temperature for the zip code of 94301 and what stations are within the zip code? Include the latitude and longitude as well.
coldest temperature refers to min_temperature_f; average coldest temperature refers = AVG(min_temperature_f); stations refers to name; latitude refers to lat; longitude refers to long;
SELECT AVG(T3.min_temperature_f), T1.long, T1.lat FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name INNER JOIN weather AS T3 ON T3.zip_code = T2.zip_code WHERE T3.zip_code = 94301
CREATE TABLE weather ( zip_code TEXT, -- Example Values: `94107`, `94063`, `94301`, `94041`, `95113` | Value Statics: Total count 3665 - Distinct count 5 - Null count 0 max_visibility_miles INTEGER, -- Example Values: `10`, `9`, `8`, `20`, `15` | Value Statics: Total count 3652 - Distinct count 11 - Null count 13 ...
hockey
Which team recorded the most number of road victories in 2005? Indicate the team ID.
road victories refers to rW; team id refers to tmID; victories and wins are synonyms
SELECT tmID FROM TeamSplits WHERE YEAR = '2005' ORDER BY rW DESC LIMIT 1
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
synthea
From 1/9/2011 to 8/29/2012, how many German patients have their outpatient encounters?
From 1/9/2011 to 8/29/2012 refers to encounters.DATE between '2011-09-01' and '2012-08-29'; German patients refers to ethnicity = 'german'; outpatient encounters refers to encounters.DESCRIPTION = 'Outpatient Encounter';
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T1.ethnicity = 'german' AND T2.DATE BETWEEN '2011-01-09' AND '2012-08-29' AND T2.DESCRIPTION = 'Outpatient Encounter'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
social_media
From which city was the tweet with the most number of retweets posted?
tweet with most number of retweet post refers to Max(RetweetCount)
SELECT T2.City FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID ORDER BY T1.RetweetCount DESC LIMIT 1
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
movie_platform
What is the name of the longest movie title? When was it released?
longest movie title refers to MAX(LENGTH(movie_title)); when it was released refers to movie_release_year;
SELECT movie_title, movie_release_year FROM movies ORDER BY LENGTH(movie_popularity) DESC LIMIT 1
CREATE TABLE ratings_users ( user_cover_image_url TEXT, -- user_avatar_image_url TEXT, -- rating_date_utc TEXT, -- user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S...
bike_share_1
How many subscribers have ended their trip at MLK Library and how many docks does that station have?
subscribers refers to subscription_type = 'subscribers'; ended their trip at refers to end_station_name; end_station_name = 'MLK Library'; number of docks a station have refers to dock_count;
SELECT COUNT(T1.id), T2.dock_count FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.end_station_name = 'MLK Library' AND T1.subscription_type = 'Subscriber' AND T2.dock_count = 19
CREATE TABLE weather ( zip_code TEXT, -- Example Values: `94107`, `94063`, `94301`, `94041`, `95113` | Value Statics: Total count 3665 - Distinct count 5 - Null count 0 max_visibility_miles INTEGER, -- Example Values: `10`, `9`, `8`, `20`, `15` | Value Statics: Total count 3652 - Distinct count 11 - Null count 13 ...
hockey
How many wins does the team have whose goaltender have the most number of successfully stopping the other team from scoring during the entire game?
Number of wins refers to W; Shutout refers to SHO; a shutout is credited to a goaltender who successfully stops the other team from scoring during the entire game.
SELECT SUM(W) FROM Goalies GROUP BY tmID ORDER BY SUM(SHO) DESC LIMIT 1
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
synthea
Give me the reason, name of the drug, and duration of medication under encounter ID 23c293ec-dbae-4a22-896e-f12cf3c8bac3. Tell me if the patient is still alive.
reason refers to medications.REASONDESCRIPTION; name of the drug refers to medications.DESCRIPTION; duration of medication = SUBTRACT(julianday(medications.STOP, julianday(medications.START))); ecounter ID refers to encounters.ID; encounters.ID = '23c293ec-dbae-4a22-896e-f12cf3c8bac3'; if patients.deathdate is null the...
SELECT T2.REASONDESCRIPTION, T2.DESCRIPTION , strftime('%J', T2.STOP) - strftime('%J', T2.START) AS days , CASE WHEN T1.deathdate IS NULL THEN 'alive' ELSE 'dead' END FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.ENCOUNTER = '23c293ec-dbae-4a22-896e-f12cf3c8bac3'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
social_media
Please list the texts of all the tweets in French posted by male users.
"French" is the language and refers to Lang = 'fr'; male user refers to Gender = 'Male'
SELECT T1.text FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' AND T1.Lang = 'fr'
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
bike_share_1
Which station did the user who started at Market at 4th station ended their trip at the time of 12:45:00 PM and the date of 8/29/2013 and what is the location coordinates of the ending station?
started at refers to start_station_name; start_station_name = 'Market at 4th'; location coordinates refers to (lat, long);
SELECT T1.name, T1.lat, T1.long FROM station AS T1 INNER JOIN trip AS T2 ON T2.end_station_name = T1.name WHERE T2.start_station_name = 'Market at 4th' AND T2.end_date = '8/29/2013 12:45'
CREATE TABLE weather ( zip_code TEXT, -- Example Values: `94107`, `94063`, `94301`, `94041`, `95113` | Value Statics: Total count 3665 - Distinct count 5 - Null count 0 max_visibility_miles INTEGER, -- Example Values: `10`, `9`, `8`, `20`, `15` | Value Statics: Total count 3652 - Distinct count 11 - Null count 13 ...
hockey
Which country produced the most number of hockey players? Identify which year was most of the hockey players are born.
Year most hockey players were born refers to MAX(birthYear); birthCountry refers to the country where a player was born
SELECT DISTINCT birthCountry, birthYear FROM Master GROUP BY birthCountry, birthYear ORDER BY COUNT(birthCountry) DESC LIMIT 1
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
synthea
How many types of medication have been prescribed to Mr. Major D'Amore since his visit to the hospital?
types of medications refers to medications.DESCRIPTION;
SELECT COUNT(DISTINCT T2.DESCRIPTION) FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Major' AND T1.last = 'D''Amore'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
social_media
How many more tweets with a positive sentiment than the tweets with a neutral sentiment were posted by male users?
positive sentiment tweet refers to Sentiment > 0; neutral sentiment refers to Sentiment = 0; male user refers to Gender = 'Male'; difference = Subtract (Count (TweetID where Sentiment > 0), Count (TweetID where Sentiment = 0))
SELECT SUM(CASE WHEN T1.Sentiment > 0 THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.Sentiment = 0 THEN 1 ELSE 0 END) AS diff FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male'
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
bike_share_1
How many stations were installed on the date of 8/16/2013 and how many users on those stations are classified as a customer?
installed on refers to installation_date; installation_date = '8/16/2013'; customers refers to subscription_type = customers;
SELECT COUNT(T1.name) , SUM(CASE WHEN T2.subscription_type = 'Customer' THEN 1 ELSE 0 END) FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE T1.installation_date = '8/16/2013' AND T2.subscription_type = 'Customer'
CREATE TABLE weather ( zip_code TEXT, -- Example Values: `94107`, `94063`, `94301`, `94041`, `95113` | Value Statics: Total count 3665 - Distinct count 5 - Null count 0 max_visibility_miles INTEGER, -- Example Values: `10`, `9`, `8`, `20`, `15` | Value Statics: Total count 3652 - Distinct count 11 - Null count 13 ...
hockey
How many players were included in the Hall of Fame on average between 1950 and 1980?
year BETWEEN 1950 and 1980; average = DIVIDE(COUNT(hofID)), 30)
SELECT CAST(COUNT(name) AS REAL) / 30 FROM HOF WHERE year BETWEEN 1950 AND 1980 AND category = 'Player'
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
synthea
How many patients with care plan for 'concussion with loss of consciousness' are married?
concussion with loss of consciousness refers to careplans.DESCRIPTION = 'Concussion with loss of consciousness'; married refers to marital = 'M';
SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.marital = 'M' AND T2.REASONDESCRIPTION = 'Concussion with loss of consciousness'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
social_media
Calculate the total likes collected by tweets in `ru` posted by male users.
'ru' refers to Lang = 'ru'; male user refers to Gender = 'Male'
SELECT SUM(T1.Likes) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.Lang = 'ru' AND T2.Gender = 'Male'
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
bike_share_1
Name the city of the station that trip ID 585842 borrowed a bike and indicate when that station was first installed.
when the station was first installed refers to installation_date;
SELECT T2.city, T2.installation_date FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.id = 585842
CREATE TABLE weather ( zip_code TEXT, -- Example Values: `94107`, `94063`, `94301`, `94041`, `95113` | Value Statics: Total count 3665 - Distinct count 5 - Null count 0 max_visibility_miles INTEGER, -- Example Values: `10`, `9`, `8`, `20`, `15` | Value Statics: Total count 3652 - Distinct count 11 - Null count 13 ...
hockey
What is the power play percentage of the team with the most number of loses?
Power play percentage refers to PPG, most number of loses refers to MAX(L)
SELECT CAST(SUM(PPG) AS REAL) * 100 / SUM(PPC) FROM Teams GROUP BY tmID ORDER BY SUM(L) DESC LIMIT 1
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
social_media
Among the tweets posted from Santa Fe state in Argentina, how many of them were posted on 31st?
"Sante Fe" is the State; "Argentina" is the Country; posted on 31st refers to Day = 31
SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.Day = 31 AND T2.State = 'Santa' AND T2.Country = 'Argentina'
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
bike_share_1
How many bikes have been borrowed at San Jose Diridon Caltrain Station on the date and time of 10/20/2013 8:11:01 AM and indicate the station's coordinates.
number of bikes that have been borrowed refers to SUM(bikes_available); San Jose Diridon Caltrain Station refers to name = 'San Jose Diridon Caltrain Station'; station's coordinates refers to (lat, long);
SELECT SUM(T2.bikes_available), T1.long, T1.lat FROM station AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.id WHERE T2.time = '2013/10/20 8:11:01' AND T1.name = 'San Jose Diridon Caltrain Station'
CREATE TABLE weather ( zip_code TEXT, -- Example Values: `94107`, `94063`, `94301`, `94041`, `95113` | Value Statics: Total count 3665 - Distinct count 5 - Null count 0 max_visibility_miles INTEGER, -- Example Values: `10`, `9`, `8`, `20`, `15` | Value Statics: Total count 3652 - Distinct count 11 - Null count 13 ...
hockey
Which NHL award was most frequently won by the coach with the most wins?
null
SELECT award FROM Teams AS T1 INNER JOIN AwardsCoaches AS T2 ON T1.lgID = T2.lgID WHERE T1.lgID = 'NHL' GROUP BY T2.coachID, T2.award ORDER BY COUNT(T2.award) DESC LIMIT 1
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
synthea
List out patient names with calcium deficiency.
patient names = first, last; calcium deficiency refers to observations.DESCRIPTION = 'Calcium' and observations.VALUE < 8.6;
SELECT DISTINCT T1.first, T1.last FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Calcium' AND T2.VALUE < 8.6
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
social_media
Among all the tweets with a positive sentiment, how many of them were posted by male users in Australia?
tweet with positive sentiment refers to Sentiment > 0; male user refers to Gender = 'Male'; 'Australia' is the Country
SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID INNER JOIN user AS T3 ON T3.UserID = T1.UserID WHERE T2.Country = 'Australia' AND T3.Gender = 'Male' AND T1.Sentiment > 0
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
bike_share_1
What is the shortest trip made starting from Franklin at Maple and what is the maximum wind speed at that date?
shortest trip refers to MIN(duration); starting from refers to start_station_name; start_station_name = 'Franklin at Maple'; maximum wind speed refers to max_wind_Speed_mph;
SELECT MIN(T1.duration), MAX(T2.max_wind_Speed_mph) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T1.start_station_name = 'Franklin at Maple' AND T2.date = '9/4/2013'
CREATE TABLE weather ( zip_code TEXT, -- Example Values: `94107`, `94063`, `94301`, `94041`, `95113` | Value Statics: Total count 3665 - Distinct count 5 - Null count 0 max_visibility_miles INTEGER, -- Example Values: `10`, `9`, `8`, `20`, `15` | Value Statics: Total count 3652 - Distinct count 11 - Null count 13 ...
hockey
Among the teams with the most number of ties, how many penalty was committed by a player or coach that is not on the ice? Indicate the name of the team.
penalty refers to BenchMinor; Ties refer to T
SELECT BenchMinor, name FROM Teams ORDER BY T DESC LIMIT 1
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
synthea
How long was Mr. Major D'Amore prescribed with Amoxicillin 250 MG / Clavulanate 125 MG [Augmentin]?
how long = SUBTRACT(julianday(medications.STOP, julianday(medications.START))); Amoxicillin 250 MG / Clavulanate 125 MG [Augmentin] refers to medications.DESCRIPTION = 'Amoxicillin 250 MG / Clavulanate 125 MG [Augmentin]';
SELECT strftime('%J', T2.STOP) - strftime('%J', T2.START) AS days FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = ' Amoxicillin 250 MG / Clavulanate 125 MG [Augmentin]' AND T1.first = 'Major' AND T1.last = 'D''Amore'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
social_media
Please list all the cities from where tweets with neutral sentiments were posted.
neutral sentiment refers to Sentiment = 0
SELECT DISTINCT T2.City FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE Sentiment = 0
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
bike_share_1
What is the average duration of trips for the starting station of Santa Clara at Almaden and what is the latitude and longitude of this station?
average duration = DIVIDE(SUM(duration), COUNT(id)); starting station refers to start_station_name; start_station_name = 'Santa Clara at Almaden'; latitude refers to lat; longitude refers to long;
SELECT AVG(T1.duration), T2.lat, T2.long FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name LEFT JOIN station AS T3 ON T3.name = T1.end_station_name WHERE T1.start_station_name = 'Santa Clara at Almaden'
CREATE TABLE weather ( zip_code TEXT, -- Example Values: `94107`, `94063`, `94301`, `94041`, `95113` | Value Statics: Total count 3665 - Distinct count 5 - Null count 0 max_visibility_miles INTEGER, -- Example Values: `10`, `9`, `8`, `20`, `15` | Value Statics: Total count 3652 - Distinct count 11 - Null count 13 ...
hockey
How many former athletes go on to become coaches after retiring?
null
SELECT COUNT(playerID) FROM Master WHERE playerID IS NOT NULL AND coachID IS NOT NULL
CREATE TABLE Scoring ( tmID TEXT, -- PIM INTEGER, -- PostA TEXT, -- GTG TEXT, -- Example Values: `0`, `1`, `3`, `2`, `5` | Value Statics: Total count 28106 - Distinct count 8 - Null count 17861 PostGP TEXT, -- GP INTEGER, -- lgID TEXT, -- Example Values: `NHL`, `WHA`, `PCHA`, `WCHL`, `NHA` | Value S...
synthea
List out all the observation information collected for the patient named Bella Rolfson.
observation information refers to observations.DESCRIPTION AND observations.VALUE AND observations.UNITS;
SELECT DISTINCT T2.DESCRIPTION, T2.VALUE, T2.UNITS FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Bella' AND T1.last = 'Rolfson'
CREATE TABLE immunizations ( foreign key (ENCOUNTER) references encounters(ID), CODE INTEGER, -- Example Values: `8`, `62`, `140`, `113`, `83` | Value Statics: Total count 13189 - Distinct count 16 - Null count 0 foreign key (PATIENT) references patients(patient), ENCOUNTER TEXT, -- PATIENT TEXT, -- DATE D...
social_media
From which city were more tweets posted, Bangkok or Chiang Mai?
"Bangkok" and "Chiang Mai" are both City
SELECT SUM(CASE WHEN T2.City = 'Bangkok' THEN 1 ELSE 0 END) AS bNum , SUM(CASE WHEN T2.City = 'Chiang Mai' THEN 1 ELSE 0 END) AS cNum FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.City IN ('Bangkok', 'Chiang Mai')
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...