context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_44357 ( "Tournament" text, "1992" text, "1993" text, "1994" text, "1995" text, "1996" text, "1997" text, "1998" text, "1999" text, "2000" text, "2001" text, "2002" text, "2003" text, "Career SR" text, "Career win-loss" text )
What is 2001, when 1996 is '0 / 2'?
SELECT "2001" FROM table_44357 WHERE "1996" = '0 / 2'
wikisql
CREATE TABLE entrepreneur ( entrepreneur_id number, people_id number, company text, money_requested number, investor text ) CREATE TABLE people ( people_id number, name text, height number, weight number, date_of_birth text )
What is the name of the entrepreneur with the greatest weight?
SELECT T2.name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id ORDER BY T2.weight DESC LIMIT 1
spider
CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_ca...
A bar chart about how many students are older than average for each gender?
SELECT Sex, COUNT(*) FROM Student WHERE Age > (SELECT AVG(Age) FROM Student) GROUP BY Sex
nvbench
CREATE TABLE table_41607 ( "Driver" text, "Team" text, "Laps" real, "Time/Retired" text, "Grid" real )
What time or retired does Scott Dixon have?
SELECT "Time/Retired" FROM table_41607 WHERE "Driver" = 'scott dixon'
wikisql
CREATE TABLE table_8849 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Time" text )
When was the opponent Bye?
SELECT "Date" FROM table_8849 WHERE "Opponent" = 'bye'
wikisql
CREATE TABLE table_name_35 ( occupation VARCHAR, candidate VARCHAR )
What occupation does Mary Louise Lorefice have?
SELECT occupation FROM table_name_35 WHERE candidate = "mary louise lorefice"
sql_create_context
CREATE TABLE table_name_15 ( attendance INTEGER, game INTEGER )
Tell me the most attendance for game less than 1
SELECT MAX(attendance) FROM table_name_15 WHERE game < 1
sql_create_context
CREATE TABLE Timed_Locations_of_Things ( thing_id INTEGER, Date_and_Time DATETIME, Location_Code CHAR(15) ) CREATE TABLE Properties ( property_id INTEGER, property_type_code CHAR(15), property_address VARCHAR(255), other_details VARCHAR(255) ) CREATE TABLE Organizations ( organization_...
Bar graph to show the number of customer details from different customer details, and list Y from high to low order.
SELECT customer_details, COUNT(customer_details) FROM Customers GROUP BY customer_details ORDER BY COUNT(customer_details) DESC
nvbench
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TA...
among patients that were prescribed with midazolam hcl 2 mg/2ml inj soln (range) prn, what are the three most frequently prescribed drugs at the same time, in 2103.
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'midazolam hcl 2 mg/2ml inj soln (range) prn' AND ST...
eicu
CREATE TABLE table_58315 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
When did the away team score 12.14 (86)?
SELECT "Date" FROM table_58315 WHERE "Away team score" = '12.14 (86)'
wikisql
CREATE TABLE table_name_6 ( year INTEGER, accolade VARCHAR, rank VARCHAR )
How many years have an accolade of 50 best albums of the year, with #3 as the rank?
SELECT SUM(year) FROM table_name_6 WHERE accolade = "50 best albums of the year" AND rank = "#3"
sql_create_context
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsysto...
what was the top three most common procedures that followed during the same hospital encounter for patients who were given head ct scan - without contrast the last year?
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'head ...
eicu
CREATE TABLE table_75722 ( "1890s" text, "1890\u201391" text, "1891\u201392" text, "1892\u201393" text, "1893\u201394" text )
What is the year from 1892-93 that has the 1890s to the 1940s?
SELECT "1892\u201393" FROM table_75722 WHERE "1890s" = '1940s'
wikisql
CREATE TABLE table_70819 ( "Club" text, "Played" text, "Drawn" text, "Lost" text, "Try BP" text, "Losing BP" text )
Name the Losing BP with drawn of 1 and a Try BP of 6.
SELECT "Losing BP" FROM table_70819 WHERE "Drawn" = '1' AND "Try BP" = '6'
wikisql
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 prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time...
in 2102 what were the top five most common specimen tests?
SELECT t1.spec_type_desc FROM (SELECT microbiologyevents.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM microbiologyevents WHERE STRFTIME('%y', microbiologyevents.charttime) = '2102' GROUP BY microbiologyevents.spec_type_desc) AS t1 WHERE t1.c1 <= 5
mimic_iii
CREATE TABLE table_35629 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
How much Total has a Nation of kazakhstan (kaz), and a Gold larger than 0?
SELECT COUNT("Total") FROM table_35629 WHERE "Nation" = 'kazakhstan (kaz)' AND "Gold" > '0'
wikisql
CREATE TABLE table_8738 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Partner" text, "Opponents in final" text, "Score in final" text )
What is Opponents in Final, when Partner is 'Jill Hetherington', and when Year is after 1988?
SELECT "Opponents in final" FROM table_8738 WHERE "Partner" = 'jill hetherington' AND "Year" > '1988'
wikisql
CREATE TABLE cinema ( Cinema_ID int, Name text, Openning_year int, Capacity int, Location text ) CREATE TABLE film ( Film_ID int, Rank_in_series int, Number_in_season int, Title text, Directed_by text, Original_air_date text, Production_code text ) CREATE TABLE schedule...
Tell me the average of capacity of cinemas open for each year in a line chart, sort in asc by the Openning_year.
SELECT Openning_year, AVG(Capacity) FROM cinema ORDER BY Openning_year
nvbench
CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER numeric, DEPT_CODE varchar(18), STU_PHONE varchar(4), PROF_NUM int ) CREATE TABLE CL...
Show me a pie chart for what are the total number of credits offered by each department?
SELECT DEPT_CODE, SUM(T1.CRS_CREDIT) FROM COURSE AS T1 JOIN CLASS AS T2 ON T1.CRS_CODE = T2.CRS_CODE GROUP BY T1.DEPT_CODE
nvbench
CREATE TABLE table_60724 ( "Place" real, "Name" text, "All Around" real, "Hoop" real, "Total" real )
What is the average hoop when the all around is less than 9.7?
SELECT AVG("Hoop") FROM table_60724 WHERE "All Around" < '9.7'
wikisql
CREATE TABLE table_203_790 ( id number, "week" number, "date" text, "opponent" text, "result" text, "attendance" number )
which week saw attendance of at least 70,000 ?
SELECT "date" FROM table_203_790 WHERE "attendance" >= 70000
squall
CREATE TABLE table_52052 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
On what date was Richmond hosted as the away team?
SELECT "Date" FROM table_52052 WHERE "Away team" = 'richmond'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text ) CREATE TABLE person_info_hz_info ( RYBH text, KH number, KLX number, YLJGDM number ) CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, J...
门诊诊断给患者29164002的诊断为前列腺增生,他000470这个检测指标的结果定量及其单位是什么
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW 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.Y...
css
CREATE TABLE table_name_60 ( name VARCHAR, round VARCHAR )
Who is the person from round 8?
SELECT name FROM table_name_60 WHERE round = 8
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 ...
在2002年4月24日到2003年9月8日期间,中医风湿科的住院量是多少
SELECT COUNT(*) FROM zyjzjlb WHERE JZKSMC = '中医风湿免疫病科' AND RYDJSJ BETWEEN '2002-04-24' AND '2003-09-08'
css
CREATE TABLE people ( People_ID int, District text, Name text, Party text, Age int ) CREATE TABLE debate ( Debate_ID int, Date text, Venue text, Num_of_Audience int ) CREATE TABLE debate_people ( Debate_ID int, Affirmative int, Negative int, If_Affirmative_Win bool ...
Show the number of debates for each person on the affirmative side in a pie chart.
SELECT Name, COUNT(Name) FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Affirmative = T3.People_ID GROUP BY Name
nvbench
CREATE TABLE cinema ( Cinema_ID int, Name text, Openning_year int, Capacity int, Location text ) CREATE TABLE film ( Film_ID int, Rank_in_series int, Number_in_season int, Title text, Directed_by text, Original_air_date text, Production_code text ) CREATE TABLE schedule...
Plot the total number by grouped by directed by as a bar graph
SELECT Directed_by, COUNT(*) FROM film GROUP BY Directed_by
nvbench
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,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 ( EMPLOYEE_ID decimal(6,0),...
Return a pie chart on what are the job titles, and range of salaries for jobs with maximum salary between 12000 and 18000?
SELECT JOB_TITLE, MAX_SALARY - MIN_SALARY FROM jobs WHERE MAX_SALARY BETWEEN 12000 AND 18000
nvbench
CREATE TABLE table_name_88 ( res VARCHAR, event VARCHAR )
What was the Result of IFL: Los Angeles?
SELECT res FROM table_name_88 WHERE event = "ifl: los angeles"
sql_create_context
CREATE TABLE hz_info_mzjzjlb ( JZLSH number, YLJGDM number, mzjzjlb_id number ) 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 ...
统计医疗机构5779181处理过多少新生儿门诊,在一四年十二月十一日到一八年四月十八日的这几年里
SELECT COUNT(*) FROM mzjzjlb JOIN hz_info_mzjzjlb JOIN hz_info ON hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.mzjzjlb_id = mzjzjlb.mzjzjlb_id AND hz_info_mzjzjlb.YLJGDM = hz_info.YLJGDM WHERE hz_info.YLJGDM = '57...
css
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
从00年2月1日开始06年5月3日结束患者89244700所有检验结果指标记录中的仪器编号以及名称都是啥吗?
SELECT jyjgzbb.YQBH, jyjgzbb.YQMC FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN 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 = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BG...
css
CREATE TABLE table_name_55 ( name VARCHAR, state VARCHAR )
What is Name, when State is 'Jin'?
SELECT name FROM table_name_55 WHERE state = "jin"
sql_create_context
CREATE TABLE table_name_98 ( date VARCHAR, surface VARCHAR, opponent_in_the_final VARCHAR )
When has a Surface of clay, and an Opponent in the final of andr s g mez javier s nchez?
SELECT date FROM table_name_98 WHERE surface = "clay" AND opponent_in_the_final = "andrés gómez javier sánchez"
sql_create_context
CREATE TABLE table_26901 ( "Items" text, "2008 - Q1" text, "2008-Q2" text, "2008-Q3" text, "extrapol. 08" text, "year 2007" text )
Name the year 2007 for 668 2008-q1
SELECT "year 2007" FROM table_26901 WHERE "2008 - Q1" = '668'
wikisql
CREATE TABLE table_4909 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What home team has a home team score of 15.14 (104)?
SELECT "Home team" FROM table_4909 WHERE "Home team score" = '15.14 (104)'
wikisql
CREATE TABLE table_name_96 ( club VARCHAR, head_coach VARCHAR )
Head Coach of wojciech kami ski is what club?
SELECT club FROM table_name_96 WHERE head_coach = "wojciech kamiński"
sql_create_context
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9cod...
what are the top four most common diagnoses among patients 20s until 1 year ago?
SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 20 AND 29) AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-1 yea...
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
count the number of patients whose year of death is less than or equal to 2112 and drug name is dextrose 50%?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2112.0" AND prescriptions.drug = "Dextrose 50%"
mimicsql_data
CREATE TABLE table_name_42 ( round VARCHAR, opponent VARCHAR )
In which round was Gabriel Veiga the opponent?
SELECT round FROM table_name_42 WHERE opponent = "gabriel veiga"
sql_create_context
CREATE TABLE table_name_79 ( total VARCHAR, score_points VARCHAR, rank_points VARCHAR )
What was the total when the score points was 12 and the rank points was 15?
SELECT total FROM table_name_79 WHERE score_points = "12" AND rank_points = "15"
sql_create_context
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospit...
how long was the first stay of patient 002-38474 in the hospital?
SELECT STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', patient.hospitaladmittime) FROM patient WHERE patient.uniquepid = '002-38474' AND NOT patient.hospitaladmittime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1
eicu
CREATE TABLE table_621 ( "Leg" text, "Stage" text, "Time (EEST)" text, "Name" text, "Length" text, "Winner" text, "Time" text, "Avg. spd." text, "Rally leader" text )
Name the length for stage ss22
SELECT "Length" FROM table_621 WHERE "Stage" = 'SS22'
wikisql
CREATE TABLE table_203_418 ( id number, "#" number, "player" text, "position" text, "height" number, "current club" text )
what is the number of players from the edinburgh kings ?
SELECT COUNT("player") FROM table_203_418 WHERE "current club" = 'edinburgh kings'
squall
CREATE TABLE table_name_77 ( record VARCHAR, score VARCHAR )
Which record has a score of 7 6 (12)?
SELECT record FROM table_name_77 WHERE score = "7–6 (12)"
sql_create_context
CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) 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 varch...
I need an Film and Cinema Studies class that gives 11 credits , which ones do ?
SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%Film and Cinema Studies%' OR name LIKE '%Film and Cinema Studies%') AND credits = 11
advising
CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), EMP_HIREDATE datetime, EMP_DOB datetime ) CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NU...
Bar chart of mean stu gpa from each dept code, order the average of stu gpa from low to high order.
SELECT DEPT_CODE, AVG(STU_GPA) FROM STUDENT GROUP BY DEPT_CODE ORDER BY AVG(STU_GPA)
nvbench
CREATE TABLE table_2208838_2 ( result VARCHAR, runner_up VARCHAR )
What was the final score when River Plate was the runner-up?
SELECT result FROM table_2208838_2 WHERE runner_up = "River Plate"
sql_create_context
CREATE TABLE table_10509 ( "Game" real, "Date" text, "Score" text, "Location" text, "Time" text, "Attendance" real )
What was the attendance on September 11?
SELECT MAX("Attendance") FROM table_10509 WHERE "Date" = 'september 11'
wikisql
CREATE TABLE table_20174050_24 ( company VARCHAR, release_date VARCHAR )
which companies released on 2010-11-04 4 november 2010
SELECT company FROM table_20174050_24 WHERE release_date = "2010-11-04 4 November 2010"
sql_create_context
CREATE TABLE table_1566850_9 ( interview_subject VARCHAR, date VARCHAR )
Who was interviewed in the 8-98 issue?
SELECT interview_subject FROM table_1566850_9 WHERE date = "8-98"
sql_create_context
CREATE TABLE film_text ( film_id SMALLINT, title VARCHAR(255), description TEXT ) CREATE TABLE customer ( customer_id SMALLINT UNSIGNED, store_id TINYINT UNSIGNED, first_name VARCHAR(45), last_name VARCHAR(45), email VARCHAR(50), address_id SMALLINT UNSIGNED, active BOOLEAN, ...
What are the number of the payment dates for any payments that have an amount greater than 10 or were handled by a staff member with the first name Elsa?
SELECT payment_date, COUNT(payment_date) FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa'
nvbench
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) 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 ) ...
what is the number of patients whose primary disease is acidosis and year of death is less than or equal to 2111?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ACIDOSIS" AND demographic.dod_year <= "2111.0"
mimicsql_data
CREATE TABLE table_57912 ( "Race" text, "Circuit" text, "Date" text, "Pole position" text, "Fastest lap" text, "Winning driver" text, "Constructor" text, "Tyre" text, "Report" text )
On which circuit does lorenzo bandini have the fastest lap as well as the pole position?
SELECT "Circuit" FROM table_57912 WHERE "Fastest lap" = 'lorenzo bandini' AND "Pole position" = 'lorenzo bandini'
wikisql
CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) 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...
A bar chart for finding the number of the names of swimmers who has a result of 'win', could you order x axis in descending order?
SELECT name, COUNT(name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID WHERE Result = 'Win' GROUP BY name ORDER BY name DESC
nvbench
CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE airport ( ...
show me flights from SAN FRANCISCO to ATLANTA
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 = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = '...
atis
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 diagnoses icd9 code is 2764 and lab test abnormal status is delta?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "2764" AND lab.flag = "delta"
mimicsql_data
CREATE TABLE screen_mode ( Graphics_mode VARCHAR, used_kb INTEGER ) CREATE TABLE phone ( Hardware_Model_name VARCHAR, Company_name VARCHAR, screen_mode VARCHAR )
List the phone hardware model and company name for the phones whose screen usage in kb is between 10 and 15.
SELECT DISTINCT T2.Hardware_Model_name, T2.Company_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.Graphics_mode = T2.screen_mode WHERE T1.used_kb BETWEEN 10 AND 15
sql_create_context
CREATE TABLE table_16658 ( "Round" real, "Grand Prix" text, "Pole Position" text, "Fastest Lap" text, "Winning Driver" text, "Winning Constructor" text, "Report" text )
Who was on the pole position at the monaco grand prix?
SELECT "Pole Position" FROM table_16658 WHERE "Grand Prix" = 'Monaco Grand Prix'
wikisql
CREATE TABLE person_info ( RYBH text, XBDM number, XBMC text, XM text, CSRQ time, CSD text, MZDM text, MZMC text, GJDM text, GJMC text, JGDM text, JGMC text, XLDM text, XLMC text, ZYLBDM text, ZYMC text ) CREATE TABLE jybgb ( YLJGDM text, YLJGDM_M...
39632855563的检验报告单是由那个机构报告的,报告机构的代码及名称是什么
SELECT BGJGDM, BGJGMC FROM jybgb WHERE BGDH = '39632855563'
css
CREATE TABLE table_67170 ( "Pick #" text, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
What Nationality is Dave Hynes?
SELECT "Nationality" FROM table_67170 WHERE "Player" = 'dave hynes'
wikisql
CREATE TABLE table_21712 ( "Class" text, "Part 1" text, "Part 2" text, "Part 3" text, "Part 4" text, "Verb meaning" text )
What is the meaning of the class 6 verbs?
SELECT "Verb meaning" FROM table_21712 WHERE "Class" = '6'
wikisql
CREATE TABLE table_29170 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Incoming manager" text, "Date of appointment" text )
Who was the outgoing manager for the team of t rgu mure ?
SELECT "Outgoing manager" FROM table_29170 WHERE "Team" = 'Târgu Mureş'
wikisql
CREATE TABLE table_19598014_2 ( circuit VARCHAR, challenge_winning_team VARCHAR )
Name the circuit for #47 orbit racing
SELECT circuit FROM table_19598014_2 WHERE challenge_winning_team = "#47 Orbit Racing"
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
How many of the patients belonging to american indian/alaska native ethnic origin were treated with main drug?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND prescriptions.drug_type = "MAIN"
mimicsql_data
CREATE TABLE table_5563 ( "Series Ep." text, "Episode" real, "Netflix" text, "Segment A" text, "Segment B" text, "Segment C" text, "Segment D" text )
Name the segment D for umbrellas
SELECT "Segment D" FROM table_5563 WHERE "Segment A" = 'umbrellas'
wikisql
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE intakeoutput ( intakeo...
count the number of patients who had undergone anticoagulant administration - conventional heparin therapy two or more times since 2105.
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, COUNT(*) AS c1 FROM patient WHERE patient.patientunitstayid = (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'anticoagulant administration - conventional heparin therapy' AND STRFTIME('%y', treatment.treatmenttime) >...
eicu
CREATE TABLE table_53576 ( "Race" text, "Circuit" text, "Date" text, "Pole position" text, "Fastest lap" text, "Winning driver" text, "Constructor" text, "Tyre" text, "Report" text )
What is the date that Stirling Moss had his fastest lap in a Maserati?
SELECT "Date" FROM table_53576 WHERE "Constructor" = 'maserati' AND "Fastest lap" = 'stirling moss'
wikisql
CREATE TABLE table_32412 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What team was home team when south Melbourne was the away team?
SELECT "Home team" FROM table_32412 WHERE "Away team" = 'south melbourne'
wikisql
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE Tags ( Id number, TagName text, Count number, Ex...
simple score statistics on questions (by user).
SELECT COUNT(*) AS "all", SUM(CASE WHEN a.Score > 0 THEN 1 ELSE 0 END) AS "upvoted", SUM(CASE WHEN a.Score = 0 THEN 1 ELSE 0 END) AS "zero_voted", SUM(CASE WHEN a.Score < 0 THEN 1 ELSE 0 END) AS "downvoted" FROM Posts AS a LEFT JOIN Posts AS q ON q.AcceptedAnswerId = a.Id WHERE a.OwnerUserId = @UserID AND a.PostTypeId ...
sede
CREATE TABLE table_78868 ( "Show" text, "Network (Last Aired)" text, "Last aired" real, "Network (New/Returning)" text, "Returning" text )
When did soul train music awards return?
SELECT "Returning" FROM table_78868 WHERE "Show" = 'soul train music awards'
wikisql
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
count the number of patients whose year of birth is less than 2031?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.dob_year < "2031"
mimicsql_data
CREATE TABLE table_19185 ( "Cast" text, "1951 ( BBC )" text, "1957 (BBC)" text, "1968 (BBC)" text, "1970 (film)" text, "2000 ( Carlton Television )" text )
Name the 2000 carlton television for 1951 bbc john stuart
SELECT "2000 ( Carlton Television )" FROM table_19185 WHERE "1951 ( BBC )" = 'John Stuart'
wikisql
CREATE TABLE table_204_0 ( id number, "poll source" text, "date(s)\nadministered" text, "sample\nsize" number, "margin of\nerror" text, "ed burke" text, "roland burris" text, "gery chico" text, "bill daley" text, "tom dart" text, "danny k. davis" text, "miguel del valle" ...
which poll source has the largest sample size ?
SELECT "poll source" FROM table_204_0 ORDER BY "sample\nsize" DESC LIMIT 1
squall
CREATE TABLE table_28068645_8 ( super_league INTEGER, champions_league VARCHAR )
List the lowest super league for a 0 champion league.
SELECT MIN(super_league) FROM table_28068645_8 WHERE champions_league = 0
sql_create_context
CREATE TABLE lessons ( lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number ) CREATE TABLE vehicles ( vehicle_id number, vehicle_details text ) CREATE TABLE customer_payments ( cu...
How many staff have the first name Ludie?
SELECT COUNT(*) FROM staff WHERE first_name = "Ludie"
spider
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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,...
查询花英勋病患的检验报告单中结果指标均异常的检验报告单,需要检验报告的单号
SELECT jybgb.BGDH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND 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 ...
css
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY...
For those employees who did not have any job in the past, for employee_id, hire_date, visualize the trend, and I want to show by the HIRE_DATE from low to high.
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY HIRE_DATE
nvbench
CREATE TABLE table_50942 ( "Senator" text, "Party" text, "District" real, "Home Town" text, "Took Office" real )
Which Took Office has a Party of democratic, a Home Town of victoria, and a District smaller than 18?
SELECT COUNT("Took Office") FROM table_50942 WHERE "Party" = 'democratic' AND "Home Town" = 'victoria' AND "District" < '18'
wikisql
CREATE TABLE table_60186 ( "Year" real, "Champion" text, "Finalist" text, "Score" text, "Place" text )
What is Finalist, when Year is '2008'?
SELECT "Finalist" FROM table_60186 WHERE "Year" = '2008'
wikisql
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Bod...
Most effective Illuminators with accept rate. Illuminator badge holders ranked by their effectiveness; percentage of their answers that qualify for the badge times the number of qualifying answers. This gives a better ranking for how effectively people have improved the original question (how often they edited the ques...
SELECT ct AS "total_answers", accept AS "accepted_answers", accept * 100 / ct AS "accept_rate" FROM (SELECT COUNT(*) AS ct, SUM(CASE WHEN q.AcceptedAnswerId = a.Id THEN 1 ELSE 0 END) AS accept FROM Posts AS q JOIN Posts AS a ON a.ParentId = q.Id WHERE q.PostTypeId = 1 AND a.ClosedDate IS NULL AND q.ClosedDate IS NULL A...
sede
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 prescriptions ( row_id number, subject_id number, h...
what are the three most frequently ordered medications until 4 years ago?
SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 3
mimic_iii
CREATE TABLE table_50273 ( "City" text, "Country" text, "IATA" text, "ICAO" text, "Airport" text )
What is the ICAO in France with an IATA of Ory?
SELECT "ICAO" FROM table_50273 WHERE "Country" = 'france' AND "IATA" = 'ory'
wikisql
CREATE TABLE race ( Race_ID int, Name text, Class text, Date text, Track_ID text ) CREATE TABLE track ( Track_ID int, Name text, Location text, Seating real, Year_Opened real )
Return a histogram on what are the names of different tracks, and how many races has each had?
SELECT T2.Name, COUNT(*) FROM race AS T1 JOIN track AS T2 ON T1.Track_ID = T2.Track_ID GROUP BY T1.Track_ID
nvbench
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 text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
编码为18482943的团伙成员最常去的医生排序是什么?
SELECT t_kc21.OUT_DIAG_DOC_CD, t_kc21.OUT_DIAG_DOC_NM FROM t_kc21 WHERE t_kc21.PERSON_ID = '18482943' GROUP BY t_kc21.OUT_DIAG_DOC_CD ORDER BY COUNT(*) DESC
css
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 ...
how many hours has it been since patient 82132's last stay in the careunit sicu in their current hospital visit?
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 = 82132 AND admissions.dischtime IS NULL) AND transfers.careunit = 'sicu' ORDER BY transfers.intime DESC LIMIT 1
mimic_iii
CREATE TABLE table_78914 ( "Round" real, "Player" text, "Position" text, "Nationality" text, "College/junior/club team (league)" text )
Which player from the United States plays defence and was chosen before round 5?
SELECT "Player" FROM table_78914 WHERE "Position" = 'defence' AND "Round" < '5' AND "Nationality" = 'united states'
wikisql
CREATE TABLE table_45962 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Series" text )
On what date did Detroit play at home?
SELECT "Date" FROM table_45962 WHERE "Home" = 'detroit'
wikisql
CREATE TABLE betfront ( year number, datetime time, country text, competion text, match text, home_opening number, draw_opening number, away_opening number, home_closing number, draw_closing number, away_closing number ) CREATE TABLE football_data ( season text, date...
What were the closing odds for a draw in matches with VfB Stuttgart?
SELECT draw_closing FROM betfront WHERE match LIKE "%VfB Stuttgart%"
worldsoccerdatabase
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, return a bar chart about the distribution of founder and the sum of manufacturer , and group by attribute founder, and show in asc by the y axis.
SELECT Founder, SUM(Manufacturer) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY SUM(Manufacturer)
nvbench
CREATE TABLE table_59156 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text )
What away team did Horsham play?
SELECT "Away team" FROM table_59156 WHERE "Home team" = 'horsham'
wikisql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) 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 ) ...
among patients diagnosed with esophageal varices in diseases classified elsewhere, with bleeding, how many of them belonged to white ethnic origin?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "WHITE" AND diagnoses.long_title = "Esophageal varices in diseases classified elsewhere, with bleeding"
mimicsql_data
CREATE TABLE table_58437 ( "CDP name" text, "County" text, "Pop. (2010)" real, "Land ( sq mi )" real, "Water (sq mi)" real, "Coordinates" text, "FIPS code" real, "ANSI code" real )
Name the highest FIPS code for coordinates of 41.827547, -74.118478 and land less than 1.196
SELECT MAX("FIPS code") FROM table_58437 WHERE "Coordinates" = '41.827547, -74.118478' AND "Land ( sq mi )" < '1.196'
wikisql
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE patient ( uniquep...
tell me the difference in wbc x 1000 levels in patient 006-172277 last measured on the current hospital visit compared to the second to last value measured on the current hospital visit?
SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-172277' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'wbc ...
eicu
CREATE TABLE table_name_33 ( attendance INTEGER, date VARCHAR )
How many were in attendance on October 27, 1963?
SELECT MAX(attendance) FROM table_name_33 WHERE date = "october 27, 1963"
sql_create_context
CREATE TABLE table_61780 ( "Year" real, "Award ceremony" text, "Role" text, "Production" text, "Result" text )
Which Award Ceremony in 2009 has a Role of Glinda?
SELECT "Award ceremony" FROM table_61780 WHERE "Role" = 'glinda' AND "Year" = '2009'
wikisql
CREATE TABLE exhibition_record ( Exhibition_ID int, Date text, Attendance int ) CREATE TABLE exhibition ( Exhibition_ID int, Year int, Theme text, Artist_ID int, Ticket_Price real ) CREATE TABLE artist ( Artist_ID int, Name text, Country text, Year_Join int, Age int...
What are the average ages of artists by countries? Visualize the result with a histogram, and I want to display in asc by the total number.
SELECT Country, AVG(Age) FROM artist GROUP BY Country ORDER BY AVG(Age)
nvbench
CREATE TABLE table_2681 ( "N" real, "P" text, "Name" text, "EU" text, "Country" text, "Age" real, "Type" text, "Moving from" text, "Transfer window" text, "Ends" real, "Transfer fee" text, "Source" text )
Name the number of ends for cardiff city and df
SELECT COUNT("Ends") FROM table_2681 WHERE "Source" = 'Cardiff City' AND "P" = 'DF'
wikisql
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, Creati...
Items marked as duplicates of 'What is a NullReferenceException and how do I fix it?'.
SELECT p.Title, p.Id FROM Posts AS p INNER JOIN PendingFlags AS pf ON p.Id = pf.PostId WHERE pf.DuplicateOfQuestionId = 4660142
sede
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TA...
what is the name of the drug which patient 005-76770 was prescribed within 2 days after having received a insulin - continuous infusion procedure in 03/last year?
SELECT t2.drugname FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-76770') AND treatment.treatme...
eicu
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, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
患者编号为76980404的人在2001年7月25日到2018年6月20日内曾在医院就诊的次数有多少次?
SELECT (SELECT COUNT(*) FROM hz_info JOIN zzmzjzjlb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX WHERE hz_info.RYBH = '76980404' AND zzmzjzjlb.JZKSRQ BETWEEN '2001-07-25' AND '2018-06-20' UNION SELECT COUNT(*) FROM hz_info JOIN fzzmzjzjlb ON hz_info.YLJGDM = fzzmzjz...
css