db_id stringclasses 66
values | question stringlengths 24 325 | evidence stringlengths 1 673 ⌀ | gold_query stringlengths 23 804 | db_schema stringclasses 66
values |
|---|---|---|---|---|
bike_share_1 | What is the percentage ration of customers to subscribers that started their trips within the city of San Francisco? | customer refers to subscription_type = 'customer'; subscriber refers to subscription_type = 'subscriber'; started their trips within refers to start_station_id; percentage ratio = DIVIDE(SUM(subscription_type = 'Customer'), SUM(subscription_type = 'Subscriber')) as percentage; | SELECT CAST(SUM(CASE WHEN T1.subscription_type = 'Customer' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T1.subscription_type = 'Subscriber' THEN 1 ELSE 0 END) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'San Francisco' | 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 | For the goalie who had the highest defensive success rate in the postseason of 2011, what's his legends ID ? | Post season of 2011 refers to year = ’2011’
defensive success rate refers to (SUBTRACT(1 (DIVIDE(PostGA/PostSA)), *100%)
| SELECT T2.legendsID FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T1.year = 2011 ORDER BY 1 - CAST(T1.PostGA AS REAL) / T1.PostSA 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 | On what dates did the billable period begin for patients with the last name Dickinson? | dates when the billable period begin refers to BILLABLEPERIOD; | SELECT DISTINCT T2.BILLABLEPERIOD FROM patients AS T1 INNER JOIN claims AS T2 ON T1.patient = T2.PATIENT WHERE T1.last = 'Dickinson' | 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 posted from which city has a higher number of average likes, Bangkok or Chiang Mai? | "Bangkok" and "Chiang Mai" are both City; average number of like = Divide (Sum(Likes), Count(TweetID)) | SELECT SUM(CASE WHEN T2.City = 'Bangkok' THEN Likes ELSE NULL END) / COUNT(CASE WHEN T2.City = 'Bangkok' THEN 1 ELSE 0 END) AS bNum , SUM(CASE WHEN City = 'Chiang Mai' THEN Likes ELSE NULL END) / COUNT(CASE WHEN City = 'Chiang Mai' THEN TweetID ELSE NULL END) AS cNum FROM twitter AS T1 INNER JOIN location AS T2 ON T1.L... | 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 subscribers are in the zip code of 94301 and what is the hottest temperature recorded on that zip code? | hottest temperature refers to MAX(max_temperature_f); | SELECT COUNT(T3.zip_code), T3.max_temperature_f FROM trip AS T2 INNER JOIN weather AS T3 ON T3.zip_code = T2.zip_code WHERE T3.zip_code = 94301 AND T2.subscription_type = 'Subscriber' ORDER BY T3.max_temperature_f DESC LIMIT 1 | 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 percentage of winning rate of improvement since Alain Vigneault became the coach of Vancouver Canucks in 2006 season? | winning rate refers to DIVIDE (w, SUM(w, l)); Vancouver Canucks is name of team where tmID = 'VAN'
Winning rate refers to DIVIDE(wins in year = '2005/2006'(ADD(wins+loses); improvement refers to SUBTRACT(DIVIDE(wins in year = '2005'(ADD(wins+loses), DIVIDE(wins in year = '2006'(ADD(wins+loses))
| SELECT SUM(CASE WHEN T1.year = 2006 THEN CAST(T1.W AS REAL) * 100 / (T1.W + T1.L) ELSE 0 END) - ( SELECT CAST(W AS REAL) * 100 / (W + L) FROM Teams WHERE year = '2005' AND name = 'Vancouver Canucks' ) FROM Teams AS T1 INNER JOIN Coaches AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN Master AS T3 ON T2.coac... | 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 mothers have taken immunization during prenatal visit? | expecting mothers can be attributed to encounters.REASONDESCRIPTION = 'Normal pregnancy'; | SELECT COUNT(DISTINCT T2.PATIENT) FROM encounters AS T1 INNER JOIN immunizations AS T2 ON T1.PATIENT = T2.PATIENT WHERE T1.REASONDESCRIPTION = 'Normal pregnancy' AND T1.DATE = T2.DATE | 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 top 3 cities with the most number of tweets posted in Canada. | "Canada" is the Country; city with most number of tweets refers to City where Max(Count(TweetID)) | SELECT T.City FROM ( SELECT T2.City, COUNT(T1.TweetID) AS num FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.Country = 'Canada' GROUP BY T2.City ) T ORDER BY T.num 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, -- ... |
bike_share_1 | How many bikes could Evelyn Park and Ride hold and how many users who started on that station are subscribers? | number of bikes a station can hold refers to SUM(dock_count); Evelyn Park and Ride refers to name = 'Evelyn Park and Ride'; started on the station refers to start_station_name; subscribers refers to subscription_type = 'subscriber'; | SELECT SUM(T2.dock_count), COUNT(T1.subscription_type) FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.name = 'Evelyn Park and Ride' AND T1.start_station_name = T2.name AND T1.subscription_type = 'Subscriber' | 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 | For the goalies whose weight are above 190, who had most goal againsts in 1978 season? | Weight of above 190 refers to weight >190; 1978 season refers to the year played | SELECT T1.playerID FROM Goalies AS T1 INNER JOIN Master AS T2 ON T1.playerID = T2.playerID WHERE T1.year = '1978' AND T2.weight > 190 ORDER BY T1.GA 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 | What is the average number of likes for a tweet posted by a male user on Mondays? | male user refers to Gender = 'Male'; 'Monday' is the Weekday; average number of likes = Divide (Sum(Likes), Count(TweetID)) | SELECT SUM(T1.Likes) / COUNT(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, -- ... |
bike_share_1 | Which city is Townsend at 7th Station located and how many bikes could it hold? | Townsend at 7th Station refers to city = 'Townsend at 7th Station'; number of bikes a station can hold refers to SUM(dock_count); | SELECT city, SUM(dock_count) FROM station WHERE name = 'Townsend at 7th' | 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 | Who was the coach for the team which had the most bench minors penalty in 2003? | Coach of the team refers to firstName+lastName; 2003 refers to the year
| SELECT DISTINCT T3.firstName, T3.lastName FROM Teams AS T1 INNER JOIN Coaches AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year INNER JOIN Master AS T3 ON T2.coachID = T3.coachID WHERE T1.year = '2003' GROUP BY T3.firstName, T3.lastName ORDER BY SUM(T1.BenchMinor) 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 | List down all the tweet text posted from Australia. | "Australia" is the Country | SELECT T1.text FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE 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 | List the names of the stations within Mountain View that were installed on 12/31/2013. | Mountain View refers to city = 'Mountain View'; installed on 12/31/2013 refers to installation_date = '12/31/2013'; | SELECT name FROM station WHERE installation_date = '12/31/2013' AND city = 'Mountain View' | 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 shots on goal did Cam Neely had in the year of 1990? | 1990 refers to the year played; Shot on goal refers to SOG
| SELECT T2.SOG FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID WHERE T1.firstName = 'Cam' AND T1.lastName = 'Neely' AND T2.year = '1990' | 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 the full name of all patients with 'otitis media'. | full name = first, last; otitis media refers to conditions.DESCRIPTION = 'Otitis media'; | SELECT DISTINCT T1.first, T1.last FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Otitis media' | 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... |
cs_semester | Please list the names of the courses that are less important than Machine Learning Theory. | lower credit means less important; | SELECT name FROM course WHERE credit < ( SELECT credit FROM course WHERE name = 'Machine Learning Theory' ) | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | Count the number of subscribers who started their trips in Market at 4th. | subsscriber refers to subscription_type = subscriber; started their trips in refers to start_station_name; start_station_name = 'Market at 4th'; | SELECT COUNT(CASE WHEN subscription_type = 'Subscriber' AND start_station_name = 'Market at 4th' THEN id END) FROM trip | 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 | Who was the most clutch player in 1986? Give his full name. | clutch player' and 'trustworthy player in the critical moment' are synonyms; most clutch player refers to the most trustworthy player which refers to MAX(GWG); 1986 is the year played | SELECT T1.firstName, T1.lastName FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1986 GROUP BY T2.playerID ORDER BY SUM(T2.GWG) 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 care plan, procedure, medication and the patient's full name for encounter 6f2e3935-b203-493e-a9c0-f23e847b9798? | car plan refers to careplans.DESCRIPTION; procedure refers to procedures.DESCRIPTION; medication refers to medications.DESCRIPTION; full name = first, last; encounter refers to encounters.ID; encounters.ID = '6f2e3935-b203-493e-a9c0-f23e847b9798'; | SELECT DISTINCT T3.DESCRIPTION, T4.DESCRIPTION, T5.DESCRIPTION, T1.first, T1.last FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT INNER JOIN careplans AS T3 ON T1.patient = T3.PATIENT INNER JOIN procedures AS T4 ON T1.patient = T4.PATIENT INNER JOIN medications AS T5 ON T1.patient = T5.PATIEN... | 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 sent by male users in Argentina, what is the text of the one with the most number of likes? | male user refers to Gender = 'Male'; 'Argentina' is the Country; most number of likes refers to Max(Likes) | SELECT T2.text FROM user AS T1 INNER JOIN twitter AS T2 ON T1.UserID = T2.UserID INNER JOIN location AS T3 ON T2.LocationID = T3.LocationID WHERE T3.Country = 'Argentina' AND T1.Gender = 'Male' ORDER BY T2.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, -- ... |
bike_share_1 | Which bicycle is the least used bike. Check if the start and end station are from the same city and calculate the total duration travelled by the bicycle in hours for a trip made within the same city. | least used bike refers to bike_id with MIN(COUNT(main_trip.id)); start station refers to start_station_name; end station refers to end_station_name; total duration in hour = DIVIDE(duration, 3600) AS hour; | SELECT T2.bike_id, T2.start_station_name, T2.end_station_name, T1.city , CAST(T2.duration AS REAL) / 3600 FROM station AS T1 INNER JOIN trip AS T2 ON T1.name = T2.start_station_name GROUP BY T2.bike_id ORDER BY COUNT(T2.id) DESC LIMIT 1 | 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 | For the player who scored 7 shorthanded goals in 1989, what's his dominant hand? | 1989 refers to the year of scoring; "dominant hand" and "shooting hand" are synonyms which refers to shootCatch
| SELECT T1.shootCatch FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1989 GROUP BY T2.playerID HAVING SUM(T2.SHG) = 7 | 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... |
cs_semester | Which professor advised Faina Mallinar to become a research assistant? Please give his or her full name. | research assistant refers to the student who serves for research where the abbreviation is RA; full name refers to f_name and l_name; | SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Faina' AND T3.l_name = 'Mallinar' | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | What is the total trip duration made within Palo Alto city? Convert the duration to hour. | total trip duration to hour = DIVIDE(SUM(duration), 3600); | SELECT CAST(SUM(T1.duration) AS REAL) / 3600 FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'Palo Alto' | 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's the weight of the player who had the most Power Play Goals in the 21st century? | 21st century refers to year >2000; Power play goals refers to PPG | SELECT T1.weight FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID WHERE T2.year > 2000 GROUP BY T1.playerID, T1.weight ORDER BY SUM(T2.PPG) 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 5 most common conditions for underweight patient. | most common condition refers to MAX(COUNT(conditions.DESCRIPTION)); underweight patient refers to MIN(observations.VALUE WHERE observations.DESCRIPTION = 'Body Mass Index'); | SELECT DISTINCT T2.DESCRIPTION, T2.VALUE, T2.UNITS FROM patients AS T1 INNER JOIN observations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Body Mass Index' GROUP BY T2.VALUE ORDER BY COUNT(T2.VALUE) LIMIT 5 | 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... |
cs_semester | Which course is more difficult, Intro to BlockChain or Computer Network? | diff refers to difficulty; diff is higher means the course is more difficult; | SELECT name FROM course WHERE name = 'Intro to BlockChain' OR name = 'Computer Network' ORDER BY diff DESC LIMIT 1 | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | What is the ratio of customer to subscriber that making a trip inside Mountain View city? | customer refers to subscription_type = 'customer'; subscriber refers to subscription_type = 'subscriber'; ratio = MULTIPLY(DIVIDE(COUNT(subscription_type = 'Customer'), COUNT(subscription_type = 'Subscriber'). 1.0)) AS ratio; | SELECT CAST(SUM(CASE WHEN T1.subscription_type = 'Customer' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T1.subscription_type = 'Subscriber' THEN 1 ELSE 0 END) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'Mountain View' | 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 | For he who had the highest plus / minus on the court in the 1981 season, what's his full name? | highest Plus/minus refers to MAX(+/-); full name refers to firstName, lastName; 1981 season refers to year = '1981'
| SELECT T1.firstName, T1.lastName FROM Master AS T1 INNER JOIN Scoring AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1981 GROUP BY T2.playerID ORDER BY SUM(T2.`+/-`) 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... |
cs_semester | What is the phone number of Kerry Pryor? | null | SELECT phone_number FROM student WHERE l_name = 'Pryor' AND f_name = 'Kerry' | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | Does the bike with Id number 16 making any intercity trip? If yes, calculate the total travel duration during all the intercity trip. Convert the duration to hour. | intercity trip refers to start_station_name! = end_station_name; total travel duration to hour = DIVIDE(SUM(duration), 3600) AS hour; | SELECT T1.end_station_name, T2.city, CAST(SUM(T1.duration) AS REAL) / 3600 FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.bike_id = 16 AND T1.start_station_name != T1.end_station_name | 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 | When was the birthday for the goalie who had most goal againsts in 1965 season? | Birthday refers to CONCAT(birthYear / birthMon / birthDate);most goal against refers to MAX(GA);1965 season refers to year = '1965'
| SELECT T1.birthYear, T1.birthMon, birthDay FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1965 ORDER BY T2.GA 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 the procedure and medicine prescribed for drug overdose patients. | procedure refers to procedures.DESCRIPTION; medicine prescribed refers to medications.DESCRIPTION; drug overdose refers to encounters.REASONDESCRIPTION = 'Drug overdose'; | SELECT DISTINCT T2.DESCRIPTION, T3.DESCRIPTION FROM encounters AS T1 INNER JOIN procedures AS T2 ON T1.PATIENT = T2.PATIENT INNER JOIN medications AS T3 ON T1.PATIENT = T3.PATIENT WHERE T1.REASONDESCRIPTION = 'Drug overdose' | 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 | Write down the tweet text posted from Rawang, Selangor, Malaysia. | "Rawang" is the City; "Selangor" is the State; "Malaysia" is the Country | SELECT T1.text FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.City = 'Rawang' AND T2.State = 'Selangor' AND T2.Country = 'Malaysia' | 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 | Is there any intercity trip were made during 2014? If yes, list out the city name for the start and end station. | intercity trip refers to start_station_name! = end_station_name; during 2014 refers to start_date like '%2014%'; start station refers to start_station_name; end station refers to end_station_name; | SELECT T1.start_station_name, T1.end_station_name FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.start_date LIKE '%/%/2014%' AND T1.start_station_name != T1.end_station_name | 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 is the catching hand for the goaltender who had the most shutouts in 1996? | the most shutouts refers to max(SHO); catching hand for the goaltender refers to shootCatch; shootCatch = 'L' refers to lefthand; shootCatch = 'R' refers to righthand; shootCatch = 'null' or 'empty' means this player is good at both left and right hand | SELECT T1.shootCatch FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1996 ORDER BY T2.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 | What care plans have been received by Mrs. Elly Koss during year 1970? | during year 1970 refers to substr(careplans.START, 1, 4) = '1970' and substr(careplans.STOP, 1, 4) = '1970'; | SELECT T2.DESCRIPTION FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND strftime('%Y', T2.START) = '2013' | 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 | Which country's tweets collected the most likes? | country collected the most likes refers to Country where Max(Sum(Likes)) | SELECT T.Country FROM ( SELECT T2.Country, SUM(T1.Likes) AS num FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID GROUP BY T2.Country ) T ORDER BY T.num 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, -- ... |
bike_share_1 | How many bicycle trip were made within San Jose city during August 2013? | during August 2013 refers to start_date like '8/%/2013%'; | SELECT COUNT(T2.id) FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE T1.city = 'San Jose' AND T2.start_date LIKE '8/%/2013%' AND T2.start_station_name LIKE 'San Jose%' AND T2.end_station_name LIKE 'San Jose%' | 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 years were there after Don Waddell retired and became a coach in NHL? | after retired and became a coach refers to max(subtract(year, lastNHL)) | SELECT MAX(T2.year) - MIN(T2.year) FROM Master AS T1 INNER JOIN Coaches AS T2 ON T1.coachID = T2.coachID WHERE T1.firstName = 'Don' AND T1.lastName = 'Waddell' | 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 unmarried women were checked for normal pregnancy? | unmarried refers to marital = 'S'; women refers to gender = 'F'; normal pregnancy refers to conditions.DESCRIPTION = 'normal pregnancy'; | SELECT COUNT(DISTINCT T2.patient) FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Normal pregnancy' AND T2.gender = 'F' AND T2.marital = 'S' | 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... |
cs_semester | Please list the full names of all the students who are research assistants with the highest research capability. | research assistant refers to the student who serves for research where the abbreviation is RA; the highest research capability refers to capability = 5; full name refers to f_name and l_name; | SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN RA AS T2 ON T1.student_id = T2.student_id WHERE T2.capability = 5 | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | List out all stations name that having a mean temperature 20 degree Celsius in year 2014. | mean temperature refers to mean_temperature_f; mean temperature of 20 degree Celsius refers to DIVIDE(SUBTRACT(mean_temperature_f, 32), 1.8) = 20; in 2014 refers to date LIKE'%2015%'; | SELECT DISTINCT T2.start_station_name, T2.end_station_name FROM weather AS T1 INNER JOIN trip AS T2 ON T1.zip_code = T2.zip_code WHERE T1.date LIKE '%2014' AND T1.mean_temperature_f = 20 * 1.8 + 32 | 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 year was the goalie who had the most postseaon shots Against in 2008 born? | the most postseason shots Against refers to max(PostSA); year born refers to birthYear | SELECT T1.birthYear FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 2008 ORDER BY T2.PostSA 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 difference between average glucose reading for patients in the 20s and 50s? | sum(case when t2.DATE-t1.birthdate between 20 and 29 then t2.VALUE else 0 end)/count(case when t2.DATE-t1.birthdate between 20 and 29 then t2.PATIENT else null end)-sum(case when t2.DATE-t1.birthdate between 50 and 59 then t2.VALUE else 0 end)/count(case when t2.DATE-t1.birthdate between 50 and 59 then t2.PATIENT else ... | SELECT SUM(CASE WHEN ROUND((strftime('%J', T2.DATE) - strftime('%J', T1.birthdate)) / 365) BETWEEN 20 AND 30 THEN T2.VALUE ELSE 0 END) / COUNT(CASE WHEN ROUND((strftime('%J', T2.DATE) - strftime('%J', T1.birthdate)) / 365) BETWEEN 20 AND 30 THEN T2.PATIENT END) - SUM(CASE WHEN ROUND((strftime('%J', T2.DATE) - strftime(... | 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... |
cs_semester | How many professors are more popular than Zhou Zhihua? | higher popularity means the professor is more popular; | SELECT COUNT(prof_id) FROM prof WHERE popularity > ( SELECT popularity FROM prof WHERE first_name = 'Zhihua' AND last_name = 'Zhou' ) | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | Are all stations with zip code 94107 located in San Francisco city? | station refers to name; | SELECT DISTINCT T2.city FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.zip_code = 94107 | 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 | For the team which had three different goalies in the 2011 postseason games, how many games did they win in the regular season? | three different goalies refer to count(playerID) = 3; game won refers to W | SELECT SUM(T2.W) FROM Goalies AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID WHERE T2.year = 2011 GROUP BY T1.tmID HAVING COUNT(DISTINCT T1.playerID) = 3 | 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... |
cs_semester | Please list the full names of all the students who took the course Machine Learning Theory. | full name refers to f_name and l_name; | SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Machine Learning Theory' | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | What is the ratio for subscriber to customer given that the starting and the ending stations is 2nd at South Park? | subscriber refers to subscription_type = 'Subscriber'; customer refers to subscription_type = 'customer';starting station refers to start_station_name; ending station refers to end_statio_name; start_station_name = '2nd at South Park' AND end_station_name = '2nd at South Park' | SELECT CAST(SUM(IIF(subscription_type = 'Subscriber', 1, 0)) AS REAL) / SUM(IIF(subscription_type = 'Customer', 1, 0)) FROM trip WHERE start_station_name = '2nd at South Park' AND end_station_name = '2nd at South Park' | 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 position did player id "hartgi01" play in his Stanley Cup finals performance? | position refers to pos | SELECT DISTINCT pos FROM ScoringSC WHERE playerID = 'hartgi01' | 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 male patients are diagnosed with hypertension as compared to female patients? | male refers to gender = 'M'; diagnosed with hypertension refers to conditions.DESCRIPTION = 'Hypertension'; female refers to gender = 'F'; number of male patients with hypertension = count(patient WHERE gender = 'M' AND conditions.DESCRIPTION = 'Hypertension'); number of female patients with hypertension = count(patien... | SELECT COUNT(DISTINCT CASE WHEN T2.gender = 'M' THEN T2.patient END) AS Male , COUNT(DISTINCT CASE WHEN T2.gender = 'F' THEN T2.patient END) AS Female FROM conditions AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Hypertension' | 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... |
cs_semester | How many research assistants does Sauveur Skyme have? | research assistant refers to the student who serves for research where the abbreviation is RA; | SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.first_name = 'Sauveur' AND T2.last_name = 'Skyme' | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | Convert all temperature recorded at San Francisco city during August 2013 into degree Celsius. | temperature refers to max_temperature_f; March 2013 refers to date like '3/%/2013'; conversion to Celcius = DIVIDE(SUBTRACT(max_temperature_f, 32), 1.800) as Celsius1; DIVIDE(SUBTRACT(mean_temperature_f, 32), 1.800) as Celsius2; DIVIDE(SUBTRACT(min_temperature_f, 32), 1.800) as Celcius3; | SELECT (max_temperature_f - 32) / 1.8000 , (mean_temperature_f - 32) / 1.8000 , (min_temperature_f - 32) / 1.8000 FROM weather WHERE SUBSTR(CAST(date AS TEXT), 1, INSTR(date, '/') - 1) = '8' AND SUBSTR(CAST(date AS TEXT), -4) = '2013' AND zip_code = 94107 | 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 league did player id"adamsja01" play in 1920? | which league refers to lgID | SELECT lgID FROM ScoringSC WHERE playerID = 'adamsja01' AND year = 1920 | 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... |
cs_semester | Which student failed the course Intro to Database 2? Please give his or her full name. | If grade is NULL, it means that this student fails to pass the course; full name refers to f_name and l_name; | SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T2.grade IS NULL AND T3.name = 'Intro to Database 2' | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | What is the longest trip duration according? Convert the it to number of days. | longest trip duration refers to MAX(duration); days conversion = DIVIDE(duration, 86400); | SELECT MAX(duration), CAST(MAX(duration) AS REAL) / 86400 FROM trip | 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 | Who made the most assists in a single game in the Stanley Cup finals ? | the most assists refers to max(A) | SELECT playerID FROM ScoringSC ORDER BY A 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 old was Mr. Stacy Morar at the time of his first emergency room admission due to a drug overdose? | how old = SUBTRACT(MIN(encounters.DATE), patients.birthdate); his first emergency room admission refers to MIN(encounters.DATE); drug overdose refers to encounters.REASONDESCRIPTION = 'Drug overdose' ; | SELECT T2.DATE - T1.birthdate AS age FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Stacy' AND T1.last = 'Morar' AND T2.DESCRIPTION = 'Emergency Room Admission' AND T2.REASONDESCRIPTION = 'Drug overdose' ORDER BY T2.DATE LIMIT 1 | 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... |
cs_semester | How many research assistants of Ogdon Zywicki have an average salary? | research assistant refers to the student who serves for research where the abbreviation is RA; average salary refers to salary = 'med'; | SELECT COUNT(T1.prof_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.first_name = 'Ogdon' AND T1.salary = 'med' AND T2.last_name = 'Zywicki' | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | What is the total number of bikes that can be hold in Redwood City before 2014. | total number of bikes that can be hold = MAX(dock_count); before 2014 refers to year(installation_date)<2014; | SELECT SUM(CASE WHEN city = 'Redwood City' AND SUBSTR(installation_date, -4) < '2014' THEN dock_count ELSE 0 END) NUM FROM 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 | What was the number of goals did player Id "dyeba01" make in the 1921 Stanley Cup finals? | the number of goals refers to G | SELECT G FROM ScoringSC WHERE playerID = 'dyeba01' AND year = 1921 | 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 average body mass index for patients with higher total cholesterol? | average body mass index = DIVIDE(SUM(observations.VALUE), COUNT(PATIENT) WHERE observations.DESCRIPTION = 'Body Mass Index'); body mass index refers to observations.DESCRIPTION = 'Body Mass Index'; higher total cholesterol refers to observations.DESCRIPTION = 'Total Cholesterol' and observations.VALUE > = 200; | SELECT SUM(T1.VALUE) / COUNT(T1.PATIENT) FROM observations AS T1 INNER JOIN ( SELECT DISTINCT PATIENT FROM observations WHERE DESCRIPTION = 'Total Cholesterol' AND VALUE > 200 ) AS T2 ON T1.PATIENT = T2.PATIENT WHERE T1.DESCRIPTION = 'Body Mass Index' | 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... |
cs_semester | Please list the names of the courses taken by Laughton Antonio. | null | SELECT T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.f_name = 'Laughton' AND T1.l_name = 'Antonio' | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | How many rainy days were recorded in Mountain View? | rainy days refers to events = 'rain'; Mountain View refers to zip_code = 94041; | SELECT SUM(IIF(zip_code = 94041 AND events = 'Rain', 1, 0)) FROM weather | 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 years did player Id "cleghsp01" make to the Stanley Cup finals? | the number of years refers to count(year) | SELECT COUNT(year) FROM ScoringSC WHERE playerID = 'cleghsp01' | 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... |
cs_semester | Among the professors who have more than 3 research assistants, how many of them are male? | research assistant refers to the student who serves for research where the abbreviation is RA; more than 3 research assistant refers to COUNT(student_id) > 3; | SELECT COUNT(*) FROM ( SELECT T2.prof_id FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.gender = 'Male' GROUP BY T1.prof_id HAVING COUNT(T1.student_id) > 3 ) | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | List out all end stations for a bicycle that were making a trip starting from 2nd at South Park station? Only retain the unique value. | end station refers to end_station_name; starting from refers to start_station_name; start_station_name = '2nd at South Park'; | SELECT DISTINCT end_station_name FROM trip WHERE start_station_name = '2nd at South Park' | 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 | In the Stanley Cup finals history, how many games did player id "broadpu01" play in 1922? | the number of games refers to GP | SELECT GP FROM ScoringSC WHERE playerID = 'broadpu01' AND YEAR = 1922 | 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 | Name the reason Walter Bahringer visited medical professionals in July 2009. | reason for visiting medical professionals refers to encounters.REASONDESCRIPTION; in July 2009 refers to substr(encounters.DATE, 1, 7) = '2009-07' ; | SELECT T2.REASONDESCRIPTION FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Walter' AND T1.last = 'Bahringer' AND T2.DATE LIKE '2009-07%' | 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... |
cs_semester | Among the students who got a B in the course Machine Learning Theory, how many of them have a gpa of over 3? | B refers to grade; GPA is an abbreviated name of Grade Point Average where over 3 refers to gpa > 3; | SELECT COUNT(student_id) FROM registration WHERE grade = 'B' AND student_id IN ( SELECT student_id FROM student WHERE gpa > 3 AND course_id IN ( SELECT course_id FROM course WHERE name = 'Machine Learning Theory' ) ) | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | What is the average duration of a bike trip made on the day with the hottest temperature ever in 2014? | average duration = DIVIDE(SUM(duration), COUNT(id)); hottest temperature refers to max_temperature_f; in 2014 refers to date LIKE '%2014'; | SELECT AVG(T1.duration) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2014%' AND T1.start_station_name = '2nd at Folsom' AND T2.max_temperature_f = ( SELECT max_temperature_f FROM weather ORDER BY max_temperature_f DESC LIMIT 1 ) | 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 | For the team had the biggest power play percentage in 2011, who was their coach that season? Give the full name. | the biggest power play percentage = max(divide(PPG, PPC)) | SELECT T1.coachID FROM Coaches AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID WHERE T2.year = 2011 ORDER BY CAST(T2.PPG AS REAL) / T2.PPC 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 women need to take 'Nitroglycerin 0.4 MG/ACTUAT [Nitrolingual]'? | women refers to gender = 'F'; Nitroglycerin 0.4 MG/ACTUAT [Nitrolingual] refers to medications.DESCRIPTION = 'Nitroglycerin 0.4 MG/ACTUAT [Nitrolingual]' | SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Nitroglycerin 0.4 MG/ACTUAT [Nitrolingual]' AND T1.gender = 'F' | 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... |
cs_semester | Which student is more satisfied with the course Machine Learning Theory, Willie Rechert or Laughton Antonio? | sat refers to student's satisfaction degree with the course; more satisfied refers to MAX(sat); | SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE (T1.f_name = 'Laughton' OR T1.f_name = 'Willie') AND (T1.l_name = 'Antonio' OR T1.l_name = 'Rechert') AND T3.name = 'Machine Learning Theory' ORDER B... | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | On the day with the hottest temperature ever in 2014, how many bike trips started from the station 2nd at Folsom? | hottest temperature refers to max_temperatutre_f; in 2014 refers to date LIKE '%2014'; started from station refers to start_station_name; start_station_name = '2nd at Folsom'; | SELECT COUNT(T1.start_station_name) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2014%' AND T2.zip_code = 94107 AND T1.start_station_name = '2nd at Folsom' ORDER BY T2.max_temperature_f DESC LIMIT 1 | 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 coach had the highest winning rates in the 2009 season? What's coach's nickname. | the highest winning rate refer to divide(W, sum(W, L)) | SELECT T2.coachID, T1.nameNick FROM Master AS T1 INNER JOIN Coaches AS T2 ON T1.coachID = T2.coachID WHERE T2.year = 2009 ORDER BY CAST(T2.W AS REAL) / (T2.W + T2.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... |
synthea | Please include the full name of the patient who received a lung transplant. | full name = first, last; lung transplant refers to procedures.DESCRIPTION = 'Transplant of lung (procedure)'; | SELECT T2.first, T2.last FROM procedures AS T1 INNER JOIN patients AS T2 ON T1.PATIENT = T2.patient WHERE T1.DESCRIPTION = 'Transplant of lung (procedure)' | 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... |
cs_semester | Which professor advised Willie Rechert to work as a research assistant? Please give his or her full name. | research assistant refers to the student who serves for research where the abbreviation is RA; prof_id refers to professor’s ID; full name refers to f_name and l_name; | SELECT T1.first_name, T1.last_name FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.f_name = 'Willie' AND T3.l_name = 'Rechert' | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | How many trips with a bike borrowed from the stations in San Francisco were made by a subscriber? | bike was borrowed from refers to start_station_id; San Francisco refers to city = 'San Francisco'; subscriber refers to subscription_type = 'Subscriber'; | SELECT COUNT(T1.id) FROM trip AS T1 INNER JOIN station AS T2 ON T2.ID = T1.start_station_id WHERE T2.city = 'San Francisco' AND T1.subscription_type = 'Subscriber' | 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 | For the team which had the most postseason shutouts in 1995, how many points did they have that year? | points refer to Pts; the most postseason shutouts refers to max(PostSHO) | SELECT SUM(T2.SHO) FROM Scoring AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 1995 GROUP BY T2.tmID ORDER BY SUM(T2.PostSHO) 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 percentage of the most common conditions for patients age 60 and above? | most common condition refers to MAX(COUNT(conditions.DESCRIPTION)); age 60 and above refers to SUBTRACT(conditions.START, birthdate) > 60; percentage = MULTIPLY(DIVIDE(SUM(patients.patient WHERE MAX(COUNT(conditions.DESCRIPTION)) AND SUBTRACT(conditions.START, birthdate) > 60))), COUNT(patients.patient WHERE MAX(COUNT(... | SELECT CAST(SUM(CASE WHEN T5.DESCRIPTION = T3.DESCRIPTION THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.patient) FROM ( SELECT T2.DESCRIPTION, T1.patient FROM patients AS T1 INNER JOIN conditions AS T2 ON T1.patient = T2.PATIENT WHERE ROUND((strftime('%J', T2.START) - strftime('%J', T1.birthdate)) / 365) > 60 GROUP BY T... | 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 | State the country where the most positive sentiment tweets were posted. | country with the most positive sentiment tweet refers to Country where Max(Count(Sentiment > 0)) | SELECT T.Country FROM ( SELECT T2.Country, SUM(T1.Sentiment) AS num FROM twitter AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.Sentiment > 0 GROUP BY T2.Country ) T ORDER BY T.num 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, -- ... |
bike_share_1 | When was the bike station from which the bike was borrowed on trip ID4069 installed? | bike was borrowed from refers to start_station_id; when the bike station was installed refers to installation_date; | SELECT T2.installation_date FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.id = 4069 | 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 teams had the most postseason empty net goals in 2010 season? List their team names. | most postseason empty net goals refers to max(PostENG) | SELECT T2.name FROM Goalies AS T1 INNER JOIN Teams AS T2 ON T1.tmID = T2.tmID WHERE T1.year = 2010 GROUP BY T2.name ORDER BY SUM(PostENG) 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 | Indicate the time frame and details of the most recent care plan suggested to Jacquelyn Shanahan. | time frame = SUBTRACT(JULIANDAY(careplans.STOP), JULIANDAY(careplans.START)); details of care plan refers to careplans.DESCRIPTION; most recent care plan refers to MIN(careplans.STAR); | SELECT strftime('%J', T2.STOP) - strftime('%J', T2.START) AS timeFrame , T2.DESCRIPTION FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Jacquelyn' AND T1.last = 'Shanahan' ORDER BY T2.START DESC LIMIT 1 | 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... |
cs_semester | Give the number of research postgraduate students. | RPG is an abbreviated name of research postgraduate student in which type = 'RPG'; | SELECT COUNT(student_id) FROM student WHERE type = 'RPG' | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | What is the longest duration for a bike trip starting on a day with a fog in 2013? | longest duration refers to MAX(duration); starting on a day with a fog refers to start_date where events = 'fog'; in 2013 refers to date LIKE '%2013'; | SELECT MAX(T1.duration) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2013%' AND T2.events = 'Fog' AND T2.zip_code = 94107 | 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 | In the history of team id NJD, which goalie saved the most goal attempts? Give his full name. | saved the most goal attempts refers to max(subtract(SA, GA)); team id refers to tmID | SELECT T1.firstName, T1.lastName FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.tmID = 'NJD' GROUP BY T2.playerID ORDER BY SUM(T2.SA - T2.GA) 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 drug is administered more often to treat child attention deficit disorder? | drug that was administered refers to medications.DESCRIPTION; child attention deficit disorder refers to medications.REASONDESCRIPTION = 'Child attention deficit disorder'; | SELECT DESCRIPTION FROM medications WHERE REASONDESCRIPTION = 'Child attention deficit disorder' GROUP BY DESCRIPTION ORDER BY COUNT(DESCRIPTION) DESC LIMIT 1 | 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... |
cs_semester | Among the students who took the course Machine Learning Theory, how many of them are undergraduates? | UG is an abbreviated name of undergraduate student in which type = 'UG'; | SELECT COUNT(T1.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Machine Learning Theory' AND T1.type = 'UG' | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | Among the bike trips started on the days with a fog in 2013, how many of those trips started from the station "2nd at Townsend"? | started on the days with a fog refers to start_date where events = 'fog'; in 2013 refers to date LIKE '%2013'; started from station refers to start_station_name; start_station_name = '2nd at Townsend'; | SELECT COUNT(T1.start_station_name) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2013%' AND T2.events = 'Fog' AND T1.start_station_name = '2nd at Townsend' AND T2.zip_code = 94107 | 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 | Who is the youngest goalie among those who had more than 150 goal againsts in 2002 season? | youngest goalie refers to max(birthYear/birthMon/birthDay); more than 150 goal againsts refers to GA>150 | SELECT T1.firstName, T1.lastName FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 2002 AND T2.GA > 150 GROUP BY T2.playerID, T1.birthYear, T1.birthMon, T1.birthMon HAVING SUM(T2.GA) ORDER BY T1.birthYear DESC, T1.birthMon DESC, SUM(T1.birthDay) 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 patients on average receive combined chemotherapy and radiation therapy procedures each year? | average = DIVIDE(COUNT(procedures.PATIENT), COUNT(substr(procedures.DATE, 1, 4))); combined chemotherapy and radiation therapy refers to procedures.DESCRIPTION = 'Combined chemotherapy and radiation therapy (procedure)'; | SELECT CAST(COUNT(PATIENT) AS REAL) / COUNT(DISTINCT strftime('%Y', DATE)) FROM procedures WHERE DESCRIPTION = 'Combined chemotherapy and radiation therapy (procedure)' | 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... |
cs_semester | What is the average satisfying degree of the course Machine Learning Theory? | sat refers to student's satisfaction degree with the course; | SELECT CAST(SUM(T1.sat) AS REAL) / COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.name = 'Machine Learning Theory' | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
bike_share_1 | How many docks were left at the end station for trip ID4069? | end station refers to end_station_id; docks that were left refers to docks_available; | SELECT SUM(T2.docks_available) FROM trip AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.end_station_id WHERE T1.ID = 4069 | 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 | For the goalie who had the most shutouts in 2010, what's his catching hand? | the most shutouts refers to max(SHO); shootCatch = 'L' refers to lefthand; shootCatch = 'R' refers to righthand; shootCatch = 'null' or 'empty' means this player is good at both left and right hand | SELECT T1.shootCatch FROM Master AS T1 INNER JOIN Goalies AS T2 ON T1.playerID = T2.playerID WHERE T2.year = 2010 GROUP BY T2.playerID ORDER BY SUM(T2.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... |
cs_semester | For the 3-credit course with the easiest difficulty, how many students get an "A" in that course? | diff refers to difficulty; diff is higher means the course is more difficult in which easiest difficulty refers to diff = 1; 3-credit course refers to credit = '3'; get an "A" refers to grade = 'A' for the course; | SELECT COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T1.grade = 'A' AND T2.credit = '3' AND T2.diff = 1 | CREATE TABLE prof
(
teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0
gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0
email TEXT, -- Example Values: `npigford0@... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.