context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_204_561 ( id number, "fence" number, "name" text, "jockey" text, "age" number, "handicap (st-lb)" text, "starting price" text, "fate" text )
which jockey is before tm jones
SELECT "jockey" FROM table_204_561 WHERE id = (SELECT id FROM table_204_561 WHERE "jockey" = 'tm jones') - 1
squall
CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE comment_instructor ( instructor_id int...
Will there be a 3 -credit upper level class in Winter 2018 ?
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND course.credits = 3 AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Winter' AND se...
advising
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE medication ( med...
what procedure did patient 015-15167 receive for the first time in 2100?
SELECT treatment.treatmentname FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-15167')) AND STRFTIME('%y', treatment.treatmenttime) = '2100'...
eicu
CREATE TABLE table_21865 ( "Official Name" text, "Status" text, "Area km 2" text, "Population" real, "Census Ranking" text )
What is the name of the place with 582.20 square km area?
SELECT "Official Name" FROM table_21865 WHERE "Area km 2" = '582.20'
wikisql
CREATE TABLE table_name_19 ( object_type VARCHAR, ngc_number VARCHAR )
Which Object type has a NGC number of 2787?
SELECT object_type FROM table_name_19 WHERE ngc_number = 2787
sql_create_context
CREATE TABLE table_32852 ( "Date" real, "Sport" text, "Winner" text, "Score" text, "Loser" text )
What sport was played before 2006 with a loser of france b?
SELECT "Sport" FROM table_32852 WHERE "Date" < '2006' AND "Loser" = 'france b'
wikisql
CREATE TABLE table_name_37 ( steal_intercept_ball VARCHAR, sliding_tackle VARCHAR, dump_tackle VARCHAR )
Which steal/intercept ball has no for both the sliding tackle and dump tackle?
SELECT steal_intercept_ball FROM table_name_37 WHERE sliding_tackle = "no" AND dump_tackle = "no"
sql_create_context
CREATE TABLE table_30133_1 ( export_volume_of_goods_and_services__percent_change_ VARCHAR, gdp_at_current_prices__usd_billions_ VARCHAR )
How many export volume of goods and services values are associated with GDP at current prices of 161.340?
SELECT COUNT(export_volume_of_goods_and_services__percent_change_) FROM table_30133_1 WHERE gdp_at_current_prices__usd_billions_ = "161.340"
sql_create_context
CREATE TABLE CLASS ( CLASS_CODE varchar(5), CRS_CODE varchar(10), CLASS_SECTION varchar(2), CLASS_TIME varchar(20), CLASS_ROOM varchar(8), PROF_NUM int ) CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) CREATE...
What is the weekday of birth of professors teaching course ACCT-211? Show a bar chart, and rank total number from high to low order.
SELECT EMP_DOB, COUNT(EMP_DOB) FROM EMPLOYEE AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE CRS_CODE = "ACCT-211" ORDER BY COUNT(EMP_DOB) DESC
nvbench
CREATE TABLE table_23152 ( "LGA Name" text, "Area (km 2 )" real, "Census 2006 population" real, "Administrative capital" text, "Postal Code" real )
What is the LGA name where the 2006 census population is bigger than 425208.9417698913 and administrative capital is port harcourt?
SELECT "LGA Name" FROM table_23152 WHERE "Census 2006 population" > '425208.9417698913' AND "Administrative capital" = 'Port Harcourt'
wikisql
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...
20027341的团伙成员最常开的药品的排序看一下
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_ID = '20027341' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLIN...
css
CREATE TABLE table_42510 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
Who was the home team for tie number 16?
SELECT "Home team" FROM table_42510 WHERE "Tie no" = '16'
wikisql
CREATE TABLE table_name_54 ( isbn VARCHAR, japanese_title VARCHAR )
What is the ISBN of Japanese Title of (kiri no h monsha)?
SELECT isbn FROM table_name_54 WHERE japanese_title = "霧の訪問者 (kiri no hōmonsha)"
sql_create_context
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE Posts ...
Number of answers per question.
SELECT q.AnswerCount AS "Nb Answers", q.Id AS "post_link", u.Id AS "user_link" FROM Posts AS q INNER JOIN Users AS u ON u.Id = q.OwnerUserId WHERE q.PostTypeId = 1 ORDER BY q.AnswerCount DESC, u.Id
sede
CREATE TABLE Assessment_Notes ( notes_id INTEGER, student_id INTEGER, teacher_id INTEGER, date_of_notes DATETIME, text_of_notes VARCHAR(255), other_details VARCHAR(255) ) CREATE TABLE Ref_Detention_Type ( detention_type_code VARCHAR(10), detention_type_description VARCHAR(80) ) CREATE ...
A scatter chart shows the correlation between student_id and monthly_rental , and group by attribute other_details.
SELECT student_id, monthly_rental FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
nvbench
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airp...
what flights from LAS VEGAS to MONTREAL on saturday
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, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MONTREAL' AND date_day.day_number = 26 AND date_day.month_number = 7 AND ...
atis
CREATE TABLE table_204_835 ( id number, "rank" number, "lane" number, "name" text, "nationality" text, "time" text, "notes" text )
did austria or russia rank higher ?
SELECT "nationality" FROM table_204_835 WHERE "nationality" IN ('austria', 'russia') ORDER BY id LIMIT 1
squall
CREATE TABLE table_37504 ( "Date" text, "Tournament" text, "Location" text, "Winner" text, "Score" text, "1st prize ( $ )" text )
What date was the Monsanto open located in Florida?
SELECT "Date" FROM table_37504 WHERE "Location" = 'florida' AND "Tournament" = 'monsanto open'
wikisql
CREATE TABLE table_260938_1 ( base_10 VARCHAR, shortscale_comparison VARCHAR )
Name the base 10 for shortscale comparison for billion
SELECT base_10 FROM table_260938_1 WHERE shortscale_comparison = "Billion"
sql_create_context
CREATE TABLE table_test_20 ( "id" int, "ejection_fraction_ef" int, "anemia" bool, "gender" string, "bleeding" int, "systolic_blood_pressure_sbp" int, "left_main_coronary_artery_stenosis" int, "hemoglobin_a1c_hba1c" float, "renal_disease" bool, "creatinine_clearance_cl" float, ...
known renal insufficiency ( prior s _ creatinine > 2.5 mg % ( > 220 umol / l ) for male and 2 mg % ( > 175 umol / l ) ) for female
SELECT * FROM table_test_20 WHERE renal_disease = 1 OR ((gender = 'male' AND prior_creatinine > 2.5) OR (gender = 'female' AND prior_creatinine > 2))
criteria2sql
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, ...
在04年4月20日到05年7月29日这段时间里,病患70347742所有检验结果指标记录的检测人为杨玛丽的检验指标流水号是多少啊?
SELECT jyjgzbb.JYZBLSH FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN jybgb_jyjgzbb 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 = jybgb_jyjgzbb.YLJGDM AND jybgb.BGD...
css
CREATE TABLE table_name_38 ( drawn INTEGER, lost VARCHAR )
What is the lowest drawn for entries with a lost of 13?
SELECT MIN(drawn) FROM table_name_38 WHERE lost = 13
sql_create_context
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, ...
since 2101, what are the four most frequent interventions that patients were given in the same month after receiving aortocor bypas-3 cor art?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admi...
mimic_iii
CREATE TABLE table_41924 ( "Rank" real, "Name" text, "Team" text, "Games" real, "Points" real )
What is the sum of Rank, when Name is Will Solomon, and when Games is greater than 21?
SELECT SUM("Rank") FROM table_41924 WHERE "Name" = 'will solomon' AND "Games" > '21'
wikisql
CREATE TABLE table_74229 ( "Series no." real, "Season no." real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real, "U.S. viewers (millions)" text )
who directed the episode entitled 'home is where the hospital is'?
SELECT "Directed by" FROM table_74229 WHERE "Title" = 'Home Is Where the Hospital Is'
wikisql
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
在编号为3731061的这家医院中,有多少科室的最长医疗住院时长低于8天
SELECT COUNT(*) FROM (SELECT MED_ORG_DEPT_CD FROM t_kc21 WHERE MED_SER_ORG_NO = '3731061' GROUP BY MED_ORG_DEPT_CD HAVING MAX(IN_HOSP_DAYS) < 8) AS T
css
CREATE TABLE table_38836 ( "Distance" text, "Time" text, "Date" text, "Location" text, "Notes" text )
What's the location when the notes area is notes?
SELECT "Location" FROM table_38836 WHERE "Notes" = 'notes'
wikisql
CREATE TABLE table_name_49 ( score VARCHAR, date VARCHAR )
What was the score for the game on December 20?
SELECT score FROM table_name_49 WHERE date = "december 20"
sql_create_context
CREATE TABLE table_5418 ( "Game" real, "December" real, "Opponent" text, "Score" text, "Record" text, "Points" real )
Which Opponent has a Score of 4 5 ot?
SELECT "Opponent" FROM table_5418 WHERE "Score" = '4–5 ot'
wikisql
CREATE TABLE table_78861 ( "Week" real, "Event" text, "Air Date" text, "Winning team" text, "Winners club" text )
Which Week has an Air Date of august 30, 2008?
SELECT "Week" FROM table_78861 WHERE "Air Date" = 'august 30, 2008'
wikisql
CREATE TABLE table_name_54 ( year_built VARCHAR, current_status VARCHAR, boat_builder VARCHAR )
What year did J. Jones, trearddur bay build a boat with a current status of tbsc?
SELECT year_built FROM table_name_54 WHERE current_status = "tbsc" AND boat_builder = "j. jones, trearddur bay"
sql_create_context
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...
从17年8月23开始到21年9月16号医疗机构5999145保险是儿童医疗保险的就诊记录数
SELECT COUNT(*) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '5999145' AND gwyjzb.IN_HOSP_DATE BETWEEN '2017-08-23' AND '2021-09-16' AND gwyjzb.INSU_TYPE = '儿童' UNION SELECT COUNT(*) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '5999145' AND fgwyjzb.IN_HOSP_DATE BETWEEN '2017-08-23' AND '2021-09-16' AND fgwyjzb.INSU_TYPE =...
css
CREATE TABLE table_46337 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Record" text )
Who made the decision when toronto was the home team?
SELECT "Decision" FROM table_46337 WHERE "Home" = 'toronto'
wikisql
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
let me know the gender and short title of diagnoses for patient with patient id 2560.
SELECT demographic.gender, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "2560"
mimicsql_data
CREATE TABLE table_19103 ( "Club" text, "Played" text, "Won" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Tries for" text, "Tries against" text, "Try bonus" text, "Losing bonus" text, "Points" text )
What is the losing bonus when the points are 24?
SELECT "Losing bonus" FROM table_19103 WHERE "Points" = '24'
wikisql
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE 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 ...
以前,患者曹烨磊做过那些治疗?
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_NM = '曹烨磊' AND t_kc22.MED_INV_ITEM_TYPE = '治疗费'
css
CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE program ( program_id int, name varchar, college varc...
Will HUMGEN 821 have more than one lecture section next semester , and if so , how many ?
SELECT COUNT(*) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'HUMGEN' AND course.number = 821 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016
advising
CREATE TABLE faculty ( facid number, lname text, fname text, rank text, sex text, phone number, room text, building text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) C...
Give the building that the instructor who teaches the greatest number of courses lives in.
SELECT T2.building FROM course AS T1 JOIN faculty AS T2 ON T1.instructor = T2.facid GROUP BY T1.instructor ORDER BY COUNT(*) DESC LIMIT 1
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
What is the number of patients with primary disease pneumonia who were discharged home?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "HOME" AND demographic.diagnosis = "PNEUMONIA"
mimicsql_data
CREATE TABLE bdmzjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH number, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZD...
那个叫水幼安的患者报告日期在两千零四年九月八日之前的检验报告单对应了哪些住院就诊记录?其在住院时的就诊流水号具体为啥?
SELECT wdmzjzjlb.JZLSH FROM person_info JOIN hz_info JOIN wdmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE person_info.XM = '水幼安' AND NOT wdmzjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ >= '2004-09-0...
css
CREATE TABLE table_19354 ( "Team" text, "Average" text, "Points" real, "Played" real, "1987-88" text, "1988-89" text, "1989-90" real )
How many points in 87/88 for racing de c rdoba?
SELECT "1987-88" FROM table_19354 WHERE "Team" = 'Racing de Córdoba'
wikisql
CREATE TABLE table_17505751_5 ( Champions VARCHAR, position VARCHAR, league VARCHAR )
In the Champions league is the forward position smaller than 6.0
SELECT COUNT(Champions) AS league FROM table_17505751_5 WHERE position = "Forward" AND league < 6.0
sql_create_context
CREATE TABLE table_name_27 ( prominence__m_ VARCHAR, elevation__m_ VARCHAR, country VARCHAR, col__m_ VARCHAR )
What is the total prominence number in m of ethiopia, which has a col in m of 1728 and an elevation less than 3,358?
SELECT COUNT(prominence__m_) FROM table_name_27 WHERE country = "ethiopia" AND col__m_ = 1728 AND elevation__m_ < 3 OFFSET 358
sql_create_context
CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Coun...
Return a bar chart about the distribution of meter_200 and the average of ID , and group by attribute meter_200, and order from high to low by the bars.
SELECT meter_200, AVG(ID) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 DESC
nvbench
CREATE TABLE Customers ( customer_id INTEGER, payment_method_code VARCHAR(10), customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80) ) CREATE TABLE Suppliers ( supplier_id INTEGER, supplier_name VA...
Bar chart of maximal product price from each product type code, show in desc by the maximal product price please.
SELECT product_type_code, MAX(product_price) FROM Products GROUP BY product_type_code ORDER BY MAX(product_price) DESC
nvbench
CREATE TABLE table_20686 ( "Year" real, "Starts" real, "Wins" real, "Top 10" real, "Avg. Start" text, "Avg. Finish" text, "Winnings" text, "Position" text, "Team(s)" text )
How many years did he have an average finish of 29.2?
SELECT COUNT("Winnings") FROM table_20686 WHERE "Avg. Finish" = '29.2'
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...
Calculate the total number of patients from hispanic or latino or puertorican ethnic origin who remained admitted in the hospital for more than 17 days.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND demographic.days_stay > "17"
mimicsql_data
CREATE TABLE player ( Player_ID int, name text, Position text, Club_ID int, Apps real, Tries real, Goals text, Points real ) CREATE TABLE club_rank ( Rank real, Club_ID int, Gold real, Silver real, Bronze real, Total real ) CREATE TABLE club ( Club_ID int, ...
Show the number of different competition types with a bar graph, list in asc by the Y please.
SELECT Competition_type, COUNT(Competition_type) FROM competition GROUP BY Competition_type ORDER BY COUNT(Competition_type)
nvbench
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 diagnoses ( ...
how many patients whose ethnicity is white and lab test name is total protein, pleural?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "WHITE" AND lab.label = "Total Protein, Pleural"
mimicsql_data
CREATE TABLE table_1341598_36 ( district VARCHAR, incumbent VARCHAR )
where is the district where the incumbent is del latta?
SELECT district FROM table_1341598_36 WHERE incumbent = "Del Latta"
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( ...
What is the number of patients who had procedure icd9 code 3950 and died in or before 2133?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2133.0" AND procedures.icd9_code = "3950"
mimicsql_data
CREATE TABLE table_43250 ( "Tournament" text, "2000" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text )
What's the tournamnet name that has a 2001 of 1r and 2011?
SELECT "Tournament" FROM table_43250 WHERE "2001" = '1r' AND "2011" = 'a'
wikisql
CREATE TABLE table_53655 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the smallest crowd at junction oval?
SELECT MIN("Crowd") FROM table_53655 WHERE "Venue" = 'junction oval'
wikisql
CREATE TABLE table_11677691_4 ( player VARCHAR, college VARCHAR )
Which player went to the college Southern California?
SELECT player FROM table_11677691_4 WHERE college = "Southern California"
sql_create_context
CREATE TABLE table_name_20 ( name VARCHAR, games VARCHAR, assists VARCHAR )
Who played over 37 games and had 202 assists?
SELECT name FROM table_name_20 WHERE games > 37 AND assists = 202
sql_create_context
CREATE TABLE table_59759 ( "Round" text, "Club" text, "Home" text, "Away" text, "Aggregate" text )
Which club had round of group stage round 1 and 5?
SELECT "Club" FROM table_59759 WHERE "Round" = 'group stage round 1 and 5'
wikisql
CREATE TABLE table_44594 ( "Season" text, "Series" text, "Team Name" text, "Races" real, "Poles" real, "Wins" real, "Points" real, "Final Placing" text )
Can you tell me the Series that has the Wins of 0, and the Season of a 2002?
SELECT "Series" FROM table_44594 WHERE "Wins" = '0' AND "Season" = '2002'
wikisql
CREATE TABLE table_18454 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
What is the most first elected for james c. davis?
SELECT MAX("First elected") FROM table_18454 WHERE "Incumbent" = 'James C. Davis'
wikisql
CREATE TABLE table_name_12 ( round INTEGER, player VARCHAR, pick__number VARCHAR )
Which the highest Round has a Player of mike williams, and a Pick # larger than 4?
SELECT MAX(round) FROM table_name_12 WHERE player = "mike williams" AND pick__number > 4
sql_create_context
CREATE TABLE table_5639 ( "Round" real, "Player" text, "Position" text, "Nationality" text, "College/Junior/Club Team (League)" text )
What league has a 10 for round with Paul Cain?
SELECT "College/Junior/Club Team (League)" FROM table_5639 WHERE "Round" = '10' AND "Player" = 'paul cain'
wikisql
CREATE TABLE table_63105 ( "Rank" real, "Lane" real, "Name" text, "Nationality" text, "Time" real )
Which Time has a Lane smaller than 4, and a Rank larger than 6?
SELECT AVG("Time") FROM table_63105 WHERE "Lane" < '4' AND "Rank" > '6'
wikisql
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_Neutral and School_ID in a bar chart.
SELECT All_Neutral, School_ID FROM basketball_match
nvbench
CREATE TABLE table_12628 ( "Result" text, "Opponent" text, "Method" text, "Event" text, "Notes" text )
Who was the opponent when the method was points (4 x 0)?
SELECT "Opponent" FROM table_12628 WHERE "Method" = 'points (4 x 0)'
wikisql
CREATE TABLE table_name_13 ( location VARCHAR, result VARCHAR )
What was the location of the match that had a result of 3-3?
SELECT location FROM table_name_13 WHERE result = "3-3"
sql_create_context
CREATE TABLE table_79580 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the fewest number of silver medals won by Canada with fewer than 3 total medals?
SELECT MIN("Silver") FROM table_79580 WHERE "Nation" = 'canada' AND "Total" < '3'
wikisql
CREATE TABLE table_test_2 ( "id" int, "loss_of_consciousness" bool, "gender" string, "bleeding" int, "systolic_blood_pressure_sbp" int, "stroke" bool, "renal_disease" bool, "hemorrhagic_diathesis" bool, "transient_ischemic_attack" bool, "creatinine_clearance_cl" float, "demen...
patients with loss of consciousness or ( glasgow < 14 )
SELECT * FROM table_test_2 WHERE loss_of_consciousness = 1 OR glasgow_come_score_gcs < 14
criteria2sql
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...
what is the number of patients whose insurance is medicaid and diagnoses icd9 code is 3569?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicaid" AND diagnoses.icd9_code = "3569"
mimicsql_data
CREATE TABLE table_name_1 ( final_round VARCHAR, year VARCHAR )
In 1975, what was the final round?
SELECT final_round FROM table_name_1 WHERE year = "1975"
sql_create_context
CREATE TABLE table_19131 ( "Character Name" text, "Voice Actor (Japanese)" text, "Voice Actor (English 1997 / Saban)" text, "Voice Actor (English 1998 / Pioneer)" text, "Voice Actor (English 2006 / FUNimation)" text )
what's the character name with voice actor (englbeingh 1997 / saban) being ian james corlett
SELECT "Character Name" FROM table_19131 WHERE "Voice Actor (English 1997 / Saban)" = 'Ian James Corlett'
wikisql
CREATE TABLE table_name_87 ( a_side VARCHAR, catalog_number VARCHAR )
What is the A-side for catalog 902?
SELECT a_side FROM table_name_87 WHERE catalog_number = "902"
sql_create_context
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,...
706这个科室在二0一五年七月二十四日到二0一五年八月二十四日,这一个月内因疾病H52.059住院的平均费用有多少
SELECT AVG(MED_AMOUT) FROM t_kc21 WHERE MED_ORG_DEPT_CD = '706' AND IN_HOSP_DATE BETWEEN '2015-07-24' AND '2015-08-24' AND IN_DIAG_DIS_CD = 'H52.059' AND CLINIC_TYPE = '住院'
css
CREATE TABLE table_name_20 ( venue VARCHAR, winner VARCHAR )
What was the venue when Jerran Hart won?
SELECT venue FROM table_name_20 WHERE winner = "jerran hart"
sql_create_context
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...
get the number of patients who are diagnosed with acute parametritis and pelvic cellulitis.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Acute parametritis and pelvic cellulitis"
mimicsql_data
CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_proje...
Show me Independent Studies courses that have 15 credits .
SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%Independent Studies%' OR name LIKE '%Independent Studies%') AND credits = 15
advising
CREATE TABLE table_22081847_1 ( money_list_rank VARCHAR, earnings__$_ VARCHAR )
If the earning amount is $309,886, what is the money list ranking?
SELECT money_list_rank FROM table_22081847_1 WHERE earnings__$_ = "309,886"
sql_create_context
CREATE TABLE Lots ( lot_id INTEGER, investor_id INTEGER, lot_details VARCHAR(255) ) CREATE TABLE Transactions_Lots ( transaction_id INTEGER, lot_id INTEGER ) CREATE TABLE Transactions ( transaction_id INTEGER, investor_id INTEGER, transaction_type_code VARCHAR(10), date_of_transact...
Plot how many date of transaction over date of transaction in a line chart, and list X-axis from high to low order.
SELECT date_of_transaction, COUNT(date_of_transaction) FROM Transactions ORDER BY date_of_transaction DESC
nvbench
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 ) ...
how many patients are primary diagnosed for st elevated myocardial infarction or cardiac cath and have a lab test for blood?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND lab.fluid = "Blood"
mimicsql_data
CREATE TABLE table_30423 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
What is every score when the date is January 2?
SELECT "Score" FROM table_30423 WHERE "Date" = 'January 2'
wikisql
CREATE TABLE table_name_29 ( tournament VARCHAR, runner_s__up VARCHAR )
For what tournament was Bubba Watson the runner-up?
SELECT tournament FROM table_name_29 WHERE runner_s__up = "bubba watson"
sql_create_context
CREATE TABLE table_name_5 ( Id VARCHAR )
Name the 2012 for 2011 being 1r
SELECT 2012 FROM table_name_5 WHERE 2011 = "1r"
sql_create_context
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...
患者凤高翰在10年5月21日到19年8月3日这段时间内,自付比例低于0.48的药品数量是多少
SELECT COUNT(*) FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.PERSON_NM = '凤高翰' AND t_kc22.STA_DATE BETWEEN '2010-05-21' AND '2019-08-03' AND t_kc22.SELF_PAY_PRO < 0.48 UNION SELECT COUNT(*) FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gyb.PERSON_NM = '凤高翰' AND t_k...
css
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 transfers ( row_id number, subject_id number, ...
what was the age of patient 97733 during this hospital encounter?
SELECT admissions.age FROM admissions WHERE admissions.subject_id = 97733 AND admissions.dischtime IS NULL
mimic_iii
CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE ground_service ( ...
what flights are there from NEWARK to CHICAGO on CO
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, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'CHICAGO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'NEWAR...
atis
CREATE TABLE table_21004 ( "Province" text, "Population" real, "Region" text, "Name of City" text, "Districts" real )
What is the region containing the Constitutional Province of Callao?
SELECT "Region" FROM table_21004 WHERE "Province" = 'Constitutional Province of Callao'
wikisql
CREATE TABLE table_38716 ( "Date" text, "Opponent" text, "Result" text, "Score" text, "Record" text, "Streak" text )
What was the record in the win 7 streak?
SELECT "Record" FROM table_38716 WHERE "Streak" = 'win 7'
wikisql
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, ...
what is the one year survival probability for patients who were prescribed nateglinide after having been diagnosed with poison-antipsychotic nec?
SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t4.charttime) > 1 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.subject_id, t2.charttime FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd...
mimic_iii
CREATE TABLE table_14570857_1 ( situation VARCHAR, original_us_airdate VARCHAR )
Which situation has an original u.s. airdate of December 5, 2007?
SELECT situation FROM table_14570857_1 WHERE original_us_airdate = "December 5, 2007"
sql_create_context
CREATE TABLE table_25505246_8 ( outcome VARCHAR, partner VARCHAR )
How did the match end when she played with caroline wozniacki?
SELECT outcome FROM table_25505246_8 WHERE partner = "Caroline Wozniacki"
sql_create_context
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE patient ( uniquepid text, pati...
how many patients got prescriptions for zosyn during a year before?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'zosyn' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year'))
eicu
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 ) ...
count the number of patients whose age is less than 86 and diagnoses long title is wheelchair dependence?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "86" AND diagnoses.long_title = "Wheelchair dependence"
mimicsql_data
CREATE TABLE gwyjzb ( CLINIC_ID text, CLINIC_TYPE 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, ...
自2006.10.1起,止2018.12.20止,自付比例低于0.14的药品一共给患者钱嘉慕开出了多少
SELECT COUNT(*) FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_NM = '钱嘉慕' AND t_kc22.STA_DATE BETWEEN '2006-10-01' AND '2018-12-20' AND t_kc22.SELF_PAY_PRO < 0.14 UNION SELECT COUNT(*) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE fgwyjzb.PERS...
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,...
郎颖初这位参保人从0三年十二月九日到一二年一月十日,门诊开出的西药总共有多少金额
SELECT SUM(t_kc22.AMOUNT) FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_NM = '郎颖初' AND t_kc21.CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2003-12-09' AND '2012-01-10' AND t_kc22.MED_INV_IT...
css
CREATE TABLE table_204_939 ( id number, "year" number, "chassis" text, "engine" text, "start" text, "finish" text )
how many chassis in the 80 's were penske 's ?
SELECT COUNT("chassis") FROM table_204_939 WHERE "chassis" = 'penske'
squall
CREATE TABLE table_42179 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
Who is the opponent of the game played on November 20, 1995?
SELECT "Opponent" FROM table_42179 WHERE "Date" = 'november 20, 1995'
wikisql
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number...
what are the five most commonly prescribed medications for patients that have been previously prescribed neomycin-polymyxin-bacitracin during the same hospital encounter, until 4 years ago?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate, admissions.hadm_id FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'neomycin-polymyxin-bacitracin' AND DATETIME(p...
mimic_iii
CREATE TABLE customers ( customer_type_code VARCHAR )
How many customers are there in the customer type with the most customers?
SELECT COUNT(*) FROM customers GROUP BY customer_type_code ORDER BY COUNT(*) DESC LIMIT 1
sql_create_context
CREATE TABLE voting_record ( stuid number, registration_date text, election_cycle text, president_vote number, vice_president_vote number, secretary_vote number, treasurer_vote number, class_president_vote number, class_senator_vote number ) CREATE TABLE student ( stuid number, ...
What are the distinct registration dates and the election cycles?
SELECT DISTINCT registration_date, election_cycle FROM voting_record
spider
CREATE TABLE time_slot ( time_slot_id varchar(4), day varchar(1), start_hr numeric(2), start_min numeric(2), end_hr numeric(2), end_min numeric(2) ) CREATE TABLE classroom ( building varchar(15), room_number varchar(7), capacity numeric(4,0) ) CREATE TABLE takes ( ID varchar(5)...
How many courses are in the Psychology department for each year? Return a line chart, and display X-axis in desc order.
SELECT year, COUNT(year) FROM course AS T1 JOIN section AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY year DESC
nvbench
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 days of hospital stay and lab test name of subject id 32418?
SELECT demographic.days_stay, lab.label FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.subject_id = "32418"
mimicsql_data
CREATE TABLE table_52678 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Series" text )
Which game has a high rebound of Evans (7) and a high assist of Evans, Ollie (3)?
SELECT MAX("Game") FROM table_52678 WHERE "High rebounds" = 'evans (7)' AND "High assists" = 'evans, ollie (3)'
wikisql