table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic ... | how many patients are married and lab tested with item id 50946? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "MARRIED" AND lab.itemid = "50946" |
CREATE TABLE table_name_17 (
date VARCHAR,
record VARCHAR
) | What date had a record of 43-34? | SELECT date FROM table_name_17 WHERE record = "43-34" |
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE chartevent... | what were the top four most frequently ordered lab tests for patients in the same hospital encounter after the diagnosis of polyp of corpus uteri? | SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id W... |
CREATE TABLE table_47765 (
"Official Name" text,
"Status" text,
"Area km 2" real,
"Population" real,
"Census Ranking" text
) | What is the Population of the Parish with an Area km 2 of 236.76? | SELECT MIN("Population") FROM table_47765 WHERE "Area km 2" = '236.76' |
CREATE TABLE table_16869 (
"Player" text,
"No." real,
"Nationality" text,
"Position" text,
"Years for Jazz" text,
"School/Club Team" text
) | For how many players from UTEP can one calculate how many years they've played for Jazz? | SELECT COUNT("Years for Jazz") FROM table_16869 WHERE "School/Club Team" = 'UTEP' |
CREATE TABLE table_46072 (
"Religion" text,
"Suriname" text,
"Paramaribo" text,
"Wanica" text,
"Nickerie" text,
"Coronie" text,
"Saramacca" text,
"Commewijne" text,
"Marowijne" text,
"Para" text,
"Brokopondo" text,
"Sipaliwini" text
) | What religion has a para of 56.5%? | SELECT "Religion" FROM table_46072 WHERE "Para" = '56.5%' |
CREATE TABLE table_72299 (
"Episode" text,
"Song choice" text,
"Original artist" text,
"Order #" text,
"Result" text
) | What's the original artist of the song performed in the top 3 episode? | SELECT "Original artist" FROM table_72299 WHERE "Episode" = 'Top 3' |
CREATE TABLE Courses (
course_id INTEGER,
author_id INTEGER,
subject_id INTEGER,
course_name VARCHAR(120),
course_description VARCHAR(255)
)
CREATE TABLE Students (
student_id INTEGER,
date_of_registration DATETIME,
date_of_latest_logon DATETIME,
login_name VARCHAR(40),
password... | List the name and the number of enrolled student for each course in a bar chart, and order total number in desc order. | SELECT course_name, COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC |
CREATE TABLE table_75268 (
"Nation" text,
"Skip" text,
"Third" text,
"Second" text,
"Lead" text
) | Which Lead has Katarina Radonic as Skip? | SELECT "Lead" FROM table_75268 WHERE "Skip" = 'katarina radonic' |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | give the number of patients whose procedure title is oth periton adhesiolysis and marital status is divorced. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "DIVORCED" AND procedures.short_title = "Oth periton adhesiolysis" |
CREATE TABLE table_name_46 (
total INTEGER,
rank VARCHAR
) | What is the sum of Total when rank is 2? | SELECT SUM(total) FROM table_name_46 WHERE rank = "2" |
CREATE TABLE table_54489 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What was home team South Melbourne's opponents score? | SELECT "Away team score" FROM table_54489 WHERE "Home team" = 'south melbourne' |
CREATE TABLE table_203_174 (
id number,
"rank" number,
"film" text,
"year" number,
"opening weekend\n(three day)" text,
"inflation-adjusted\n(2014 usd)" text
) | what is the average opening weekend gross between iron man 3 and the dark knight ? | SELECT AVG("opening weekend\n(three day)") FROM table_203_174 WHERE "film" IN ('iron man 3', 'the dark knight') |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
... | For those employees who was hired before 2002-06-21, a bar chart shows the distribution of job_id and the sum of manager_id , and group by attribute job_id, rank by the x-axis in asc. | SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY JOB_ID |
CREATE TABLE table_3486 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Vessel Type" text,
"Vessel Operator" text,
"Narrated by" text,
"Original air date" real
) | Name the vessel type for dof subsea | SELECT "Vessel Type" FROM table_3486 WHERE "Vessel Operator" = 'DOF Subsea' |
CREATE TABLE table_name_89 (
record VARCHAR,
visitor VARCHAR
) | Which record has a Visitor of magic? | SELECT record FROM table_name_89 WHERE visitor = "magic" |
CREATE TABLE table_name_49 (
crowd INTEGER,
away_team VARCHAR
) | What is the smallest crowd that Footscray had as the away team? | SELECT MIN(crowd) FROM table_name_49 WHERE away_team = "footscray" |
CREATE TABLE table_name_85 (
college VARCHAR,
player VARCHAR
) | Which college is Jordan Phillips playing for? | SELECT college FROM table_name_85 WHERE player = "jordan phillips" |
CREATE TABLE table_name_82 (
grid INTEGER,
time VARCHAR,
laps VARCHAR
) | which grid did less than 20 laps in a time of +58.353? | SELECT MIN(grid) FROM table_name_82 WHERE time = "+58.353" AND laps < 20 |
CREATE TABLE table_name_70 (
home_team VARCHAR,
crowd INTEGER
) | What was the home team for the game with more than 25,000 crowd? | SELECT home_team FROM table_name_70 WHERE crowd > 25 OFFSET 000 |
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE icustays (
row_id number,
s... | bicarbonate,whats the cost of it? | SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'labevents' AND cost.event_id IN (SELECT labevents.row_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'bicarbonate')) |
CREATE TABLE table_17961 (
"Year" real,
"Points" text,
"Rebounds" text,
"Assists" text,
"Steals" text,
"Blocks" text
) | Who had all of the blocks in 2012? | SELECT "Blocks" FROM table_17961 WHERE "Year" = '2012' |
CREATE TABLE table_46138 (
"Name" text,
"Latitude" text,
"Longitude" text,
"Diameter" real,
"Year named" real
) | What is the latitude of the point with a longitude of 147.1w? | SELECT "Latitude" FROM table_46138 WHERE "Longitude" = '147.1w' |
CREATE TABLE table_48320 (
"Player" text,
"Nationality" text,
"Position" text,
"Years for Grizzlies" text,
"School/Club Team" text
) | What is the nationality of the forward position on the Grizzlies in 2011? | SELECT "Nationality" FROM table_48320 WHERE "Position" = 'forward' AND "Years for Grizzlies" = '2011' |
CREATE TABLE table_29785 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | What game in the season does this list start? | SELECT MIN("Game") FROM table_29785 |
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId... | 40 random off-topic questions from the past 90 days. | SELECT x.* FROM Posts AS p INNER JOIN ReviewTasks AS x ON x.PostId = p.Id LEFT OUTER JOIN PendingFlags AS f ON f.PostId = p.Id LEFT OUTER JOIN PostFeedback AS x ON x.PostId = p.Id WHERE PostHistoryTypeId = 10 AND Comment = '102' AND CreationDate > CURRENT_TIMESTAMP() - 90 ORDER BY NEWID() LIMIT 40 |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE vitalperiodic (
vitalperio... | give me the difference between the total input and the output of patient 021-100763 on the last icu visit. | SELECT (SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-100763') AND NOT patient.unitdischar... |
CREATE TABLE courses (
course_id number,
author_id number,
subject_id number,
course_name text,
course_description text
)
CREATE TABLE course_authors_and_tutors (
author_id number,
author_tutor_atb text,
login_name text,
password text,
personal_name text,
middle_name text,
... | Find the names of courses taught by the tutor who has personal name 'Julio'. | SELECT T2.course_name FROM course_authors_and_tutors AS T1 JOIN courses AS T2 ON T1.author_id = T2.author_id WHERE T1.personal_name = "Julio" |
CREATE TABLE table_23862 (
"Party" text,
"Seats Contested" real,
"Seats Won" real,
"No. of Votes" real,
"% of Votes" text,
"% in Seats contested" text,
"Seats Forfeited" real,
"2003 Seats" real
) | How many seats were won, when the seats contested was 48? | SELECT "Seats Won" FROM table_23862 WHERE "Seats Contested" = '48' |
CREATE TABLE film_category (
film_id number,
category_id number,
last_update time
)
CREATE TABLE payment (
payment_id number,
customer_id number,
staff_id number,
rental_id number,
amount number,
payment_date time,
last_update time
)
CREATE TABLE actor (
actor_id number,
... | Which city has the most addresses? List the city name, number of addresses, and city id. | SELECT T2.city, COUNT(*), T1.city_id FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id GROUP BY T1.city_id ORDER BY COUNT(*) DESC LIMIT 1 |
CREATE TABLE table_27766 (
"Series #" real,
"Season #" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" real,
"U.S. viewers (millions)" text
) | What is the production code of the episode directed by Michael McDonald? | SELECT "Production code" FROM table_27766 WHERE "Directed by" = 'Michael McDonald' |
CREATE TABLE table_11088 (
"Tie no" text,
"Home team" text,
"Score" text,
"Away team" text,
"Attendance" text
) | Which away team that had 48 as a Tie no? | SELECT "Away team" FROM table_11088 WHERE "Tie no" = '48' |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
... | Give the number of patients diagnosed with acute glomerulonephritis with other specified pathological lesion in kidney and their drug route is iv drip? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Acute glomerulonephritis with other specified pathological lesion in kidney" AND prescripti... |
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId number,
ApprovalDate time
)
CREATE TABLE ReviewTaskStates (
Id number,
Name te... | answer count greater than 50. | SELECT * FROM Posts WHERE AnswerCount > 50 |
CREATE TABLE table_13494 (
"Township" text,
"County" text,
"Pop. (2010)" real,
"Land ( sqmi )" real,
"Water (sqmi)" real,
"Latitude" real,
"Longitude" real,
"GEO ID" real,
"ANSI code" real
) | what is the geo id when the land (sqmi) is less than 36.112, the latitude is more than 47.536618, the township is west bay and water (sqmi) is more than 0.209? | SELECT SUM("GEO ID") FROM table_13494 WHERE "Land ( sqmi )" < '36.112' AND "Latitude" > '47.536618' AND "Township" = 'west bay' AND "Water (sqmi)" > '0.209' |
CREATE TABLE table_17355408_4 (
high_assists VARCHAR,
high_points VARCHAR
) | Name the high assists for chauncey billups , carmelo anthony (18) | SELECT high_assists FROM table_17355408_4 WHERE high_points = "Chauncey Billups , Carmelo Anthony (18)" |
CREATE TABLE table_name_26 (
last_match VARCHAR,
date_of_vacancy VARCHAR,
outgoing_manager VARCHAR
) | What is the last match with a vacancy date of round 2 and Ney Franco as outgoing manager? | SELECT last_match FROM table_name_26 WHERE date_of_vacancy = "round 2" AND outgoing_manager = "ney franco" |
CREATE TABLE table_2987 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" real
) | Name the title for 446913 | SELECT "Title" FROM table_2987 WHERE "Production code" = '446913' |
CREATE TABLE table_name_64 (
decile INTEGER,
authority VARCHAR,
name VARCHAR
) | What is the average decile of Ruapehu college, which has a state authority? | SELECT AVG(decile) FROM table_name_64 WHERE authority = "state" AND name = "ruapehu college" |
CREATE TABLE table_27700530_9 (
team VARCHAR,
game VARCHAR
) | How many games were numbered 13? | SELECT COUNT(team) FROM table_27700530_9 WHERE game = 13 |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | how many patients whose ethnicity is white and item id is 51269? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "WHITE" AND lab.itemid = "51269" |
CREATE TABLE table_name_81 (
to_par VARCHAR,
country VARCHAR
) | What is the To par of the Player from Spain? | SELECT to_par FROM table_name_81 WHERE country = "spain" |
CREATE TABLE table_name_77 (
crowd INTEGER,
venue VARCHAR
) | What was the lowest attendance at Windy Hill? | SELECT MIN(crowd) FROM table_name_77 WHERE venue = "windy hill" |
CREATE TABLE Students (
student_id INTEGER,
address_id INTEGER,
first_name VARCHAR(80),
middle_name VARCHAR(40),
last_name VARCHAR(40),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
date_first_rental DATETIME,
date_left_university DATETIME,
other_student_details VARC... | Draw a bar chart about the distribution of date_address_to and the average of monthly_rental , and group by attribute other_details and bin date_address_to by weekday. | SELECT date_address_to, AVG(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC |
CREATE TABLE table_name_46 (
laps VARCHAR,
driver VARCHAR
) | How many laps does driver dario franchitti have? | SELECT laps FROM table_name_46 WHERE driver = "dario franchitti" |
CREATE TABLE table_name_94 (
Left VARCHAR,
location VARCHAR
) | What left office date happened in Washington? | SELECT Left AS office FROM table_name_94 WHERE location = "washington" |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
... | What is the number of patients with an abnormal uric acid lab test? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.flag = "abnormal" AND lab.label = "Uric Acid" |
CREATE TABLE table_name_98 (
date_of_replacement VARCHAR,
date_outgoing VARCHAR
) | When did the manager take over for the manager that left on August 20, 2008? | SELECT date_of_replacement FROM table_name_98 WHERE date_outgoing = "august 20, 2008" |
CREATE TABLE table_11478 (
"Date" text,
"Tournament" text,
"Winning score" text,
"To par" text,
"Margin of victory" text
) | What is the date of the tournament with 5 strokes as the margin of victory? | SELECT "Date" FROM table_11478 WHERE "Margin of victory" = '5 strokes' |
CREATE TABLE course (
course_id int,
name varchar,
department varchar,
number varchar,
credits varchar,
advisory_requirement varchar,
enforced_requirement varchar,
description varchar,
num_semesters int,
num_enrolled int,
has_discussion varchar,
has_lab varchar,
has_p... | Any morning classes for ARMENIAN 171 ? | SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course_offering.start_time < '12:00:00' AND course_offering.start_time >= '08:00:00' AND course.course_id = course_offering.course_id AND course.department = 'ARMENIAN' AND course.number = 171 AND semester.semester = 'WN' AND semester.semester_id = course... |
CREATE TABLE table_34346 (
"Date" text,
"Tournament" text,
"Location" text,
"Winner" text,
"Score" text,
"1st prize ( $ )" real
) | What is the Date of the tournament with a score of 199 ( 17)? | SELECT "Date" FROM table_34346 WHERE "Score" = '199 (–17)' |
CREATE TABLE fare_basis (
fare_basis_code text,
booking_class text,
class_type text,
premium text,
economy text,
discounted text,
night text,
season text,
basis_days text
)
CREATE TABLE restriction (
restriction_code text,
advance_purchase int,
stopovers text,
saturd... | what would be cost of a round trip from PITTSBURGH to SAN FRANCISCO | SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.c... |
CREATE TABLE table_name_48 (
goals_for VARCHAR,
wins VARCHAR,
ties VARCHAR,
goals_against VARCHAR
) | what is the total number of goals for when the ties is more than 0, the goals against is more than 35 and the wins is less than 2? | SELECT COUNT(goals_for) FROM table_name_48 WHERE ties > 0 AND goals_against > 35 AND wins < 2 |
CREATE TABLE table_65742 (
"Original NFL team" text,
"Player" text,
"Pos." text,
"College" text,
"Conf." text
) | What is the College of the WR Player from SWC Conf? | SELECT "College" FROM table_65742 WHERE "Conf." = 'swc' AND "Pos." = 'wr' |
CREATE TABLE table_name_21 (
player VARCHAR,
to_par VARCHAR,
country VARCHAR
) | Which Player has a To par of 12, and a Country of fiji? | SELECT player FROM table_name_21 WHERE to_par = 12 AND country = "fiji" |
CREATE TABLE table_name_17 (
date VARCHAR,
tie_no VARCHAR
) | When has a Tie no of 15? | SELECT date FROM table_name_17 WHERE tie_no = "15" |
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE city (
city_code varchar,
city_na... | lowest fare from SAN FRANCISCO to LOS ANGELES | SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_... |
CREATE TABLE Financial_Transactions (
transaction_id INTEGER,
previous_transaction_id INTEGER,
account_id INTEGER,
card_id INTEGER,
transaction_type VARCHAR(15),
transaction_date DATETIME,
transaction_amount DOUBLE,
transaction_comment VARCHAR(255),
other_transaction_details VARCHAR(... | Return a bar chart on what are the different card types, and how many transactions have been made with each?, sort Y-axis in asc order please. | SELECT card_type_code, COUNT(*) FROM Financial_Transactions AS T1 JOIN Customers_Cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code ORDER BY COUNT(*) |
CREATE TABLE table_1140103_6 (
date VARCHAR,
circuit VARCHAR
) | How many dates have silverstone circuit | SELECT COUNT(date) FROM table_1140103_6 WHERE circuit = "Silverstone" |
CREATE TABLE table_12161822_5 (
grand_prix VARCHAR,
winning_driver VARCHAR
) | what's the grand prix with winning driver being jenson button | SELECT grand_prix FROM table_12161822_5 WHERE winning_driver = "Jenson Button" |
CREATE TABLE table_name_69 (
name VARCHAR,
year VARCHAR,
home_town VARCHAR
) | What is the Name of the Junior from Fayetteville, NC? | SELECT name FROM table_name_69 WHERE year = "junior" AND home_town = "fayetteville, nc" |
CREATE TABLE table_204_579 (
id number,
"code" text,
"district" text,
"headquarters" text,
"population (as of 2011)" number,
"area (km2)" number,
"density (/km2)" number
) | which has a larger population , dehradun or nainital ? | SELECT "district" FROM table_204_579 WHERE "district" IN ('dehradun', 'nainital') ORDER BY "population (as of 2011)" DESC LIMIT 1 |
CREATE TABLE table_53248 (
"Race" text,
"Circuit" text,
"Date" text,
"Pole position" text,
"Winning driver" text,
"Constructor" text,
"Tyre" text,
"Report" text
) | What was the date of the Circuit of Indianapolis? | SELECT "Date" FROM table_53248 WHERE "Circuit" = 'indianapolis' |
CREATE TABLE table_72667 (
"#" real,
"Minnesota River Conference" text,
"Records" text,
"Pct." text,
"MRC Championships" real,
"Solo" real,
"Co-Champions" real,
"State Champions" real
) | How many teams are #2 on the list? | SELECT COUNT("Records") FROM table_72667 WHERE "#" = '2' |
CREATE TABLE table_name_63 (
away_team VARCHAR,
home_team VARCHAR
) | What is the away team when solon was the home team? | SELECT away_team FROM table_name_63 WHERE home_team = "solon" |
CREATE TABLE VOTING_RECORD (
CLASS_President_VOTE VARCHAR
)
CREATE TABLE STUDENT (
LName VARCHAR,
StuID VARCHAR
) | Find the distinct last names of the students who have class president votes. | SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.CLASS_President_VOTE |
CREATE TABLE table_name_21 (
entrants VARCHAR,
year VARCHAR
) | How many entrants were there in 2011? | SELECT COUNT(entrants) FROM table_name_21 WHERE year = 2011 |
CREATE TABLE table_37629 (
"Date" text,
"Title" text,
"Origin" text,
"Label & Cat. no." text,
"Chart no." real
) | What is the average chart number for 11/1965? | SELECT AVG("Chart no.") FROM table_37629 WHERE "Date" = '11/1965' |
CREATE TABLE table_25823 (
"Outcome" text,
"Year" real,
"Championship" text,
"Surface" text,
"Opponent in the final" text,
"Score in the final" text
) | What were the scores of the Wimbledon final matches where Newcombe was the runner-up? | SELECT "Score in the final" FROM table_25823 WHERE "Outcome" = 'Runner-up' AND "Championship" = 'Wimbledon' |
CREATE TABLE table_name_31 (
pick__number VARCHAR,
round VARCHAR
) | What is the pick number for the player(s) drafted in round 8? | SELECT pick__number FROM table_name_31 WHERE round = "round 8" |
CREATE TABLE table_261642_3 (
c__nf_km_ VARCHAR,
r__ω_km_ VARCHAR
) | What is the c (nf/km) when the r ( /km) is 463.59? | SELECT c__nf_km_ FROM table_261642_3 WHERE r__ω_km_ = "463.59" |
CREATE TABLE table_79895 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" real,
"Record" text
) | What was the Attendance high on August 28? | SELECT MAX("Attendance") FROM table_79895 WHERE "Date" = 'august 28' |
CREATE TABLE fare_basis (
fare_basis_code text,
booking_class text,
class_type text,
premium text,
economy text,
discounted text,
night text,
season text,
basis_days text
)
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_f... | show me all the flights between DALLAS FORT WORTH and either SAN FRANCISCO or OAKLAND that depart between 1700 and 1900 | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, airport_service AS AIRPORT_SERVICE_3, city AS CITY_0, city AS CITY_1, city AS CITY_2, city AS CITY_3, flight WHERE ((flight.departure_time <= 1900 AND flight.departure_... |
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text... | To whom do I answer on average?. | SELECT COUNT(1) AS nbe_answers, Questions.OwnerUserId AS "user_link", AVG(Answers.Score) AS A_score, AVG(Questions.Score) AS Q_score FROM Posts AS Questions, Posts AS Answers WHERE Questions.PostTypeId = 1 AND Answers.PostTypeId = 2 AND Answers.ParentId = Questions.Id AND Answers.OwnerUserId = '##UserId1##' GROUP BY Qu... |
CREATE TABLE table_name_71 (
decision VARCHAR,
visitor VARCHAR
) | What was the decision of the Kings game when Chicago was the visiting team? | SELECT decision FROM table_name_71 WHERE visitor = "chicago" |
CREATE TABLE table_51348 (
"Player" text,
"Span" text,
"Start" text,
"Tries" text,
"Conv" text,
"Pens" text,
"Drop" text
) | which spans had a drop of 0? | SELECT "Span" FROM table_51348 WHERE "Drop" = '0' |
CREATE TABLE university (
School_ID int,
School text,
Location text,
Founded real,
Affiliation text,
Enrollment real,
Nickname text,
Primary_conference text
)
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Per... | Show me about the distribution of All_Home and Team_ID , and group by attribute ACC_Home in a bar chart, and rank x-axis from low to high order. | SELECT All_Home, Team_ID FROM basketball_match GROUP BY ACC_Home, All_Home ORDER BY All_Home |
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
... | Days with at least one vote by Mathematics moderators. | SELECT DATE(v.CreationDate) FROM Users AS u INNER JOIN Votes AS v ON v.UserId = u.Id WHERE u.Id IN (2, 3, 66, 121, 1409, 2000, 2926) GROUP BY DATE(v.CreationDate) ORDER BY DATE(v.CreationDate) DESC |
CREATE TABLE APPELLATIONS (
Area VARCHAR,
Appelation VARCHAR
)
CREATE TABLE WINE (
Appelation VARCHAR,
year VARCHAR
) | What is the area of the appelation that produces the highest number of wines before the year of 2010? | SELECT T1.Area FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation GROUP BY T2.Appelation HAVING T2.year < 2010 ORDER BY COUNT(*) DESC LIMIT 1 |
CREATE TABLE artist (
Artist_ID int,
Name text,
Country text,
Year_Join int,
Age int
)
CREATE TABLE exhibition_record (
Exhibition_ID int,
Date text,
Attendance int
)
CREATE TABLE exhibition (
Exhibition_ID int,
Year int,
Theme text,
Artist_ID int,
Ticket_Price real... | How many exhibitions has each artist had Plot them as bar chart, I want to order bar in desc order please. | SELECT Name, COUNT(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.Artist_ID = T2.Artist_ID GROUP BY T1.Artist_ID ORDER BY Name DESC |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
... | provide the date of birth and gender of the subject name bessie giordano. | SELECT demographic.dob, demographic.gender FROM demographic WHERE demographic.name = "Bessie Giordano" |
CREATE TABLE table_65346 (
"Tie no" text,
"Home team" text,
"Score" text,
"Away team" text,
"Date" text
) | What is the Tie no when Wimbledon is the home team? | SELECT "Tie no" FROM table_65346 WHERE "Home team" = 'wimbledon' |
CREATE TABLE Student_Course_Enrolment (
registration_id INTEGER,
student_id INTEGER,
course_id INTEGER,
date_of_enrolment DATETIME,
date_of_completion DATETIME
)
CREATE TABLE Courses (
course_id INTEGER,
author_id INTEGER,
subject_id INTEGER,
course_name VARCHAR(120),
course_des... | Find the number of courses for each subject in a bar chart, and I want to list in descending by the y-axis. | SELECT subject_name, COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id ORDER BY COUNT(*) DESC |
CREATE TABLE table_name_9 (
state VARCHAR,
name VARCHAR
) | Which state was Dai from? | SELECT state FROM table_name_9 WHERE name = "dai" |
CREATE TABLE table_66363 (
"Position" real,
"Team" text,
"Played" real,
"Wins" real,
"Draws" real,
"Losses" real,
"Scored" real,
"Conceded" real,
"Points" real
) | How many losses have 11 points? | SELECT COUNT("Losses") FROM table_66363 WHERE "Points" = '11' |
CREATE TABLE table_63396 (
"Constituency number" text,
"Name" text,
"Reserved for ( SC / ST /None)" text,
"District" text,
"Number of electorates (2009)" real
) | Who has a constituency of 84? | SELECT "Name" FROM table_63396 WHERE "Constituency number" = '84' |
CREATE TABLE table_65043 (
"Actor" text,
"Character" text,
"Soap Opera" text,
"Years" text,
"Duration" text
) | What years did Marienhof run, which featured Leonore Capell and lasted 10 years? | SELECT "Years" FROM table_65043 WHERE "Soap Opera" = 'marienhof' AND "Duration" = '10 years' AND "Actor" = 'leonore capell' |
CREATE TABLE table_30047613_13 (
streak VARCHAR,
date VARCHAR
) | How many games had they won or lost in a row on May 9? | SELECT streak FROM table_30047613_13 WHERE date = "May 9" |
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
... | what were the four most frequent prescriptions of medications for patients who were also prescribed opium tincture at the same time a year before? | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'opium tincture' AND DATETIME(prescriptions.startdate, 'start of y... |
CREATE TABLE Rating (
mID VARCHAR,
stars INTEGER
)
CREATE TABLE Reviewer (
rID VARCHAR,
name VARCHAR
) | Find the average rating star for each movie that are not reviewed by Brittany Harris. | SELECT mID, AVG(stars) FROM Rating WHERE NOT mID IN (SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = "Brittany Harris") GROUP BY mID |
CREATE TABLE table_73329 (
"Year" real,
"Division" real,
"League" text,
"Reg. Season" text,
"Playoffs" text,
"National Open" text
) | What league was involved in 2010? | SELECT "League" FROM table_73329 WHERE "Year" = '2010' |
CREATE TABLE cinema (
Cinema_ID int,
Name text,
Openning_year int,
Capacity int,
Location text
)
CREATE TABLE film (
Film_ID int,
Rank_in_series int,
Number_in_season int,
Title text,
Directed_by text,
Original_air_date text,
Production_code text
)
CREATE TABLE schedule... | For each record in schedule, show the number of films for each day in a bar chart, display by the y axis in ascending. | SELECT Date, COUNT(Date) FROM schedule AS T1 JOIN film AS T2 ON T1.Film_ID = T2.Film_ID JOIN cinema AS T3 ON T1.Cinema_ID = T3.Cinema_ID GROUP BY Date ORDER BY COUNT(Date) |
CREATE TABLE table_name_92 (
merconorte INTEGER,
superliga VARCHAR,
interliga VARCHAR,
matches VARCHAR
) | Name the least merconorte for interliga of 2 and matches more than 260 with superliga more than 7 | SELECT MIN(merconorte) FROM table_name_92 WHERE interliga = 2 AND matches > 260 AND superliga > 7 |
CREATE TABLE table_1140074_2 (
pole_position VARCHAR,
location VARCHAR
) | what's the pole position with location being hockenheimring | SELECT pole_position FROM table_1140074_2 WHERE location = "Hockenheimring" |
CREATE TABLE table_name_49 (
decision VARCHAR,
attendance INTEGER
) | What is the decision of the game with an attendance greater than 19,883? | SELECT decision FROM table_name_49 WHERE attendance > 19 OFFSET 883 |
CREATE TABLE table_name_59 (
winner VARCHAR,
runner_up VARCHAR,
country VARCHAR
) | Who was the winner from the United States the year Kimberly Kim was runner-up? | SELECT winner FROM table_name_59 WHERE runner_up = "kimberly kim" AND country = "united states" |
CREATE TABLE table_23183195_2 (
team VARCHAR,
overall_record VARCHAR
) | What team's overal record is 22-11? | SELECT team FROM table_23183195_2 WHERE overall_record = "22-11" |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | how many patients of protestant quaker religion are procedured with int insert 1-cham, rate? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.religion = "PROTESTANT QUAKER" AND procedures.short_title = "Int insert 1-cham, rate" |
CREATE TABLE table_name_2 (
series VARCHAR,
game INTEGER
) | What was the series standing for games over 4? | SELECT series FROM table_name_2 WHERE game > 4 |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
... | calculate the total number of patients diagnosed with icd9 code 30390 who had their blood gas tested by lab | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "30390" AND lab."CATEGORY" = "Blood Gas" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.