context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_204_958 ( id number, "episode" number, "original broadcast date" text, "average" number, "rank" number, "remarks" text )
what was the date of the last episode that was broadcast ?
SELECT "original broadcast date" FROM table_204_958 ORDER BY "episode" DESC LIMIT 1
squall
CREATE TABLE table_74352 ( "Pick #" real, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
What position did the #94 pick play?
SELECT "Position" FROM table_74352 WHERE "Pick #" = '94'
wikisql
CREATE TABLE table_20957 ( "Country" text, "Skip" text, "W" real, "L" real, "PF" real, "PA" real, "Ends Won" real, "Ends Lost" real, "Blank Ends F/A" text, "Stolen Ends For" real, "Stolen Ends Against" real, "Shot %" real )
How many stolen ends against where there when Thomas Dufour was skip?
SELECT "Stolen Ends Against" FROM table_20957 WHERE "Skip" = 'Thomas Dufour'
wikisql
CREATE TABLE table_673 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
Who were the candidates when gregory w. meeks was the incumbent
SELECT "Candidates" FROM table_673 WHERE "Incumbent" = 'Gregory W. Meeks'
wikisql
CREATE TABLE table_name_87 ( attendance INTEGER, week VARCHAR, opponent VARCHAR )
What is the highest attendance for the game after week 1 against the New York Jets?
SELECT MAX(attendance) FROM table_name_87 WHERE week > 1 AND opponent = "new york jets"
sql_create_context
CREATE TABLE table_37798 ( "Episode No." real, "Episode Title" text, "UK Broadcast Date" text, "Narrator" text, "Writer" text, "Details of Journey" text, "Countries Visited" text )
Which details of journey had simon hoggart as a narrator?
SELECT "Details of Journey" FROM table_37798 WHERE "Narrator" = 'simon hoggart'
wikisql
CREATE TABLE player ( name_first VARCHAR, name_last VARCHAR, player_id VARCHAR ) CREATE TABLE player_award ( player_id VARCHAR )
Which 3 players won the most player awards? List their full name and id.
SELECT T1.name_first, T1.name_last, T1.player_id FROM player AS T1 JOIN player_award AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id ORDER BY COUNT(*) DESC LIMIT 3
sql_create_context
CREATE TABLE table_13335 ( "Season" text, "Rounds" real, "Champion" text, "Most tries" text, "Player of the Year" text )
For which season is Tim Mikkelson player of the year?
SELECT "Season" FROM table_13335 WHERE "Player of the Year" = 'tim mikkelson'
wikisql
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
java tag question with at least one answer.
SELECT COUNT(Title) FROM Posts WHERE Tags LIKE '%java%' AND NOT Tags LIKE '%javascript%' AND AnswerCount > 0 AND LOWER(Title) LIKE '%?' AND LOWER(Title) LIKE '%how%'
sede
CREATE TABLE table_36150 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Game Site" text, "Attendance" text )
What is the date of the game with 40,005 in attendance?
SELECT "Date" FROM table_36150 WHERE "Attendance" = '40,005'
wikisql
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, ...
count the number of living patients who underwent endoscopic sphincterotomy and papillotomy.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.long_title = "Endoscopic sphincterotomy and papillotomy"
mimicsql_data
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, ...
how many male patients had 102 as their procedure icd9 code?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.gender = "M" AND procedures.icd9_code = "102"
mimicsql_data
CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments ...
What Globalizing Consumer Cultures classes have no prerequisites ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id WHERE (area.area LIKE '%Globalizing Consumer Cultures%' OR course.description LIKE '%Globalizing Consumer Cultures%' OR course.name LIKE '%Globalizing Consumer Cultures%') AND course.enforced_r...
advising
CREATE TABLE table_name_24 ( year VARCHAR, chassis VARCHAR, points VARCHAR )
What is the total number of years that has a chassis of Ferrari 625 and 2 points?
SELECT COUNT(year) FROM table_name_24 WHERE chassis = "ferrari 625" AND points = "2"
sql_create_context
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, ...
The rep for the owner, commenter and replier. http://meta.stackexchange.com/questions/228620/querying-for-reputation-of-the-commenter-and-its-addressee-using-sede/234278#234278
SELECT c.Id, PostId, 'text', STR_POSITION('text', '@') AS at1, STR_POSITION('text', ' ', STR_POSITION('text', '@')) AS at1Token, SUBSTRING('text', STR_POSITION('text', '@') + 1, STR_POSITION('text', ' ', STR_POSITION('text', '@')) - (STR_POSITION('text', '@') + 1)) AS atreply, u.Id, u.DisplayName, owner.Id, owner.Displ...
sede
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, U...
suggested edits with most rejection reasons.
SELECT rt.SuggestedEditId AS "suggested_edit_link", COUNT(DISTINCT rr.RejectionReasonId) AS n FROM ReviewTasks AS rt INNER JOIN ReviewTaskResults AS rr ON rr.ReviewTaskId = rt.Id WHERE rt.ReviewTaskTypeId = 1 GROUP BY rt.SuggestedEditId ORDER BY COUNT(DISTINCT rr.RejectionReasonId) DESC LIMIT 200
sede
CREATE TABLE table_52808 ( "Year" text, "2010" real, "2009" real, "2008" real, "2005" real, "2000" real, "1995" real, "1990" real, "1985" real )
What is the minimum 2010 GDP if the 2009 GDP is larger than 3,749, 1995 GDP is 876 and 2008 GDP is larger than 4,885?
SELECT MIN("2010") FROM table_52808 WHERE "2009" > '3,749' AND "1995" = '876' AND "2008" > '4,885'
wikisql
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, ...
when was patient 1114 prescribed a medication via oral route the first time in 12/this year?
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1114) AND prescriptions.route = 'oral' AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m'...
mimic_iii
CREATE TABLE table_14121 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the lowest gold that has a silver less than 2, Zimbabwe as the nation, and a bronze less than 1?
SELECT MIN("Gold") FROM table_14121 WHERE "Silver" < '2' AND "Nation" = 'zimbabwe' AND "Bronze" < '1'
wikisql
CREATE TABLE table_name_54 ( line VARCHAR, name VARCHAR )
What is the line of Mangalore station?
SELECT line FROM table_name_54 WHERE name = "mangalore"
sql_create_context
CREATE TABLE table_1963459_2 ( date VARCHAR, year VARCHAR )
What day did the race in 1974 take place on?
SELECT date FROM table_1963459_2 WHERE year = 1974
sql_create_context
CREATE TABLE table_45416 ( "Race Title" text, "Circuit" text, "City / State" text, "Date" text, "Winner" text, "Team" text )
what is the circuit when the date is 16 april?
SELECT "Circuit" FROM table_45416 WHERE "Date" = '16 april'
wikisql
CREATE TABLE table_76930 ( "Rider" text, "Bike" text, "Laps" real, "Time" text, "Grid" real )
What driver had the highest grid position with a time of +0.283?
SELECT MAX("Grid") FROM table_76930 WHERE "Time" = '+0.283'
wikisql
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) 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, hadm_id number,...
what is the one thing patient 86792 was diagnosed with on the last hospital visit for the last time?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT diagnoses_icd.icd9_code FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 86792 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime D...
mimic_iii
CREATE TABLE table_38433 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
Which Rank has a Silver larger than 1 and a Total larger than 13?
SELECT "Rank" FROM table_38433 WHERE "Silver" > '1' AND "Total" > '13'
wikisql
CREATE TABLE table_34209 ( "Rank" text, "Country" text, "2009" text, "2010" text, "2011" text )
What was the value in 2011 for United States?
SELECT "2011" FROM table_34209 WHERE "Country" = 'united states'
wikisql
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE hz_info ( KH text, KLX number...
检验报告单15477952642属于什么检验类型?
SELECT zyjybgb.JYLX FROM zyjybgb WHERE zyjybgb.BGDH = '15477952642' UNION SELECT mzjybgb.JYLX FROM mzjybgb WHERE mzjybgb.BGDH = '15477952642'
css
CREATE TABLE table_62492 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What place is S.K. Ho in?
SELECT "Place" FROM table_62492 WHERE "Player" = 's.k. ho'
wikisql
CREATE TABLE qtb ( CLINIC_ID text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, IN...
医院8040470所有就诊记录中患者年纪平均值是多少?把结果按照不同的入院诊断编码和科室名字计算一下
SELECT qtb.MED_ORG_DEPT_NM, qtb.IN_DIAG_DIS_CD, AVG(qtb.PERSON_AGE) FROM qtb WHERE qtb.MED_SER_ORG_NO = '8040470' GROUP BY qtb.MED_ORG_DEPT_NM, qtb.IN_DIAG_DIS_CD UNION SELECT gyb.MED_ORG_DEPT_NM, gyb.IN_DIAG_DIS_CD, AVG(gyb.PERSON_AGE) FROM gyb WHERE gyb.MED_SER_ORG_NO = '8040470' GROUP BY gyb.MED_ORG_DEPT_NM, gyb.IN_...
css
CREATE TABLE table_6955 ( "Year" real, "Men's singles" text, "Women's singles" text, "Men's doubles" text, "Women's doubles" text, "Mixed doubles" text )
Who won women's singles in 1985?
SELECT "Women's singles" FROM table_6955 WHERE "Year" = '1985'
wikisql
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...
在2001年4月20日到2004年12月7日这段时间里,列出病患90461367在医院5572160中被开出全部的药品名称和编码分别是什么呢?
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 WHERE t_kc22.MED_CLINIC_ID IN (SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_ID = '90461367' AND gwyjzb.MED_SER_ORG_NO = '5572160' AND gwyjzb.IN_HOSP_DATE BETWEEN '2001-04-20' AND '2004-12-07' UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb...
css
CREATE TABLE table_80382 ( "Year" text, "Men's singles" text, "Women's singles" text, "Men's doubles" text, "Women's doubles" text, "Mixed doubles" text )
Who won the Women's doubles in the year that Billy Gilliland Karen Puttick won the Mixed doubles?
SELECT "Women's doubles" FROM table_80382 WHERE "Mixed doubles" = 'billy gilliland karen puttick'
wikisql
CREATE TABLE table_28856 ( "District" text, "Incumbent" text, "Party" text, "First elected" text, "Result" text, "Candidates" text )
What is the result for district pennsylvania 6?
SELECT "Result" FROM table_28856 WHERE "District" = 'Pennsylvania 6'
wikisql
CREATE TABLE table_23286112_6 ( record VARCHAR, high_rebounds VARCHAR )
What was the record in the game in which Jeff Green (14) did the most high rebounds?
SELECT record FROM table_23286112_6 WHERE high_rebounds = "Jeff Green (14)"
sql_create_context
CREATE TABLE table_name_68 ( year INTEGER, position VARCHAR )
What is the most recent year with a position of 3rd?
SELECT MAX(year) FROM table_name_68 WHERE position = "3rd"
sql_create_context
CREATE TABLE table_name_52 ( high_score INTEGER, inns VARCHAR, average VARCHAR, stump VARCHAR, catches VARCHAR )
What is the high score for the player with 0 stumps, 4 catches, more than 14 inns and an average smaller than 56.1?
SELECT SUM(high_score) FROM table_name_52 WHERE stump = 0 AND catches = 4 AND average < 56.1 AND inns > 14
sql_create_context
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
what is diagnoses icd9 code and procedure short title of subject id 23602?
SELECT diagnoses.icd9_code, procedures.short_title FROM diagnoses INNER JOIN procedures ON diagnoses.hadm_id = procedures.hadm_id WHERE diagnoses.subject_id = "23602"
mimicsql_data
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...
Count the number of patients admitted before 2124 categorized under chemistry lab tests.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2124" AND lab."CATEGORY" = "Chemistry"
mimicsql_data
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
which patients have lab test item id 51457?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51457"
mimicsql_data
CREATE TABLE table_name_99 ( country VARCHAR, to_par VARCHAR, place VARCHAR )
Which Country has a To par smaller than 7, and a Place of 1?
SELECT country FROM table_name_99 WHERE to_par < 7 AND place = "1"
sql_create_context
CREATE TABLE table_237757_9 ( position VARCHAR, nasl_club_s_ VARCHAR )
What position is Philadelphia Fury?
SELECT position FROM table_237757_9 WHERE nasl_club_s_ = "Philadelphia Fury"
sql_create_context
CREATE TABLE table_name_87 ( season VARCHAR, winners VARCHAR )
What Season had Dundee United as a Winner?
SELECT season FROM table_name_87 WHERE winners = "dundee united"
sql_create_context
CREATE TABLE table_8735 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Attendance" real, "Record" text, "Points" real )
What is Date, when Points is 13, and when Location is RBC Center?
SELECT "Date" FROM table_8735 WHERE "Points" = '13' AND "Location" = 'rbc center'
wikisql
CREATE TABLE table_train_75 ( "id" int, "pregnancy_or_lactation" bool, "alzheimer" bool, "alzheimer_family_history" bool, "body_mass_index_bmi" float, "age" float, "NOUSE" float )
we will limit the bmi to < 40 kg / m2 because of weight limits of the scanner bed and width limits of the mri.
SELECT * FROM table_train_75 WHERE body_mass_index_bmi < 40
criteria2sql
CREATE TABLE table_204_180 ( id number, "date" text, "opponent#" text, "rank#" text, "site" text, "result" text, "attendance" number )
what was the number of attendees for the september 19 game ?
SELECT "attendance" FROM table_204_180 WHERE "date" = 'september 19'
squall
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...
门诊就诊47300136969的中医诊断名叫什么?编号又是啥
SELECT txmzjzjlb.MZZYZDZZBM, txmzjzjlb.MZZYZDZZMC FROM txmzjzjlb WHERE txmzjzjlb.JZLSH = '47300136969' UNION SELECT ftxmzjzjlb.MZZYZDZZBM, ftxmzjzjlb.MZZYZDZZMC FROM ftxmzjzjlb WHERE ftxmzjzjlb.JZLSH = '47300136969'
css
CREATE TABLE machine ( Machine_ID int, Making_Year int, Class text, Team text, Machine_series text, value_points real, quality_rank int ) CREATE TABLE technician ( technician_id real, Name text, Team text, Starting_Year real, Age int ) CREATE TABLE repair_assignment ( ...
A bar chart for what are the number of the names of the technicians by ascending order of age?
SELECT Name, COUNT(Name) FROM technician GROUP BY Name ORDER BY Age
nvbench
CREATE TABLE party ( Party_ID int, Minister text, Took_office text, Left_office text, Region_ID int, Party_name text ) CREATE TABLE region ( Region_ID int, Region_name text, Date text, Label text, Format text, Catalogue text ) CREATE TABLE member ( Member_ID int, ...
How many parties of the time they took office, binning the took office into WEEKDAY interval
SELECT Took_office, COUNT(Took_office) FROM party
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
calculate the total number of unmarried male patients.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.gender = "M"
mimicsql_data
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttim...
how long is the last stay of patient 16992 in the icu?
SELECT STRFTIME('%j', icustays.outtime) - STRFTIME('%j', icustays.intime) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 16992) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1
mimic_iii
CREATE TABLE table_19487922_1 ( seasons VARCHAR, country VARCHAR )
How many seasons for Monaco?
SELECT seasons FROM table_19487922_1 WHERE country = "Monaco"
sql_create_context
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 patients ( row_id number, subject_id number, gender text, dob time, dod time ) ...
count the number of patients who have received a destruct peritoneal tiss procedure within the same month after having received a insert endotracheal tube in 2101.
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'insert endo...
mimic_iii
CREATE TABLE table_name_35 ( season VARCHAR, caps VARCHAR, club VARCHAR )
Which season has Caps lower than 36 for the Club of NAC Breda?
SELECT season FROM table_name_35 WHERE caps < 36 AND club = "nac breda"
sql_create_context
CREATE TABLE table_57858 ( "Year" real, "Chassis" text, "Engine" text, "Tyres" text, "Points" real )
What is the earliest year for 9 points?
SELECT MIN("Year") FROM table_57858 WHERE "Points" = '9'
wikisql
CREATE TABLE table_76513 ( "Rider" text, "Manufacturer" text, "Laps" real, "Time" text, "Grid" real )
Which Manufacturer has a Time of accident and a Grid greater than 15?
SELECT "Manufacturer" FROM table_76513 WHERE "Time" = 'accident' AND "Grid" > '15'
wikisql
CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), AllergyType VARCHAR(20) ) CREATE TABLE Has_Allergy ( StuID INTEGER, Allergy VARCHAR(20) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER...
Show all ages and corresponding number of students. Show the correlation.
SELECT Age, COUNT(*) FROM Student GROUP BY Age
nvbench
CREATE TABLE table_32231 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text )
What date was the Competition of rothmans cup?
SELECT "Date" FROM table_32231 WHERE "Competition" = 'rothmans cup'
wikisql
CREATE TABLE table_60720 ( "Greek Designation" text, "Collegiate Institution" text, "Charter Date" text, "Status" text, "City" text, "U.S. State/District" text )
What's the greek designation of the city riverside?
SELECT "Greek Designation" FROM table_60720 WHERE "City" = 'riverside'
wikisql
CREATE TABLE table_47331 ( "Round" real, "Pick" real, "Player" text, "Position" text, "School" text )
How many rounds had a position of kicker?
SELECT SUM("Round") FROM table_47331 WHERE "Position" = 'kicker'
wikisql
CREATE TABLE person_info_hz_info ( RYBH text, KH number, KLX number, YLJGDM number ) CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC t...
为患者69016896检测指标301582的医务人员工号及姓名都是什么,从14年10月26日到15年11月3日这一年内?
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM ...
css
CREATE TABLE table_29582 ( "Pos" real, "SP" real, "No." real, "Driver" text, "Car Name" text, "Car Make" text, "Entrant" text, "Laps" real, "Status" text )
What is the car make for Sterling Marlin?
SELECT "Car Make" FROM table_29582 WHERE "Driver" = 'Sterling Marlin'
wikisql
CREATE TABLE table_1566852_4 ( date VARCHAR )
Who was featured in 20 questions on 4-03?
SELECT 20 AS _questions FROM table_1566852_4 WHERE date = "4-03"
sql_create_context
CREATE TABLE table_name_35 ( crowd INTEGER, away_team VARCHAR )
With a North Melbourne away team, what is the average crowd?
SELECT AVG(crowd) FROM table_name_35 WHERE away_team = "north melbourne"
sql_create_context
CREATE TABLE farm_competition ( Host_city_ID VARCHAR ) CREATE TABLE city ( Official_Name VARCHAR, City_ID VARCHAR )
Show the official names of the cities that have hosted more than one competition.
SELECT T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID HAVING COUNT(*) > 1
sql_create_context
CREATE TABLE table_68521 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Record" text )
What was the loss of the game with a record of 84-71?
SELECT "Loss" FROM table_68521 WHERE "Record" = '84-71'
wikisql
CREATE TABLE table_name_21 ( term_in_office VARCHAR, order VARCHAR )
What is the Term in office with an Order that is 9?
SELECT term_in_office FROM table_name_21 WHERE order = "9"
sql_create_context
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid n...
what is the average cost to the hospital which involves stricture of artery until 2104.
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'stricture of artery')) AND STRFTIME('%y', cost.chargetime) <= '...
mimic_iii
CREATE TABLE table_6086 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
Who was the visiting team when the record was 51 12 4?
SELECT "Visitor" FROM table_6086 WHERE "Record" = '51–12–4'
wikisql
CREATE TABLE table_3431 ( "Series #" real, "Season #" real, "Title" text, "Director" text, "Writer(s)" text, "Airdate" text )
Who directed the episode with a title of ' old friend '?
SELECT "Director" FROM table_3431 WHERE "Title" = ' Old Friend '
wikisql
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...
count the number of times patient 3369 was given a other skin & subq i & d in the first hospital encounter.
SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'other skin & subq i & d') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3369 AND NOT admissions.dis...
mimic_iii
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate tim...
All badges by day-of-week (2011).
SELECT Name, CASE Class WHEN 1 THEN '1-Gold' WHEN 2 THEN '2-Silver' WHEN 3 THEN '3-Bronze' END AS Class, TagBased, COUNT(Id) AS BadgeTotal FROM Badges WHERE YEAR(Date) = 2011 GROUP BY Name, Class, TagBased
sede
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For those records from the products and each product's manufacturer, give me the comparison about the amount of headquarter over the headquarter , and group by attribute headquarter, and could you order in descending by the Y please?
SELECT Headquarter, COUNT(Headquarter) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY COUNT(Headquarter) DESC
nvbench
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number,...
how many days have it been since the first stay of patient 002-34744 on this hospital visit in the ward 83?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '002-34744' AND patient.wardid = 83 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1
eicu
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
从0五年二月二十日开始,截止到0五年六月二十七日,医院5034604的医疗记录总的数量有多少
SELECT COUNT(*) FROM t_kc21 WHERE MED_SER_ORG_NO = '5034604' AND IN_HOSP_DATE BETWEEN '2005-02-20' AND '2005-06-27'
css
CREATE TABLE table_name_9 ( floors INTEGER, pinnacle_height_ft__m_ VARCHAR, pinn_rank VARCHAR )
Which Floors have a Pinnacle height ft (m) of 1,136 (346), and a Pinn Rank larger than 4?
SELECT AVG(floors) FROM table_name_9 WHERE pinnacle_height_ft__m_ = "1,136 (346)" AND pinn_rank > 4
sql_create_context
CREATE TABLE mountain ( Mountain_ID int, Name text, Height real, Prominence real, Range text, Country text ) CREATE TABLE climber ( Climber_ID int, Name text, Country text, Time text, Points real, Mountain_ID int )
What are the countries of mountains with height bigger than 5000, and count them by a bar chart, and I want to list y-axis in asc order.
SELECT Country, COUNT(Country) FROM mountain WHERE Height > 5000 GROUP BY Country ORDER BY COUNT(Country)
nvbench
CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), AllergyType VARCHAR(20) ) CREATE TABLE Has_Allergy ( StuID INTEGER, Allergy VARCHAR(20) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER...
Show the average age for all female students and group them by first name in a bar chart.
SELECT Fname, AVG(Age) FROM Student WHERE Sex = 'F' GROUP BY Fname
nvbench
CREATE TABLE table_71715 ( "Rank" real, "Player" text, "Games" real, "Goals" real, "Goal Ratio" real, "Debut in Europe" real )
What are the smallest goals with a Goal Ratio of 0.14, and a Debut in Europe smaller than 1995?
SELECT MIN("Goals") FROM table_71715 WHERE "Goal Ratio" = '0.14' AND "Debut in Europe" < '1995'
wikisql
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREAT...
how many hours have it been since the last time patient 031-13920 had a procedure in this hospital encounter?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-13920...
eicu
CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) CREATE TABLE DEPARTME...
Show me a bar chart for what is the total credit does each department offer?, I want to list X in desc order.
SELECT DEPT_CODE, SUM(CRS_CREDIT) FROM COURSE GROUP BY DEPT_CODE ORDER BY DEPT_CODE DESC
nvbench
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
For those records from the products and each product's manufacturer, return a bar chart about the distribution of headquarter and the sum of price , and group by attribute headquarter.
SELECT Headquarter, SUM(Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter
nvbench
CREATE TABLE table_204_87 ( id number, "courthouse" text, "city" text, "street address" text, "jurisdiction" text, "dates of use" text, "named for" text )
what city has more courthouses , aberdeen or greenville ?
SELECT "city" FROM table_204_87 WHERE "city" IN ('aberdeen', 'greenville') GROUP BY "city" ORDER BY COUNT("courthouse") DESC LIMIT 1
squall
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
what is the lab category forJerry Deberry?
SELECT lab."CATEGORY" FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.name = "Jerry Deberry"
mimicsql_data
CREATE TABLE table_name_22 ( caps VARCHAR, player VARCHAR )
How many caps did the player Mile Sterjovski have?
SELECT caps FROM table_name_22 WHERE player = "mile sterjovski"
sql_create_context
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number...
when did patient 030-42006 last have an intake, on this month/22?
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-42006')) AND intakeoutput.cellpath LIKE '%intake%...
eicu
CREATE TABLE table_7902 ( "Round" real, "Pick" real, "Player" text, "Nationality" text, "College" text )
What is the nationality of the round 4 draft selection who played college ball at oklahoma?
SELECT "Nationality" FROM table_7902 WHERE "Round" = '4' AND "College" = 'oklahoma'
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 maximum age of married patients aged 47 years or more?
SELECT MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.age >= "47"
mimicsql_data
CREATE TABLE table_16534 ( "Year" real, "Numer of Jamaicans granted British citizenship" real, "Naturalisation by residence" real, "Naturalisation by marriage" real, "Registration of a minor child" real, "Registration by other means" real )
what is the maximum year with registration of a minor child being 281
SELECT MAX("Year") FROM table_16534 WHERE "Registration of a minor child" = '281'
wikisql
CREATE TABLE table_train_157 ( "id" int, "gender" string, "systolic_blood_pressure_sbp" int, "hemoglobin_a1c_hba1c" float, "platelets" int, "renal_disease" bool, "c_reactive_protein" float, "creatinine_clearance_cl" float, "urine_protein" int, "serum_creatinine" float, "prote...
proteinuria ( urine protein > 200 mg / dl ) or a creatinine > 1.5 mg / dl ( male ) or 1.4 mg / dl ( female )
SELECT * FROM table_train_157 WHERE (proteinuria = 1 OR urine_protein > 200) OR (creatinine_clearance_cl > 1.5 AND gender = 'male') OR (creatinine_clearance_cl > 1.4 AND gender = 'female')
criteria2sql
CREATE TABLE table_13953 ( "Date" text, "Tournament" text, "Surface" text, "Opponent in the final" text, "Score" text )
what is the score on may 11, 1997?
SELECT "Score" FROM table_13953 WHERE "Date" = 'may 11, 1997'
wikisql
CREATE TABLE table_74538 ( "Name" text, "Circuit" text, "Date" text, "Winning driver" text, "Winning constructor" text, "Report" text )
Tell me the report for 10 april
SELECT "Report" FROM table_74538 WHERE "Date" = '10 april'
wikisql
CREATE TABLE table_7746 ( "Year" real, "Manufacturer" text, "Start" real, "Finish" real, "Team" text )
What Team was in 2005?
SELECT "Team" FROM table_7746 WHERE "Year" = '2005'
wikisql
CREATE TABLE table_11526 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text )
What is the total attendance of the game with Toronto as the visitor team?
SELECT COUNT("Attendance") FROM table_11526 WHERE "Visitor" = 'toronto'
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 prescription...
find the number of patients with dehydration diagnoses who were discharged to psychiatric facility-partial hospitalization.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND diagnoses.long_title = "Dehydration"
mimicsql_data
CREATE TABLE table_24191 ( "Season" real, "Season premiere" text, "Season finale" text, "TV Season" text, "Rank" text, "Viewers (in millions)" text )
Name the rank for 14.80 viewers
SELECT "Rank" FROM table_24191 WHERE "Viewers (in millions)" = '14.80'
wikisql
CREATE TABLE table_30120560_1 ( civil_parish VARCHAR, area__acres__ VARCHAR )
which cilvil parishes have areas of 405?
SELECT civil_parish FROM table_30120560_1 WHERE area__acres__ = 405
sql_create_context
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE medication ( medicationid number, pat...
on last month/12, what was the last time patient 017-20711 had the maximum respiration?
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-20711')) AND NOT vitalperiodic.respiration IS N...
eicu
CREATE TABLE table_name_46 ( country VARCHAR, gdp__nominal_ VARCHAR )
Which country has a GDP (nominal) of $29.9 billion?
SELECT country FROM table_name_46 WHERE gdp__nominal_ = "$29.9 billion"
sql_create_context
CREATE TABLE table_name_41 ( playoffs_1 VARCHAR, season VARCHAR )
What is the playoffs 1 result of season 2004-05?
SELECT playoffs_1 FROM table_name_41 WHERE season = "2004-05"
sql_create_context
CREATE TABLE table_25143284_1 ( score_qualifying VARCHAR, score_final VARCHAR )
What was the qualifying score of the competition whose final score was 12.200?
SELECT score_qualifying FROM table_25143284_1 WHERE score_final = "12.200"
sql_create_context