context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE table_58045 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What was the highest crowd at the venue MCG? | SELECT MAX("Crowd") FROM table_58045 WHERE "Venue" = 'mcg' | wikisql |
CREATE TABLE zyjzjlb (
CYBQDM text,
CYBQMC text,
CYCWH text,
CYKSDM text,
CYKSMC text,
CYSJ time,
CYZTDM number,
HZXM text,
JZKSDM text,
JZKSMC text,
JZLSH text,
KH text,
KLX number,
MZBMLX number,
MZJZLSH text,
MZZDBM text,
MZZDMC text,
MZZYZDZZBM... | 4198073医院有多少科室在2005年1月17日到2012年1月10日期间的门诊就诊中开出了不超过30张检验报告单 | SELECT COUNT(*) FROM (SELECT jybgb.KSBM FROM txmzjzjlb JOIN jybgb ON txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE txmzjzjlb.YLJGDM = '4198073' AND jybgb.BGRQ BETWEEN '2005-01-17' AND '2012-01-10' GROUP BY jybgb.KSBM HAVING COUNT(*) <= 30 UNION SELECT jybgb.KSBM FROM ftxmzjzjlb... | css |
CREATE TABLE table_203_298 (
id number,
"rank" number,
"name" text,
"nation(s)" text,
"born" text,
"ascended" text,
"years reigned" text
) | what is the total number of monarchs that ascended the throne in 2010 ? | SELECT COUNT("name") FROM table_203_298 WHERE "ascended" = 2010 | squall |
CREATE TABLE affected_region (
region_id number,
storm_id number,
number_city_affected number
)
CREATE TABLE region (
region_id number,
region_code text,
region_name text
)
CREATE TABLE storm (
storm_id number,
name text,
dates_active text,
max_speed number,
damage_millions... | What are the region names affected by the storm with a number of deaths of least 10? | SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T3.number_deaths >= 10 | spider |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
h... | tell me the name of the output patient 018-95228 had for the last time on the first icu visit? | SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '018-95228') AND NOT patient.unitdischargetime IS NULL ORDER ... | eicu |
CREATE TABLE table_40696 (
"Region" text,
"Host" text,
"Venue" text,
"City" text,
"State" text
) | What city is east region venue University Hall (University of Virginia) in? | SELECT "City" FROM table_40696 WHERE "Region" = 'east' AND "Venue" = 'university hall (university of virginia)' | wikisql |
CREATE TABLE table_name_29 (
date VARCHAR,
league_position VARCHAR,
result_f___a VARCHAR
) | What date that was the league position was 1st, and the result F A was 5 0? | SELECT date FROM table_name_29 WHERE league_position = "1st" AND result_f___a = "5 – 0" | sql_create_context |
CREATE TABLE table_36709 (
"Date" text,
"Opponent" text,
"Score" text,
"Record" text,
"Television" text
) | What score has 1/22 as the date? | SELECT "Score" FROM table_36709 WHERE "Date" = '1/22' | wikisql |
CREATE TABLE table_train_77 (
"id" int,
"gender" string,
"pregnancy_or_lactation" bool,
"language" string,
"hiv_aids" bool,
"age" float,
"NOUSE" float
) | male or female 50 to 90 of age inclusive. | SELECT * FROM table_train_77 WHERE (gender = 'male' OR gender = 'female') AND (age >= 50 AND age <= 90) | criteria2sql |
CREATE TABLE table_31089 (
"No." real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" text,
"U.S. viewers (million)" text
) | Name the number of episodes that jim barnes wrote for 1.82 million viewers | SELECT COUNT("No.") FROM table_31089 WHERE "Written by" = 'Jim Barnes' AND "U.S. viewers (million)" = '1.82' | wikisql |
CREATE TABLE table_24565 (
"Country" text,
"% of imports from Russia" text,
"% cut" text,
"Diversification" text,
"Gas storage" text,
"Alternative fuel" text
) | What was the gas storage status for the nation that had 'yes' for alternative fuel? | SELECT "Gas storage" FROM table_24565 WHERE "Alternative fuel" = 'Yes' | wikisql |
CREATE TABLE table_19542477_8 (
number_one_s_ INTEGER
) | What is the highest overall number one(s)? | SELECT MAX(number_one_s_) FROM table_19542477_8 | sql_create_context |
CREATE TABLE table_54999 (
"Fare Categories" text,
"Base Fares" text,
"Day Pass" text,
"7-Day Pass" text,
"30-Day Pass" text
) | What is the Base Fare in the senior/disabled category? | SELECT "Base Fares" FROM table_54999 WHERE "Fare Categories" = 'senior/disabled' | wikisql |
CREATE TABLE table_61253 (
"Team" text,
"Played" real,
"Draw" real,
"Lost" real,
"Goals Scored" real,
"Goals Conceded" real,
"Points" text
) | Name the highest Played of Goals Scored smaller than 18 and a Lost larger than 10? | SELECT MAX("Played") FROM table_61253 WHERE "Goals Scored" < '18' AND "Lost" > '10' | wikisql |
CREATE TABLE table_40392 (
"School year" text,
"95-96" text,
"99-00" text,
"00-01" text,
"01-02" text,
"02-03" text,
"03-04" text,
"04-05" text,
"05-06" text,
"06-07" text
) | What is 03-04, when 95-96 is 337,660? | SELECT "03-04" FROM table_40392 WHERE "95-96" = '337,660' | wikisql |
CREATE TABLE table_name_31 (
launched VARCHAR,
date_of_commission VARCHAR
) | What is the Launched which is on 3 may 2001? | SELECT launched FROM table_name_31 WHERE date_of_commission = "3 may 2001" | sql_create_context |
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE T... | Unanswered Inactive Questions for a Specific Tag. Inactive questions with no answers for a specific tag (ViewCount ASC) | SELECT Id AS "post_link", Tags, ViewCount, CreationDate FROM Posts WHERE ParentId IS NULL AND AnswerCount = 0 AND Tags LIKE '<batch-file>' ORDER BY ViewCount LIMIT 100 | sede |
CREATE TABLE table_54365 (
"Season" text,
"Winner" text,
"Team" text,
"Position" text,
"Win #" real
) | How many wins were there in 2004-05? | SELECT "Win #" FROM table_54365 WHERE "Season" = '2004-05' | wikisql |
CREATE TABLE table_26311 (
"Year" real,
"Winner (number of titles)" text,
"Runners-up" text,
"Top Team in Regular Season (points)" text,
"Top Scorer (points)" text,
"Winning Coach" text
) | What is the winning coach total number if the top team in regular season (points) is the Kansas City Spurs (110 points)? | SELECT COUNT("Winning Coach") FROM table_26311 WHERE "Top Team in Regular Season (points)" = 'Kansas City Spurs (110 points)' | wikisql |
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
sc... | What are the classes that can be taken as PreMajor next semester ? | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program, program_course, semester WHERE course.course_id = course_offering.course_id AND program_course.category LIKE '%PreMajor%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.prog... | advising |
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 prescription... | Bring the number of patients who had laryngoscopy and other tracheoscopy procedures. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.long_title = "Laryngoscopy and other tracheoscopy" | mimicsql_data |
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TABLE airline (
airline_code varchar,
airline_name text,
note text
)
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE flight_stop (
flight_id in... | can you show me the available flights from BALTIMORE to DALLAS with economy fares | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, fare_basis, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND fare_basis.economy = 'YES' AND fare.fare_basis... | atis |
CREATE TABLE table_45569 (
"Game" real,
"Date" text,
"Opponent" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location/Attendance" text,
"Record" text
) | What is the location/attendance of the game with a 3-1 record? | SELECT "Location/Attendance" FROM table_45569 WHERE "Record" = '3-1' | wikisql |
CREATE TABLE city (
City_ID int,
County_ID int,
Name text,
White real,
Black real,
Amerindian real,
Asian real,
Multiracial real,
Hispanic real
)
CREATE TABLE county_public_safety (
County_ID int,
Name text,
Population int,
Police_officers int,
Residents_per_offi... | Show the number of cities in each country with a bar chart, sort in asc by the Y please. | SELECT T2.Name, COUNT(T2.Name) FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID GROUP BY T2.Name ORDER BY COUNT(T2.Name) | nvbench |
CREATE TABLE table_name_71 (
constellation VARCHAR,
date_sent VARCHAR,
distance___ly__ VARCHAR
) | What is Constellation, when Date Sent is 'September 4, 2001', and when Distance ( ly ) is less than 57.4? | SELECT constellation FROM table_name_71 WHERE date_sent = "september 4, 2001" AND distance___ly__ < 57.4 | sql_create_context |
CREATE TABLE table_name_71 (
goal_ratio INTEGER,
debut_in_europe VARCHAR,
goals VARCHAR,
games VARCHAR
) | What's the average goal ratio with Goals larger than 1, Games larger than 161, and a Debut in Europe smaller than 1985? | SELECT AVG(goal_ratio) FROM table_name_71 WHERE goals > 1 AND games > 161 AND debut_in_europe < 1985 | sql_create_context |
CREATE TABLE jyjgzbb (
BGDH text,
BGRQ time,
CKZFWDX text,
CKZFWSX number,
CKZFWXX number,
JCFF text,
JCRGH text,
JCRXM text,
JCXMMC text,
JCZBDM text,
JCZBJGDL number,
JCZBJGDW text,
JCZBJGDX text,
JCZBMC text,
JLDW text,
JYRQ time,
JYZBLSH text,
... | 查询病人54632164在医院1907633的门诊诊断信息中不存在牙龈二字的门诊就诊记录详情 | SELECT * FROM hz_info JOIN zzmzjzjlb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX WHERE hz_info.RYBH = '54632164' AND hz_info.YLJGDM = '1907633' AND NOT zzmzjzjlb.JZZDSM LIKE '%牙龈%' UNION SELECT * FROM hz_info JOIN fzzmzjzjlb ON hz_info.YLJGDM = fzzmzjzjlb.YLJGDM AN... | css |
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Percent text,
ACC_Home text,
ACC_Road text,
All_Games text,
All_Games_Percent int,
All_Home text,
All_Road text,
All_Neutral text
)
CREATE TABLE university (
Scho... | Group by all home, show the team id and school id in a scatter plot. | SELECT Team_ID, School_ID FROM basketball_match GROUP BY All_Home | nvbench |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE d_labi... | in 2100 what are the top four most commonly prescribed drugs? | SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE STRFTIME('%y', prescriptions.startdate) = '2100' GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 4 | mimic_iii |
CREATE TABLE vocals (
songid number,
bandmate number,
type text
)
CREATE TABLE performance (
songid number,
bandmate number,
stageposition text
)
CREATE TABLE band (
id number,
firstname text,
lastname text
)
CREATE TABLE instruments (
songid number,
bandmateid number,
... | What information is there on albums from 2010? | SELECT * FROM albums WHERE year = 2010 | spider |
CREATE TABLE table_72342 (
"Phase" text,
"Round" text,
"Clubs remaining" real,
"Clubs involved" real,
"Winners from previous round" text,
"New entries this round" text,
"Leagues entering at this round" text
) | The new entries this round was shown to be 12, in which phase would you find this? | SELECT "Phase" FROM table_72342 WHERE "New entries this round" = '12' | wikisql |
CREATE TABLE table_204_4 (
id number,
"date" text,
"race" text,
"competition" text,
"rider" text,
"country" text,
"location" text
) | how many uci europe tour competitions are recorded in the chart ? | SELECT COUNT(*) FROM table_204_4 WHERE "competition" = 'uci europe tour' | squall |
CREATE TABLE table_14342592_5 (
touchdowns VARCHAR,
points VARCHAR
) | When the total points are 22 how many total touchdowns have been made? | SELECT touchdowns FROM table_14342592_5 WHERE points = 22 | sql_create_context |
CREATE TABLE table_30282 (
"Stage" real,
"Winner" text,
"General classification \u017b\u00f3\u0142ta koszulka" text,
"Mountains classification Klasyfikacja g\u00f3rska" text,
"Intermediate Sprints Classification Klasyfikacja najaktywniejszych" text,
"Points classification Klasyfikacja punktowa" ... | What was the intermediate sprint classification for the race whose winner was Daniel Martin? | SELECT "Intermediate Sprints Classification Klasyfikacja najaktywniejszych" FROM table_30282 WHERE "Winner" = 'Daniel Martin' | wikisql |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | how many patients were given the drug medium chain triglycerides? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Medium Chain Triglycerides" | mimicsql_data |
CREATE TABLE table_74951 (
"Rank" text,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | Which Silver has a Nation of china, and a Bronze smaller than 7? | SELECT SUM("Silver") FROM table_74951 WHERE "Nation" = 'china' AND "Bronze" < '7' | wikisql |
CREATE TABLE country (
Country_id int,
Country_name text,
Capital text,
Official_native_language text
)
CREATE TABLE player (
Player_ID int,
Player text,
Years_Played text,
Total_WL text,
Singles_WL text,
Doubles_WL text,
Team int
)
CREATE TABLE match_season (
Season re... | Show the country names and the corresponding number of players in a pie chart. | SELECT Country_name, COUNT(*) FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country GROUP BY T1.Country_name | nvbench |
CREATE TABLE table_13095 (
"Place" real,
"Team" text,
"Played" real,
"Draw" real,
"Lost" real,
"Goals Scored" real,
"Goals Conceded" real,
"Points" real
) | When goals conceded is greater than 17 with 37 points, what is the greatest played? | SELECT MAX("Played") FROM table_13095 WHERE "Points" = '37' AND "Goals Conceded" > '17' | wikisql |
CREATE TABLE zyjzjlb (
CYBQDM text,
CYBQMC text,
CYCWH text,
CYKSDM text,
CYKSMC text,
CYSJ time,
CYZTDM number,
HZXM text,
JZKSDM text,
JZKSMC text,
JZLSH text,
KH text,
KLX number,
MZBMLX number,
MZJZLSH text,
MZZDBM text,
MZZDMC text,
MZZYZDZZBM... | 从住院就诊记录上看在医院2859179中就诊的病号00758065出院科室名称包含眼外伤的是哪些? | SELECT * FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE hz_info.RYBH = '00758065' AND hz_info.YLJGDM = '2859179' AND zyjzjlb.CYKSMC LIKE '%眼外伤%' | css |
CREATE TABLE table_50110 (
"Date" text,
"H/A/N" text,
"Opponent" text,
"Score" text,
"Record" text
) | What is H/A/N, when Score is 104-109? | SELECT "H/A/N" FROM table_50110 WHERE "Score" = '104-109' | wikisql |
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
CREATE TABLE stadium (
ID int,
name text,
Capacity int,
City text,
Country text,
Opening_year int
)
CREATE TABLE event (
ID int,
Name text,
Stadium_ID int,
Year text
)
CREATE TABLE swimme... | Find the number of the names of swimmers who has a result of 'win', rank by the y-axis in ascending. | SELECT name, COUNT(name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID WHERE Result = 'Win' GROUP BY name ORDER BY COUNT(name) | nvbench |
CREATE TABLE table_31962 (
"Calls" text,
"Frequency" text,
"Branding" text,
"Format" text,
"Timeslot" text,
"Group owner" text
) | Say the frequency of 1290 khz | SELECT "Format" FROM table_31962 WHERE "Frequency" = '1290 khz' | wikisql |
CREATE TABLE Staff (
Staff_ID INTEGER,
Staff_Details VARCHAR(255)
)
CREATE TABLE Claims_Processing_Stages (
Claim_Stage_ID INTEGER,
Next_Claim_Stage_ID INTEGER,
Claim_Status_Name VARCHAR(255),
Claim_Status_Description VARCHAR(255)
)
CREATE TABLE Policies (
Policy_ID INTEGER,
Customer_I... | Find the number of records of each policy type and its type code Visualize by bar chart, I want to order from high to low by the y axis. | SELECT Policy_Type_Code, COUNT(*) FROM Policies GROUP BY Policy_Type_Code ORDER BY COUNT(*) DESC | nvbench |
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 ... | provide me the number of male patients who have lab test item id 51144. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.gender = "M" AND lab.itemid = "51144" | mimicsql_data |
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose_val_rx text,
dose_unit_rx text,
route text
)
CREATE TABLE labevents (
ro... | tell me the amount of deliver 2.0 that patient 27703 has received on last month/05. | SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27703)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.lab... | mimic_iii |
CREATE TABLE t_kc22 (
AMOUNT number,
CHA_ITEM_LEV number,
DATA_ID text,
DIRE_TYPE number,
DOSE_FORM text,
DOSE_UNIT text,
EACH_DOSAGE text,
EXP_OCC_DATE time,
FLX_MED_ORG_ID text,
FXBZ number,
HOSP_DOC_CD text,
HOSP_DOC_NM text,
MED_CLINIC_ID text,
MED_DIRE_CD tex... | 能知道患者62410155在2004.2.7到2005.5.15这段时间医保的消费金额吗 | SELECT SUM(t_kc24.PER_ACC_PAY) FROM t_kc24 WHERE t_kc24.PERSON_ID = '62410155' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2004-02-07' AND '2005-05-15' | css |
CREATE TABLE table_name_41 (
format VARCHAR,
catalog VARCHAR,
date VARCHAR
) | What is the Format of the September 22, 2008 release with Catalog number RTRADCD491? | SELECT format FROM table_name_41 WHERE catalog = "rtradcd491" AND date = "september 22, 2008" | sql_create_context |
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,
... | calculate the number of patients diagnosed with b-complex defic nec | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "B-complex defic NEC" | mimicsql_data |
CREATE TABLE table_2491 (
"Year" real,
"Date" text,
"Driver" text,
"Team" text,
"Manufacturer" text,
"Laps" text,
"Miles (km)" text,
"Race Time" text,
"Average Speed (mph)" text,
"Report" text
) | What team won when the race time was 3:12:30? | SELECT "Team" FROM table_2491 WHERE "Race Time" = '3:12:30' | wikisql |
CREATE TABLE county_public_safety (
county_id number,
name text,
population number,
police_officers number,
residents_per_officer number,
case_burden number,
crime_rate number,
police_force text,
location text
)
CREATE TABLE city (
city_id number,
county_id number,
name ... | Which location has the most corresponding counties? | SELECT location FROM county_public_safety GROUP BY location ORDER BY COUNT(*) DESC LIMIT 1 | spider |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
... | how many patients younger than 85 years of age lab tested for other cells? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "85" AND lab.label = "Other Cells" | mimicsql_data |
CREATE TABLE table_72673 (
"No. in series" text,
"No. in season" text,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" text,
"U.S. viewers (millions)" text
) | Name the number in the series for when the viewers is 7.78 | SELECT "No. in series" FROM table_72673 WHERE "U.S. viewers (millions)" = '7.78' | wikisql |
CREATE TABLE table_13608101_1 (
bush_number INTEGER,
others_percentage VARCHAR
) | what is the maximum bush# with others% being 1.57% | SELECT MAX(bush_number) FROM table_13608101_1 WHERE others_percentage = "1.57%" | sql_create_context |
CREATE TABLE discipline_enrollments (
campus number,
discipline number,
year number,
undergraduate number,
graduate number
)
CREATE TABLE enrollments (
campus number,
year number,
totalenrollment_ay number,
fte_ay number
)
CREATE TABLE faculty (
campus number,
year number,
... | Find all the campuses opened in 1958. | SELECT campus FROM campuses WHERE year = 1958 | spider |
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
)
... | tell me the age and death status of patient jerry deberry. | SELECT demographic.age, demographic.expire_flag FROM demographic WHERE demographic.name = "Jerry Deberry" | mimicsql_data |
CREATE TABLE table_76047 (
"Rank" text,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | Which rank has 1 silver medal and more than 1 gold medal? | SELECT "Rank" FROM table_76047 WHERE "Silver" = '1' AND "Gold" > '1' | wikisql |
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | Search number of comments given by keyword.. | SELECT c.Text, c.Id AS "comment_link", CreationDate FROM Comments AS c WHERE c.Text LIKE '%##keyword##%' AND LENGTH(c.Text) <= 25 ORDER BY CreationDate DESC LIMIT 100 | sede |
CREATE TABLE prescribes (
physician number,
patient number,
medication number,
date time,
appointment number,
dose text
)
CREATE TABLE undergoes (
patient number,
procedures number,
stay number,
dateundergoes time,
physician number,
assistingnurse number
)
CREATE TABLE ... | What is the id of the appointment that started most recently? | SELECT appointmentid FROM appointment ORDER BY start DESC LIMIT 1 | spider |
CREATE TABLE table_850 (
"Rnd" real,
"Circuit" text,
"GTO Winning Team" text,
"GTU Winning Team" text,
"TO Winning Team" text,
"TU Winning Team" text,
"Results" text
) | Who was the GTU winning team when the TO winning team was Steve Ross? | SELECT "GTU Winning Team" FROM table_850 WHERE "TO Winning Team" = 'Steve Ross' | wikisql |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
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 ... | what is the number of patients whose marital status is single and procedure long title is single internal mammary-coronary artery bypass? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "SINGLE" AND procedures.long_title = "Single internal mammary-coronary artery bypass" | mimicsql_data |
CREATE TABLE party (
Party_ID int,
Year real,
Party text,
Governor text,
Lieutenant_Governor text,
Comptroller text,
Attorney_General text,
US_Senate text
)
CREATE TABLE election (
Election_ID int,
Counties_Represented text,
District int,
Delegate text,
Party int,
... | A bar chart for finding the number of the parties associated with the delegates from district 1 Who served as governors of the parties?, show in desc by the y-axis. | SELECT Governor, COUNT(Governor) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 GROUP BY Governor ORDER BY COUNT(Governor) DESC | nvbench |
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 prescriptions (
subject_id text,
hadm_id... | give me the number of patients whose days of hospital stay is greater than 6 and lab test category is blood gas? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "6" AND lab."CATEGORY" = "Blood Gas" | mimicsql_data |
CREATE TABLE table_52959 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What is the date when the away team is essendon? | SELECT "Date" FROM table_52959 WHERE "Away team" = 'essendon' | wikisql |
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
war... | what are the three most commonly ordered laboratory tests for patients who were previously diagnosed with abdmnal pain oth spcf st in the same month, this year? | 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 FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.i... | mimic_iii |
CREATE TABLE table_29598261_1 (
hometown VARCHAR,
name VARCHAR
) | how many hometowns for faisal aden? | SELECT COUNT(hometown) FROM table_29598261_1 WHERE name = "Faisal Aden" | sql_create_context |
CREATE TABLE table_21378339_5 (
artist VARCHAR,
televote_points VARCHAR
) | Name the artist for 7 points | SELECT COUNT(artist) FROM table_21378339_5 WHERE televote_points = 7 | sql_create_context |
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit text,
first_wardid number,
last_wardid number,
intime time,
outtime time
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
s... | what was the first time until 29 months ago patient 30235 received a bilirubin, total lab test? | SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'bilirubin, total') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 30235) AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME()... | mimic_iii |
CREATE TABLE Course_Authors_and_Tutors (
author_id INTEGER,
author_tutor_ATB VARCHAR(3),
login_name VARCHAR(40),
password VARCHAR(40),
personal_name VARCHAR(80),
middle_name VARCHAR(80),
family_name VARCHAR(80),
gender_mf VARCHAR(1),
address_line_1 VARCHAR(80)
)
CREATE TABLE Student... | What are the enrollment dates of all the tests that have result 'Pass', and count them by a bar chart | SELECT date_of_enrolment, COUNT(date_of_enrolment) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Pass" | nvbench |
CREATE TABLE table_name_8 (
grid VARCHAR,
laps VARCHAR,
manufacturer VARCHAR,
rider VARCHAR
) | How many grids have a Manufacturer of honda, a Rider of yuki takahashi, and more than 22 laps? | SELECT COUNT(grid) FROM table_name_8 WHERE manufacturer = "honda" AND rider = "yuki takahashi" AND laps > 22 | sql_create_context |
CREATE TABLE table_13339 (
"Name" text,
"Platform" text,
"Indication" text,
"Status" text,
"Collaboration" text
) | Which study included autoimmune disease and inflammation? | SELECT "Name" FROM table_13339 WHERE "Indication" = 'autoimmune disease and inflammation' | wikisql |
CREATE TABLE table_32958 (
"Institution" text,
"Government" real,
"Aided" real,
"Unaided" real,
"Total" real
) | Which higher secondary school listing has the lowest total and an Aided amount larger than 14? | SELECT MIN("Total") FROM table_32958 WHERE "Institution" = 'higher secondary school' AND "Aided" > '14' | wikisql |
CREATE TABLE table_name_80 (
from_club VARCHAR,
player VARCHAR
) | What is From Club, when Player is 'Robinho'? | SELECT from_club FROM table_name_80 WHERE player = "robinho" | sql_create_context |
CREATE TABLE table_3798 (
"Branding" text,
"Callsign" text,
"Frequency" text,
"Power (kW)" text,
"Location" text
) | How many call signs does the location masinloc, zambales have? | SELECT COUNT("Callsign") FROM table_3798 WHERE "Location" = 'Masinloc, Zambales' | wikisql |
CREATE TABLE dataset (
datasetid int,
datasetname varchar
)
CREATE TABLE paperfield (
fieldid int,
paperid int
)
CREATE TABLE writes (
paperid int,
authorid int
)
CREATE TABLE field (
fieldid int
)
CREATE TABLE keyphrase (
keyphraseid int,
keyphrasename varchar
)
CREATE TABLE jo... | Papers written by kurtis heimerl | SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'kurtis heimerl' AND writes.authorid = author.authorid | scholar |
CREATE TABLE table_20641 (
"Danish name" text,
"English name" text,
"Seat of administration" text,
"Largest city" text,
"Population (January 1, 2008)" real,
"Area (km\u00b2)" real,
"Pop. density (per km\u00b2)" text
) | What is the minimum population of the region in which Roskilde is the largest city? | SELECT MIN("Population (January 1, 2008)") FROM table_20641 WHERE "Largest city" = 'Roskilde' | wikisql |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemics... | what was the maximum value for respiration for patient 022-187132 during yesterday? | SELECT MAX(vitalperiodic.respiration) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-187132')) AND NOT vitalperiodic.respiration IS... | eicu |
CREATE TABLE table_name_74 (
event VARCHAR,
opponent VARCHAR
) | What was the event for vinny magalh es? | SELECT event FROM table_name_74 WHERE opponent = "vinny magalhães" | sql_create_context |
CREATE TABLE table_name_37 (
money___ INTEGER,
place VARCHAR
) | What is the Money of the Player in Place 5? | SELECT SUM(money___) AS $__ FROM table_name_37 WHERE place = "5" | sql_create_context |
CREATE TABLE flight (
flno number(4,0),
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0)
)
CREATE TABLE aircraft (
aid number(9,0),
name varchar2(30),
distance number(6,0)
)
CREAT... | How many flights with price higher than 300 for each destination city? Return a bar chart, I want to show X-axis from high to low order. | SELECT destination, COUNT(destination) FROM flight WHERE price > 300 GROUP BY destination ORDER BY destination DESC | nvbench |
CREATE TABLE table_204_724 (
id number,
"outcome" text,
"no." number,
"date" text,
"tournament" text,
"surface" text,
"partner" text,
"opponents in the final" text,
"score in the final" text
) | what is the total number of runner ups listed on the chart ? | SELECT COUNT(*) FROM table_204_724 WHERE "outcome" = 'runner-up' | squall |
CREATE TABLE table_50565 (
"Tournament" text,
"Surface" text,
"Week" text,
"Winner and score" text,
"Finalist" text,
"Semifinalists" text
) | Which Semifinalists have a Finalist of andrei chesnokov? | SELECT "Semifinalists" FROM table_50565 WHERE "Finalist" = 'andrei chesnokov' | wikisql |
CREATE TABLE table_8461 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | What is the Player that has a To standard of 4, and a Score of 74-70-68=212? | SELECT "Player" FROM table_8461 WHERE "To par" = '–4' AND "Score" = '74-70-68=212' | wikisql |
CREATE TABLE table_1005 (
"Player" text,
"Position" text,
"Games started" text,
"Hometown" text,
"Height" text,
"Weight" real,
"Class" text,
"Prior experience" text
) | How many Games Started are there for Hugh White ? | SELECT "Games started" FROM table_1005 WHERE "Player" = 'Hugh White' | wikisql |
CREATE TABLE table_31719 (
"Frequency" text,
"Call sign" text,
"Branding" text,
"Format" text,
"Owner" text
) | What is the call frequency sign of cjjc-fm? | SELECT "Frequency" FROM table_31719 WHERE "Call sign" = 'cjjc-fm' | wikisql |
CREATE TABLE table_2968 (
"Week" real,
"Date" text,
"Opponent" text,
"Location" text,
"Final Score" text,
"Attendance" real,
"Record" text
) | If the opponent is the Stampeders, what is the record? | SELECT "Record" FROM table_2968 WHERE "Opponent" = 'Stampeders' | wikisql |
CREATE TABLE list (
firstname VARCHAR,
classroom VARCHAR
) | What are the first names of students studying in room 107? | SELECT DISTINCT firstname FROM list WHERE classroom = 107 | sql_create_context |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
wardid number,
intime time,
... | how many days have elapsed since patient 5828 was admitted to the intensive care unit currently? | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', icustays.intime)) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5828) AND icustays.outtime IS NULL | mimic_iii |
CREATE TABLE t_kc22 (
MED_EXP_DET_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
MED_CLINIC_ID text,
MED_EXP_BILL_ID text,
SOC_SRT_DIRE_CD text,
SOC_SRT_DIRE_NM text,
DIRE_TYPE number,
CHA_ITEM_LEV number,
MED_INV_ITEM_TYPE text,
MED_DIRE_CD text,
MED_DIRE_NM text,... | 50228479302在医疗就诊中卖出的全部名称不包含用的金额及其药品各是多少? | SELECT SOC_SRT_DIRE_CD, SOC_SRT_DIRE_NM, AMOUNT FROM t_kc22 WHERE MED_CLINIC_ID = '50228479302' AND NOT SOC_SRT_DIRE_NM LIKE '%用%' | css |
CREATE TABLE t_kc22 (
AMOUNT number,
CHA_ITEM_LEV number,
DATA_ID text,
DIRE_TYPE number,
DOSE_FORM text,
DOSE_UNIT text,
EACH_DOSAGE text,
EXP_OCC_DATE time,
FLX_MED_ORG_ID text,
FXBZ number,
HOSP_DOC_CD text,
HOSP_DOC_NM text,
MED_DIRE_CD text,
MED_DIRE_NM text,... | 不低于10岁的病患的医疗记录的医疗费总额是多少?计算出平均值 | SELECT AVG(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_AGE >= 10) | css |
CREATE TABLE table_18223 (
"District" text,
"Incumbent" text,
"Party" text,
"Elected" real,
"Status" text,
"Opponent" text
) | What is the status of incumbent Charles Stenholm? | SELECT "Status" FROM table_18223 WHERE "Incumbent" = 'Charles Stenholm' | wikisql |
CREATE TABLE table_11430 (
"Average population (x 1000)" real,
"Live births" real,
"Deaths" text,
"Natural change" real,
"Crude birth rate (per 1000)" real,
"Crude death rate (per 1000)" real,
"Natural change (per 1000)" real
) | what is the crude birth rate (per 1000) when the natural change (per 1000) is more than 31.6 and the average population (x1000) is less than 1,802? | SELECT SUM("Crude birth rate (per 1000)") FROM table_11430 WHERE "Natural change (per 1000)" > '31.6' AND "Average population (x 1000)" < '1,802' | wikisql |
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 diagnoses (
... | give me the number of patients whose marital status is widowed and lab test fluid is pleural? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "WIDOWED" AND lab.fluid = "Pleural" | mimicsql_data |
CREATE TABLE table_name_52 (
title VARCHAR,
appointed_by VARCHAR
) | What is the title of the representative appointed by James K. Polk? | SELECT title FROM table_name_52 WHERE appointed_by = "james k. polk" | sql_create_context |
CREATE TABLE table_name_61 (
silver INTEGER,
gold VARCHAR,
total VARCHAR
) | What is the highest Silver, when Gold is '8', and when Total is greater than 31? | SELECT MAX(silver) FROM table_name_61 WHERE gold = 8 AND total > 31 | sql_create_context |
CREATE TABLE table_78126 (
"Player" text,
"Position" text,
"School" text,
"Hometown" text,
"College" text
) | Which player is from Tampa, Florida? | SELECT "Player" FROM table_78126 WHERE "Hometown" = 'tampa, florida' | wikisql |
CREATE TABLE table_1108394_47 (
queens VARCHAR
) | Which candidate won 88 votes in Queens in 1921? | SELECT 1921 FROM table_1108394_47 WHERE queens = "88" | sql_create_context |
CREATE TABLE t_kc24 (
ACCOUNT_DASH_DATE time,
ACCOUNT_DASH_FLG number,
CASH_PAY number,
CIVIL_SUBSIDY number,
CKC102 number,
CLINIC_ID text,
CLINIC_SLT_DATE time,
COMP_ID text,
COM_ACC_PAY number,
COM_PAY number,
DATA_ID text,
ENT_ACC_PAY number,
ENT_PAY number,
F... | 查询在二零零六年一月五日二零一一年十二月三十日的这段时间里医院5091716有多少科室涉及的医疗费总额低于7482.56元 | SELECT COUNT(*) FROM (SELECT t_kc21.MED_ORG_DEPT_CD FROM t_kc21 JOIN t_kc24 JOIN t_kc21_t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc24.MED_CLINIC_ID AND t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID WHERE t_kc21.MED_SER_ORG_NO = '5091716' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2006-01-05' AND '2011-12-30' GROUP B... | css |
CREATE TABLE table_name_41 (
city VARCHAR,
results¹ VARCHAR
) | what city has the results of 4:2? | SELECT city FROM table_name_41 WHERE results¹ = "4:2" | sql_create_context |
CREATE TABLE table_50559 (
"Name" text,
"Year Began" text,
"Registration" text,
"Userpics Free" text,
"Userpics Paid" text,
"Monthly Cost for Paid Account" text,
"Yearly Cost for Paid Account" text,
"Permanent Account" text
) | Which permanent account has registration of invite-only and userpics free of unknown? | SELECT "Permanent Account" FROM table_50559 WHERE "Userpics Free" = 'unknown' AND "Registration" = 'invite-only' | wikisql |
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID... | For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of hire_date and the average of manager_id bin hire_date by time in a bar chart, and order by the y axis in ascending. | SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(MANAGER_ID) | nvbench |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.