context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
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...
患者15176126为精神分裂症,门诊诊断的补体C4的结果定量及其单位都是什么?
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM...
css
CREATE TABLE table_49297 ( "Trident" text, "Gecko" text, "WebKit" text, "KHTML" text, "Presto" text, "Prince XML" text )
What is the Prince XML value for the engine that has a Gecko value of 'no' and webkit value of 'nightly build'?
SELECT "Prince XML" FROM table_49297 WHERE "Gecko" = 'no' AND "WebKit" = 'nightly build'
wikisql
CREATE TABLE table_name_53 ( gold VARCHAR, sport VARCHAR, bronze VARCHAR )
When tennis has less than 2 bronze, what is the total number of Gold?
SELECT COUNT(gold) FROM table_name_53 WHERE sport = "tennis" AND bronze < 2
sql_create_context
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...
列出在编码为9397980医院中35864254患者就诊科室名称不包含激光的所有门诊就诊记录的流水号都是多少?
SELECT mzjzjlb.JZLSH FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE hz_info.RYBH = '35864254' AND hz_info.YLJGDM = '9397980' AND NOT mzjzjlb.JZKSMC LIKE '%激光%'
css
CREATE TABLE table_name_77 ( city VARCHAR, country VARCHAR )
What is the City in the Maldives?
SELECT city FROM table_name_77 WHERE country = "maldives"
sql_create_context
CREATE TABLE table_44689 ( "Tournament" text, "Surface" text, "Week" text, "Winner and score" text, "Finalist" text, "Semifinalists" text )
Who was the finalist in the Monte Carlo Tournament?
SELECT "Finalist" FROM table_44689 WHERE "Tournament" = 'monte carlo'
wikisql
CREATE TABLE table_22670216_1 ( location VARCHAR, winning_driver VARCHAR )
What is the location is the winning driver is Bill Vukovich II?
SELECT location FROM table_22670216_1 WHERE winning_driver = "Bill Vukovich II"
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, ...
患者俞安安为疾病V29.354,门诊诊断的神经元特异性烯醇化酶的结果定量是什么?单位是什么?
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN jybgb_jyjgzbb ON person_info.RYBH = hz_info.RYBH AND 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 = j...
css
CREATE TABLE table_1341453_15 ( candidates VARCHAR, incumbent VARCHAR )
Who were the candidates in the district where Jerry Costello won?
SELECT candidates FROM table_1341453_15 WHERE incumbent = "Jerry Costello"
sql_create_context
CREATE TABLE table_2208 ( "ILO code" text, "Field" text, "conclusion date" text, "entry into force" text, "closure for signature" text, "Parties (April 2011)" real, "Denunciations (September 2011)" real, "revising convention(s)" text, "text and ratifications" text )
How many ILO codes are there with revising conventions of 'this convention, work in fishing convention'?
SELECT COUNT("ILO code") FROM table_2208 WHERE "revising convention(s)" = 'this convention, Work in Fishing Convention'
wikisql
CREATE TABLE table_34811 ( "Year of Issue" real, "Description" text, "Weight" text, "Diameter" text, "Thickness" text, "Edge" text )
Which Thickness has a Diameter of 21.9mm?
SELECT "Thickness" FROM table_34811 WHERE "Diameter" = '21.9mm'
wikisql
CREATE TABLE table_22876 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Partner" text, "Opponents in the final" text, "Score in the final" text )
which championship had arantxa s nchez vicario todd woodbridge as opponents in the final
SELECT "Championship" FROM table_22876 WHERE "Opponents in the final" = 'Arantxa Sánchez Vicario Todd Woodbridge'
wikisql
CREATE TABLE table_name_92 ( winners VARCHAR, season VARCHAR )
Who is the winner in 2010?
SELECT winners FROM table_name_92 WHERE season = 2010
sql_create_context
CREATE TABLE table_22871239_8 ( high_assists VARCHAR, location_attendance VARCHAR )
Name the high assists for american airlines center 19,585
SELECT high_assists FROM table_22871239_8 WHERE location_attendance = "American Airlines Center 19,585"
sql_create_context
CREATE TABLE table_73202 ( "No." real, "#" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real, "Television order" text )
what is the original air date of the episode directed by Ben Jones and written by Steven Melching?
SELECT "Original air date" FROM table_73202 WHERE "Directed by" = 'Ben Jones' AND "Written by" = 'Steven Melching'
wikisql
CREATE TABLE table_63059 ( "Lane" real, "Name" text, "Nationality" text, "Reaction Time" real, "Result" real )
What is the highest result for Wallace Spearmon when the reaction time is greater than 0.167?
SELECT MAX("Result") FROM table_63059 WHERE "Name" = 'wallace spearmon' AND "Reaction Time" > '0.167'
wikisql
CREATE TABLE table_1661124_1 ( target VARCHAR, approval_date VARCHAR )
What is the target with an approval date of 2006?
SELECT target FROM table_1661124_1 WHERE approval_date = 2006
sql_create_context
CREATE TABLE table_879 ( "Position" real, "Artist" text, "Song title" text, "Highest position" real, "Points" real )
what's the position with artbeingt being jim reeves
SELECT "Position" FROM table_879 WHERE "Artist" = 'Jim Reeves'
wikisql
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 county ( County_Id int, County_name text, Population real, Zip_code text ) CREATE TABLE election ( ...
For each county, find the name of the county and the number of delegates from that county. Show bar chart.
SELECT County_name, COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_Id = T2.District GROUP BY T1.County_Id
nvbench
CREATE TABLE table_66898 ( "Year" text, "Superintendent" text, "Glendale Principal" text, "H.H. Principal" text, "Maplemere Principal" text, "W.R. Principal" text, "M.S. Principal" text, "H.S. Principal" text, "H. S. Asst. Principal" text )
Who is the h.h. principal with James Finch as the superintendent and Charlie Taylor as the maplemere principal?
SELECT "H.H. Principal" FROM table_66898 WHERE "Superintendent" = 'james finch' AND "Maplemere Principal" = 'charlie taylor'
wikisql
CREATE TABLE table_name_89 ( mpg_uk_combined VARCHAR, engine_capacity VARCHAR, fuel_type VARCHAR, mpg_uk_urban__cold_ VARCHAR, transmission VARCHAR )
What is the mpg-uk combined with an mpg-uk urban (cold) greater than 26.6, a m5 transmission, a diesel fuel type, and an engine capacity less than 1560?
SELECT mpg_uk_combined FROM table_name_89 WHERE mpg_uk_urban__cold_ > 26.6 AND transmission = "m5" AND fuel_type = "diesel" AND engine_capacity < 1560
sql_create_context
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, fligh...
show me all flights from MONTREAL to NASHVILLE
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 = 'MONTREAL' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'NASHV...
atis
CREATE TABLE Customers ( customer_id INTEGER, customer_address_id INTEGER, customer_status_code VARCHAR(15), date_became_customer DATETIME, date_of_birth DATETIME, first_name VARCHAR(80), last_name VARCHAR(80), amount_outstanding DOUBLE, email_address VARCHAR(250), phone_number V...
Show the total number from each payment method code, and I want to show y-axis in ascending order.
SELECT payment_method_code, COUNT(*) FROM Customer_Payments GROUP BY payment_method_code ORDER BY COUNT(*)
nvbench
CREATE TABLE table_15017 ( "Country" text, "Film title used in nomination" text, "Language" text, "Original name" text, "Director" text )
Which film originated in France?
SELECT "Original name" FROM table_15017 WHERE "Country" = 'france'
wikisql
CREATE TABLE zyb ( 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...
患有躁狂抑郁性精神病当前为抑郁相的患者被开出的药品的编号是什么?名称是什么?
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.IN_DIAG_DIS_NM = '躁狂抑郁性精神病当前为抑郁相' UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gyb.IN_DIAG_DIS_NM = '躁狂抑郁...
css
CREATE TABLE table_77076 ( "Player" text, "Nationality" text, "Jersey Number(s)" real, "Position" text, "Years" text, "From" text )
Who was the player that was from west virginia tech?
SELECT "Player" FROM table_77076 WHERE "From" = 'west virginia tech'
wikisql
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), ...
For those employees who did not have any job in the past, show me about the distribution of hire_date and the average of employee_id bin hire_date by time in a bar chart.
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
nvbench
CREATE TABLE table_204_186 ( id number, "season" text, "tier" number, "division" text, "place" text )
how many times did they finish 1st ?
SELECT COUNT(*) FROM table_204_186 WHERE "place" = '1st'
squall
CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varcha...
What are the number of the first names of all employees that are professors ordered by date of birth?
SELECT EMP_FNAME, COUNT(EMP_FNAME) FROM EMPLOYEE WHERE EMP_JOBCODE = 'PROF' GROUP BY EMP_FNAME ORDER BY EMP_DOB
nvbench
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid...
how many hours have elapsed since the first time that patient 55360 stayed on this hospital visit in careunit ccu?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 55360 AND admissions.dischtime IS NULL) AND transfers.careunit = 'ccu' ORDER BY transfers.intime LIMIT 1
mimic_iii
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 ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
how many office admission patients are less than 50 years of age?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND demographic.age < "50"
mimicsql_data
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( ...
how many patients below 55 years of age shows abnormal status in lab testing?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "55" AND lab.flag = "abnormal"
mimicsql_data
CREATE TABLE table_name_22 ( population_1961 INTEGER, administrative_county VARCHAR, population_1891 VARCHAR )
What is the Population 1961 of West Sussex with a Population of 120,952 or less?
SELECT SUM(population_1961) FROM table_name_22 WHERE administrative_county = "west sussex" AND population_1891 < 120 OFFSET 952
sql_create_context
CREATE TABLE table_8779 ( "Tournament" text, "1987" text, "1988" text, "1989" text, "1990" text, "1991" text, "1992" text, "1993" text, "1994" text, "Career SR" text )
With a 1992 result of A, and at the U.S. Open Tournament, what is the 1989 result?
SELECT "1989" FROM table_8779 WHERE "1992" = 'a' AND "Tournament" = 'u.s. open'
wikisql
CREATE TABLE table_name_22 ( time VARCHAR, opponent VARCHAR )
What was the time for the event in which Tony Mendoza was the opponent?
SELECT time FROM table_name_22 WHERE opponent = "tony mendoza"
sql_create_context
CREATE TABLE table_60203 ( "Benalla DFL" text, "Wins" real, "Losses" real, "Draws" real, "Byes" real, "Against" real )
What is the average value for Draws, when Against is '2177', and when Byes is less than 4?
SELECT AVG("Draws") FROM table_60203 WHERE "Against" = '2177' AND "Byes" < '4'
wikisql
CREATE TABLE table_11137 ( "model" text, "max. motive power" text, "max. torque at rpm" text, "engine displacement" text, "engine type" text, "engine configuration & notes 0-100km/h" text )
What is the model with a engine type with b5244 s2?
SELECT "model" FROM table_11137 WHERE "engine type" = 'b5244 s2'
wikisql
CREATE TABLE table_name_71 ( loss VARCHAR, record VARCHAR )
What was the loss when the record was 46-59?
SELECT loss FROM table_name_71 WHERE record = "46-59"
sql_create_context
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, Sug...
Top Iranian users in StackOverFlow.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%iran%' OR UPPER(Location) LIKE '%IRAN%' ORDER BY Reputation DESC
sede
CREATE TABLE table_59718 ( "Country" text, "Date" text, "Label" text, "Format" text, "Catalog" text )
What country has CD format and catalog RCD 10523?
SELECT "Country" FROM table_59718 WHERE "Format" = 'cd' AND "Catalog" = 'rcd 10523'
wikisql
CREATE TABLE order_items ( order_item_id number, order_id number, product_id number, product_quantity text, other_order_item_details text ) CREATE TABLE orders ( order_id number, customer_id number, date_order_placed time, order_details text ) CREATE TABLE customers ( customer_...
Show the account id and name with at least 4 transactions.
SELECT T1.account_id, T2.account_name FROM financial_transactions AS T1 JOIN accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id HAVING COUNT(*) >= 4
spider
CREATE TABLE table_name_81 ( athlete VARCHAR, nationality VARCHAR )
Which athlete from Brazil has 2.20 O and 2.25 of XXX?
SELECT athlete FROM table_name_81 WHERE 220 = "o" AND 225 = "xxx" AND nationality = "brazil"
sql_create_context
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...
医疗机构1035926在二零一八年四月十四号到十月二十二号期间保险类型为儿童的就医记录数量
SELECT COUNT(*) FROM t_kc21 WHERE MED_SER_ORG_NO = '1035926' AND IN_HOSP_DATE BETWEEN '2018-04-14' AND '2018-10-22' AND INSU_TYPE = '儿童'
css
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, Crea...
Unanswered questions on which a bounty was once set.
SELECT p.Id AS "post_link", p.Score, p.OwnerUserId AS "user_link", p.Tags FROM Posts AS p INNER JOIN Votes AS v ON p.Id = v.PostId WHERE v.VoteTypeId = 8 ORDER BY p.CreationDate
sede
CREATE TABLE table_name_50 ( crowd INTEGER, venue VARCHAR )
What was the highest crowd size at Windy Hill?
SELECT MAX(crowd) FROM table_name_50 WHERE venue = "windy hill"
sql_create_context
CREATE TABLE table_27793 ( "Municipality" text, "No. of Barangays" real, "Area (hectares)" real, "Population (2007)" real, "Population (2010)" real, "Pop. density (per km 2 )" text )
What is the 2007 population of Gigmoto?
SELECT COUNT("Population (2007)") FROM table_27793 WHERE "Municipality" = 'Gigmoto'
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...
count the number of patients whose admission location is emergency room admit and drug name is benztropine mesylate?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND prescriptions.drug = "Benztropine Mesylate"
mimicsql_data
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE food_service ( meal_code text, meal_number int, ...
show me all DL flights from MONTREAL to ORLANDO
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 = 'ORLANDO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MONTR...
atis
CREATE TABLE table_8978 ( "Game" real, "December" real, "Opponent" text, "Score" text, "Record" text )
Who was the opponent on December 1, before Game 28?
SELECT "Opponent" FROM table_8978 WHERE "Game" < '28' AND "December" = '1'
wikisql
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE employees ( EMPLOYE...
Bar chart of department_id from each first name
SELECT FIRST_NAME, DEPARTMENT_ID FROM employees
nvbench
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 varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), ...
For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of phone_number and department_id .
SELECT PHONE_NUMBER, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
nvbench
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate n...
what were the five most frequently prescribed drugs for patients aged 50s since 2100?
SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 50 AND 59) AND STRFTIME('%y', medication.drugstarttime) >= '2100' GROUP BY medication.drugn...
eicu
CREATE TABLE GRAPES ( Grape VARCHAR, Color VARCHAR ) CREATE TABLE WINE ( Grape VARCHAR, score VARCHAR )
Find the the grape whose white color grapes are used to produce wines with scores higher than 90.
SELECT DISTINCT T1.Grape FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = "White" AND T2.score > 90
sql_create_context
CREATE TABLE repair ( repair_id number, name text, launch_date text, notes text ) CREATE TABLE machine ( machine_id number, making_year number, class text, team text, machine_series text, value_points number, quality_rank number ) CREATE TABLE technician ( technician_id...
What are the team and starting year of technicians?
SELECT team, starting_year FROM technician
spider
CREATE TABLE table_80353 ( "Year" text, "Start" text, "Qual" text, "Rank" text, "Finish" text, "Laps" real )
What year did the rank of 31 happen in?
SELECT "Year" FROM table_80353 WHERE "Rank" = '31'
wikisql
CREATE TABLE table_name_28 ( socialist_labor_ticket VARCHAR, democratic_ticket VARCHAR )
Who ran under the Socialist Labor ticket when Robert M. Morgenthau ran for the Democratic ticket?
SELECT socialist_labor_ticket FROM table_name_28 WHERE democratic_ticket = "robert m. morgenthau"
sql_create_context
CREATE TABLE table_name_29 ( share INTEGER, viewers__m_ VARCHAR, timeslot VARCHAR )
What's the average of shows that had a timeslot rank greater that 3 but still had a smaller viewership less than 4.87?
SELECT AVG(share) FROM table_name_29 WHERE RANK(timeslot) > 3 AND viewers__m_ < 4.87
sql_create_context
CREATE TABLE jybgb ( YLJGDM text, YLJGDM_MZJZJLB text, YLJGDM_ZYJZJLB text, BGDH text, BGRQ time, JYLX number, JZLSH text, JZLSH_MZJZJLB text, JZLSH_ZYJZJLB text, JZLX number, KSBM text, KSMC text, SQRGH text, SQRXM text, BGRGH text, BGRXM text, SHRGH ...
患有疾病V27.340的人在被门诊确诊时其检测指标043045的参考值范围下限和上限都是多些?
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM mzjzjlb JOIN jybgb JOIN jyjgzbb ON mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE mzjzjlb.JZZDBM = 'V27.340' AND jyjgzbb.JCZBDM = '043045'
css
CREATE TABLE table_train_223 ( "id" int, "anemia" bool, "diabetic" string, "eye_disease" bool, "hgb" int, "retinal_pigmentation_abnormalities" bool, "glucose_6_phosphate_dehydrogenase_deficiency_g6pd" int, "age" float, "NOUSE" float )
12 to 40 years old
SELECT * FROM table_train_223 WHERE age >= 12 AND age <= 40
criteria2sql
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_c...
what were the three most frequently prescribed medications for patients who have previously been diagnosed with hypothyroidism nos within 2 months until 2100?
SELECT t3.drug FROM (SELECT t2.drug, 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.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ...
mimic_iii
CREATE TABLE table_name_86 ( attendance VARCHAR, date VARCHAR )
What was the attendance on May 26?
SELECT attendance FROM table_name_86 WHERE date = "may 26"
sql_create_context
CREATE TABLE table_24807 ( "Season" real, "Round" real, "Opponents" text, "Home Leg" text, "Away Leg" text, "Aggregate" text )
What was the home leg score against fc schalke 04?
SELECT "Home Leg" FROM table_24807 WHERE "Opponents" = 'FC Schalke 04'
wikisql
CREATE TABLE table_10262329_1 ( temp__ VARCHAR, adhesive_type VARCHAR )
HOW MANY TEMPERATURE INTERVALS ARE POSSIBLE TO USE WITH ACRYL?
SELECT COUNT(temp__) AS °c_ FROM table_10262329_1 WHERE adhesive_type = "Acryl"
sql_create_context
CREATE TABLE journalist ( Years_working INTEGER )
What is the average number of years spent working as a journalist?
SELECT AVG(Years_working) FROM journalist
sql_create_context
CREATE TABLE table_name_91 ( heat INTEGER, country VARCHAR, react VARCHAR )
what is the heat when the country is united kingdom and react is less than 0.232?
SELECT MAX(heat) FROM table_name_91 WHERE country = "united kingdom" AND react < 0.232
sql_create_context
CREATE TABLE table_4434 ( "Pick #" real, "MLS team" text, "Player" text, "Position" text, "Affiliation" text )
Tell me the total number of pick for university of portland
SELECT COUNT("Pick #") FROM table_4434 WHERE "Affiliation" = 'university of portland'
wikisql
CREATE TABLE university ( affiliation VARCHAR, enrollment INTEGER )
Find the number of universities that have over a 20000 enrollment size for each affiliation type.
SELECT COUNT(*), affiliation FROM university WHERE enrollment > 20000 GROUP BY affiliation
sql_create_context
CREATE TABLE customer_contact_channels ( customer_id number, channel_code text, active_from_date time, active_to_date time, contact_number text ) CREATE TABLE addresses ( address_id number, address_content text, city text, zip_postcode text, state_province_county text, count...
Which city is post code 255 located in?
SELECT city FROM addresses WHERE zip_postcode = 255
spider
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
is patient 96833's white blood cells last measured on the current hospital visit less compared to the value second to last measured on the current hospital visit?
SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 96833 AND admissions.dischtime IS NULL) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'white blood cells') ORDER BY labevents....
mimic_iii
CREATE TABLE table_25484 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
What date was the record 11-67?
SELECT "Date" FROM table_25484 WHERE "Record" = '11-67'
wikisql
CREATE TABLE table_54582 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Attendance" real, "Record" text )
Who was the visiting team when the Suns were the home team?
SELECT "Visitor" FROM table_54582 WHERE "Home" = 'suns'
wikisql
CREATE TABLE table_36433 ( "Season" text, "Race" real, "Podium" real, "Pole" real, "FLap" real )
Flap of 0, and a Race smaller than 2, and a Season of 1989, and a Pole smaller than 0 had what average podium?
SELECT AVG("Podium") FROM table_36433 WHERE "FLap" = '0' AND "Race" < '2' AND "Season" = '1989' AND "Pole" < '0'
wikisql
CREATE TABLE table_name_44 ( place INTEGER, time VARCHAR, points VARCHAR, machine VARCHAR )
Which place has points larger than 1, a bmw machine, and a time of 1:18.47.6?
SELECT MIN(place) FROM table_name_44 WHERE points > 1 AND machine = "bmw" AND time = "1:18.47.6"
sql_create_context
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...
病人在门诊被诊断为躁狂型精神病时,其检测指标503506数值的平均值是多少,最值是多少
SELECT AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE zzmzjzjlb.JZZDSM = '躁狂型精神病' AND jyjgzbb.JCZBDM = '5...
css
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE lab ( labid number, pa...
have any microbiological tests been done for patient 031-1337 since 2 years ago?
SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-1337')) AND DATETIME(microlab.culturetakentime) >= DATETIME(CURRENT_TIME()...
eicu
CREATE TABLE jybgb ( YLJGDM text, YLJGDM_MZJZJLB text, YLJGDM_ZYJZJLB text, BGDH text, BGRQ time, JYLX number, JZLSH text, JZLSH_MZJZJLB text, JZLSH_ZYJZJLB text, JZLX number, KSBM text, KSMC text, SQRGH text, SQRXM text, BGRGH text, BGRXM text, SHRGH ...
自2008年08月18起,到2020年08月18日,褚丽姿这个病人在医疗机构3680245看过几次门诊
SELECT COUNT(*) FROM person_info JOIN hz_info JOIN mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE person_info.XM = '褚丽姿' AND mzjzjlb.JZKSRQ BETWEEN '2008-08-18' AND '2020-08-18' AND mzjzjlb.YLJGDM = '3680245'
css
CREATE TABLE table_26604 ( "Week" real, "Date" text, "Opponent" text, "Location" text, "Final Score" text, "Attendance" real, "Record" text )
Name the opponent for week 12
SELECT "Opponent" FROM table_26604 WHERE "Week" = '12'
wikisql
CREATE TABLE club ( clubid number, clubname text, clubdesc text, clublocation text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE member_of_club ( stuid number, clu...
What is the location of the club named 'Tennis Club'?
SELECT clublocation FROM club WHERE clubname = "Tennis Club"
spider
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, ...
在2017年6月21日到2020年11月13日内编号是7538137的医院有哪些是介入治疗的科室不是负责人的医疗就诊记录?
SELECT * FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '7538137' AND gwyjzb.IN_HOSP_DATE BETWEEN '2017-06-01' AND '2020-11-13' UNION SELECT * FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '7538137' AND fgwyjzb.IN_HOSP_DATE BETWEEN '2017-06-01' AND '2020-11-13' EXCEPT SELECT * FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '753813...
css
CREATE TABLE table_16553 ( "#" real, "Episode" text, "Air Date" text, "Timeslot" text, "Viewers" text, "Weekly Rank for Living" text )
The episode 'chapter five: dressed to kill' had a weekly ranking of what?
SELECT "Weekly Rank for Living" FROM table_16553 WHERE "Episode" = 'Chapter Five: Dressed to Kill'
wikisql
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
Get all answers by a deleted user, together with questions.
SELECT a.CreationDate, a.Id, b.Id AS "post_link", b.Title, b.Body AS Question, a.Body, a.Score AS Answer FROM Posts AS a INNER JOIN Posts AS b ON a.ParentId = b.Id WHERE a.OwnerDisplayName = '##Name:string##' ORDER BY a.CreationDate
sede
CREATE TABLE book ( Book_ID int, Title text, Issues real, Writer text ) CREATE TABLE publication ( Publication_ID int, Book_ID int, Publisher text, Publication_Date text, Price real )
A bar chart for listing the number of the writers of the books in ascending alphabetical order.
SELECT Writer, COUNT(Writer) FROM book GROUP BY Writer ORDER BY Writer
nvbench
CREATE TABLE Participants_in_Events ( Event_ID INTEGER, Participant_ID INTEGER ) CREATE TABLE Participants ( Participant_ID INTEGER, Participant_Type_Code CHAR(15), Participant_Details VARCHAR(255) ) CREATE TABLE Events ( Event_ID INTEGER, Service_ID INTEGER, Event_Details VARCHAR(255)...
For events that have more than one participant, count the event details for a bar chart.
SELECT Event_Details, COUNT(Event_Details) FROM Events AS T1 JOIN Participants_in_Events AS T2 ON T1.Event_ID = T2.Event_ID GROUP BY Event_Details
nvbench
CREATE TABLE table_75519 ( "Rank" real, "# of Titles" real, "School" text, "City" text, "Sport" text, "First" real, "Last" real )
What is the total rank number for Los Alamos' girls cross country?
SELECT COUNT("Rank") FROM table_75519 WHERE "School" = 'los alamos' AND "Sport" = 'girls cross country'
wikisql
CREATE TABLE table_name_8 ( year INTEGER, score_qualifying VARCHAR, rank_final VARCHAR, apparatus VARCHAR )
Name the Year with a Rank-Final smaller than 2, an Apparatus of team, and a Score-Qualifying smaller than 248.275?
SELECT AVG(year) FROM table_name_8 WHERE rank_final < 2 AND apparatus = "team" AND score_qualifying < 248.275
sql_create_context
CREATE TABLE table_26375386_23 ( judges VARCHAR, result VARCHAR )
How many judges were there for the eliminated couple?
SELECT judges FROM table_26375386_23 WHERE result = "Eliminated"
sql_create_context
CREATE TABLE table_name_29 ( team VARCHAR, school VARCHAR )
What is the name of the School of the Sussex Tech's Team?
SELECT team FROM table_name_29 WHERE school = "sussex tech"
sql_create_context
CREATE TABLE table_name_73 ( date VARCHAR, opponent VARCHAR, score VARCHAR )
What is the date of the match against John McEnroe with a Score of 3 6, 6 3, 2 6?
SELECT date FROM table_name_73 WHERE opponent = "john mcenroe" AND score = "3–6, 6–3, 2–6"
sql_create_context
CREATE TABLE table_name_57 ( season VARCHAR, position VARCHAR, poles VARCHAR, series VARCHAR )
In which season did he have 0 Poles and 19th position in the GP2 Series?
SELECT season FROM table_name_57 WHERE poles = "0" AND series = "gp2 series" AND position = "19th"
sql_create_context
CREATE TABLE table_204_453 ( id number, "#" number, "date" text, "venue" text, "opponents" text, "score" text, "comp" text, "denmark scorers" text )
when was the last time the team went 0-6 ?
SELECT "date" FROM table_204_453 WHERE "score" = '0-6' ORDER BY "date" DESC LIMIT 1
squall
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,...
what was the name of the lab test that patient 027-120575 last got this month.
SELECT lab.labname FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-120575')) AND DATETIME(lab.labresulttime, 'start of month') = DATETIME(CURRENT_TIME()...
eicu
CREATE TABLE table_name_25 ( series_premiere VARCHAR, tv_network_s_ VARCHAR )
Which series premiered on Acasa TV?
SELECT series_premiere FROM table_name_25 WHERE tv_network_s_ = "acasa tv"
sql_create_context
CREATE TABLE table_name_69 ( money_spent VARCHAR, _2q VARCHAR, total_receipts VARCHAR )
How much money was spent in 2Q when the total receipts were $1,117,566?
SELECT money_spent, _2q FROM table_name_69 WHERE total_receipts = "$1,117,566"
sql_create_context
CREATE TABLE table_17327458_1 ( manner_of_departure VARCHAR, date_of_vacancy VARCHAR )
How many vacancies happened on 25 May?
SELECT COUNT(manner_of_departure) FROM table_17327458_1 WHERE date_of_vacancy = "25 May"
sql_create_context
CREATE TABLE mission ( mission_id number, ship_id number, code text, launched_year number, location text, speed_knots number, fate text ) CREATE TABLE ship ( ship_id number, name text, type text, nationality text, tonnage number )
Please show the most common type of ships.
SELECT type FROM ship GROUP BY type ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE table_name_8 ( opponent_in_the_final VARCHAR, outcome VARCHAR, venue VARCHAR )
Who was the Opponent in London, England with an Outcome of 1?
SELECT opponent_in_the_final FROM table_name_8 WHERE outcome = "1" AND venue = "london, england"
sql_create_context
CREATE TABLE table_21824695_8 ( team VARCHAR, match_played VARCHAR )
Which team has a match played of 10 4?
SELECT team FROM table_21824695_8 WHERE match_played = "10 4"
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...
自二零零零年五月六日到二零一七年四月十日,医院4499382记录的购药数量合计有多少
SELECT COUNT(*) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '4499382' AND gwyjzb.IN_HOSP_DATE BETWEEN '2000-05-06' AND '2017-04-10' AND gwyjzb.CLINIC_TYPE = '购药' UNION SELECT COUNT(*) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '4499382' AND fgwyjzb.IN_HOSP_DATE BETWEEN '2000-05-06' AND '2017-04-10' AND fgwyjzb.CLINIC_TY...
css
CREATE TABLE table_66800 ( "January" text, "February" text, "March" text, "April" text, "June" text, "July" text, "August" text, "September" text, "October" text, "November" text, "December" text )
Who is in November where October is jill de vries?
SELECT "November" FROM table_66800 WHERE "October" = 'jill de vries'
wikisql
CREATE TABLE table_6241 ( "Year" real, "Manufacturer" text, "Start" text, "Finish" text, "Team" text )
Which Team has a Year of 2000?
SELECT "Team" FROM table_6241 WHERE "Year" = '2000'
wikisql