context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_45236 ( "Name" text, "Raw bandwidth (Mbit/s)" text, "Max. cable length (m)" text, "Power provided" text, "Devices per channel" text )
What is the Devices per channel where the Name is sata revision 3.0?
SELECT "Devices per channel" FROM table_45236 WHERE "Name" = 'sata revision 3.0'
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 hz_info ( KH text, KLX number...
把患者水康成在3230609医院门诊看诊时,诊断内容书上无张力的就诊记录找出来
SELECT * 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 hz_info.YLJGDM = '3230609' AND NOT mzjzjlb.JZZDSM LIKE '%张力%'
css
CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, Par...
Show text of specific comment.
SELECT Text FROM Comments WHERE Id = '##Id##'
sede
CREATE TABLE table_name_80 ( rank INTEGER, total VARCHAR, nation VARCHAR )
What is the average rank of Great Britain when their total is over 4?
SELECT AVG(rank) FROM table_name_80 WHERE total > 4 AND nation = "great britain"
sql_create_context
CREATE TABLE customers ( id INTEGER, first_name VARCHAR(40), last_name VARCHAR(20), company VARCHAR(80), address VARCHAR(70), city VARCHAR(40), state VARCHAR(40), country VARCHAR(40), postal_code VARCHAR(10), phone VARCHAR(24), fax VARCHAR(24), email VARCHAR(60), supp...
Show me a bar chart for what are the names of the countries and average invoice size of the top countries by size?
SELECT billing_country, AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10
nvbench
CREATE TABLE table_51497 ( "Rank" real, "Engine" text, "Wins" real, "First win" text, "Latest win" text )
What is the rank 16 wins with the latest win at the 1967 Belgian Grand Prix?
SELECT "Wins" FROM table_51497 WHERE "Rank" > '16' AND "Latest win" = '1967 belgian grand prix'
wikisql
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
患者20485029医保的统筹基金支出总额有多少,在2002-04-23到2015-07-22这十三年里?
SELECT SUM(t_kc24.OVE_PAY) FROM t_kc24 WHERE t_kc24.PERSON_ID = '20485029' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2002-04-23' AND '2015-07-22'
css
CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) CREA...
i need information on ground transportation between airport and downtown in the city of BOS
SELECT DISTINCT ground_service.transport_type FROM airport, airport_service, city AS CITY_0, city AS CITY_1, ground_service WHERE airport.airport_code = airport_service.airport_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = airport_service.city_code AND CITY_1.city_name = 'BOSTON' AND ground_service.airpor...
atis
CREATE TABLE table_name_74 ( marriage VARCHAR, spouse VARCHAR )
Name the marriage of the person who is married for christian viii
SELECT marriage FROM table_name_74 WHERE spouse = "christian viii"
sql_create_context
CREATE TABLE table_name_25 ( gold INTEGER, bronze VARCHAR, rank VARCHAR, nation VARCHAR )
Which Gold has a Rank larger than 6, and a Nation of netherlands, and a Bronze smaller than 0?
SELECT SUM(gold) FROM table_name_25 WHERE rank > 6 AND nation = "netherlands" AND bronze < 0
sql_create_context
CREATE TABLE table_name_52 ( date VARCHAR, circuit VARCHAR )
What date has the Surfers Paradise International Raceway circuit?
SELECT date FROM table_name_52 WHERE circuit = "surfers paradise international raceway"
sql_create_context
CREATE TABLE table_41818 ( "Season" text, "Wins" real, "Losses" real, "Win%" real, "Games behind" text, "Playoffs" text, "Results" text )
What is the lowest percentage of wins for 6 games and more than 77 total wins?
SELECT MIN("Win%") FROM table_41818 WHERE "Games behind" = '6½' AND "Wins" > '77'
wikisql
CREATE TABLE table_4307 ( "Sport" text, "Years" text, "Games" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
Tell me the lowest Bronze for gold of 3 in the winter for cross-country skiing and silver less than 0
SELECT MIN("Bronze") FROM table_4307 WHERE "Gold" = '3' AND "Games" = 'winter' AND "Sport" = 'cross-country skiing' AND "Silver" < '0'
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
how many patients died in or before the year 2158 and used the drug hydralazine hcl?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2158.0" AND prescriptions.drug = "Hydralazine HCl"
mimicsql_data
CREATE TABLE table_62058 ( "Outcome" text, "Date" real, "Championship" text, "Surface" text, "Opponent in the final" text, "Score in the final" text )
What is Surface, when Date is less than 1979, and when Opponent in the Final is 'Bill Scanlon'?
SELECT "Surface" FROM table_62058 WHERE "Date" < '1979' AND "Opponent in the final" = 'bill scanlon'
wikisql
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImage...
My acceptance criteria in suggested edits review. http://meta.stackexchange.com/questions/187083/how-is-my-acceptance-criteria-in-suggested-edits-review-compared-with-the-comu
SELECT CASE WHEN mine.VoteTypeId = 2 THEN 'approve' ELSE 'reject' END AS "mine", CASE WHEN theirs.VoteTypeId = 2 THEN 'approve' ELSE 'reject' END AS "theirs", COUNT(*) AS "cnt" FROM SuggestedEditVotes AS mine INNER JOIN SuggestedEditVotes AS theirs ON theirs.SuggestedEditId = mine.SuggestedEditId WHERE mine.UserId = '#...
sede
CREATE TABLE table_name_84 ( player VARCHAR, year_s__won VARCHAR )
What is Player, when Year(s) Won is 1955?
SELECT player FROM table_name_84 WHERE year_s__won = "1955"
sql_create_context
CREATE TABLE table_name_49 ( opponent VARCHAR, attendance VARCHAR )
Tell me the opponent for attendance of 53,899
SELECT opponent FROM table_name_49 WHERE attendance = "53,899"
sql_create_context
CREATE TABLE table_20127 ( "Time" text, "06:00 PM" text, "07:00 PM" text, "08:00 PM" text, "09:00 PM" text, "10:00 PM" text, "10:30 PM" text, "11:00 PM" text )
Name the 8 pm when time is thursday
SELECT "08:00 PM" FROM table_20127 WHERE "Time" = 'Thursday'
wikisql
CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
count the number of patients who have been dead after having been diagnosed with gastroduodenal dis nec within 2 months since 2105.
SELECT COUNT(DISTINCT t2.subject_id) FROM (SELECT t1.subject_id, t1.charttime 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 d_icd_di...
mimic_iii
CREATE TABLE table_72635 ( "Rank" real, "Country/Territory" text, "Miss World" real, "1st Runner-up" real, "2nd Runner-up" real, "3rd Runner-up" real, "4th Runner-up" real, "5th Runner-up" real, "6th Runner-up" real, "Semifinalists" real, "Total" real )
What is Iceland's total?
SELECT COUNT("Total") FROM table_72635 WHERE "Country/Territory" = 'Iceland'
wikisql
CREATE TABLE table_name_93 ( location VARCHAR, mascot VARCHAR )
Where is the school located that has mustangs as a mascot?
SELECT location FROM table_name_93 WHERE mascot = "mustangs"
sql_create_context
CREATE TABLE table_name_36 ( away_team VARCHAR, venue VARCHAR )
Who was the away team at Lake Oval?
SELECT away_team FROM table_name_36 WHERE venue = "lake oval"
sql_create_context
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, ...
what's the number of patients who have had graft repair atrial def since 2103?
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'graft repair atrial def') AND STRFTIME('%y', procedu...
mimic_iii
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_DIRE_CD text, MED_DIRE_NM text,...
瑞舒伐他汀钙片在医疗就诊69850313527里面,它的收费项目等级是什么?
SELECT t_kc22.CHA_ITEM_LEV FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '69850313527' AND t_kc22.SOC_SRT_DIRE_NM = '瑞舒伐他汀钙片'
css
CREATE TABLE table_test_19 ( "id" int, "gender" string, "left_ventricular_ejection_fraction_lvef" int, "systolic_blood_pressure_sbp" int, "acute_infectious" bool, "hypertensive_retinopathy" bool, "leukocyte_count" int, "severe_uncontrolled_hypertension" bool, "chronic_infectious" boo...
body weight < 40 kg or > 125 kg;
SELECT * FROM table_test_19 WHERE body_weight < 40 OR body_weight > 125
criteria2sql
CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int ) CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text )
Bar chart x axis type y axis the total number
SELECT Type, COUNT(*) FROM ship GROUP BY Type
nvbench
CREATE TABLE table_34841 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text )
What was the loss of the game when the record was 46-84?
SELECT "Loss" FROM table_34841 WHERE "Record" = '46-84'
wikisql
CREATE TABLE table_29881 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
What date did the Hawks play against Boston?
SELECT "Date" FROM table_29881 WHERE "Team" = 'Boston'
wikisql
CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE student ( student_id int, lastname varchar, ...
Are there any classes I must take to be able to declare an AUTO major ?
SELECT DISTINCT course.department, course.name, course.number FROM course, program_course WHERE course.department LIKE '%AUTO%' AND program_course.category LIKE 'PreMajor' AND program_course.course_id = course.course_id
advising
CREATE TABLE table_66843 ( "Sunday" text, "Monday" text, "Tuesday" text, "Wednesday" text, "Thursday" text, "Friday" text, "Saturday" text )
Which Tuesday has a Saturday of doy bi?
SELECT "Tuesday" FROM table_66843 WHERE "Saturday" = '土曜日 doyōbi'
wikisql
CREATE TABLE table_37225 ( "Driver" text, "Team" text, "Laps" real, "Time/Retired" text, "Grid" real, "Points" real )
Which Grid has a Team of rusport, and Laps larger than 221?
SELECT SUM("Grid") FROM table_37225 WHERE "Team" = 'rusport' AND "Laps" > '221'
wikisql
CREATE TABLE table_28220 ( "Region" text, "Land area (km 2 )" text, "Rainfall by depth (mm/year)" real, "Rainfall by volume (km 3 /year)" text, "Surface run off (km 3 /year)" text, "Infiltration (km 3 /year)" text, "Evapotranspiration (km 3 /year)" text )
How many regions had rainfall infiltration (km 3/year) of 9.3?
SELECT COUNT("Rainfall by depth (mm/year)") FROM table_28220 WHERE "Infiltration (km 3 /year)" = '9.3'
wikisql
CREATE TABLE table_20159025_1 ( part_3 VARCHAR, driver VARCHAR )
What was the time in part 3 when Nick Heidfeld was the driver?
SELECT part_3 FROM table_20159025_1 WHERE driver = "Nick Heidfeld"
sql_create_context
CREATE TABLE table_27319183_5 ( official_itv1_rating__millions_ VARCHAR, episode VARCHAR )
What was the official ITV1 rating in millions of the Live Final Results episode?
SELECT official_itv1_rating__millions_ FROM table_27319183_5 WHERE episode = "Live final results"
sql_create_context
CREATE TABLE table_79079 ( "Opposing Teams" text, "Against" real, "Date" text, "Venue" text, "Status" text )
What is Opposing Teams, when Date is '11/10/1991'?
SELECT "Opposing Teams" FROM table_79079 WHERE "Date" = '11/10/1991'
wikisql
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int,...
list all flights from BURBANK to DENVER
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 = 'BURBANK' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER...
atis
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE microlab ( microlabid ...
tell me the name of the drug that patient 006-57924 is allergic to in 10/this year?
SELECT allergy.drugname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-57924')) AND DATETIME(allergy.allergytime, 'start of year') = DATETIME(C...
eicu
CREATE TABLE table_39740 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-10" real, "Top-25" real, "Events" real, "Cuts made" real )
What is the average Top-25 that has a Top-10 less than 7, and the Tournament is the open championship, with a Top-5more than 1?
SELECT AVG("Top-25") FROM table_39740 WHERE "Top-10" < '7' AND "Tournament" = 'the open championship' AND "Top-5" > '1'
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...
give me the number of patients whose lab test chart time is 2165-10-19 05:33:00?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.charttime = "2165-10-19 05:33:00"
mimicsql_data
CREATE TABLE customers ( customer_id number, customer_address_id number, customer_status_code text, date_became_customer time, date_of_birth time, first_name text, last_name text, amount_outstanding number, email_address text, phone_number text, cell_mobile_phone_number text ...
What is the date of birth of every customer whose status code is 'Good Customer'?
SELECT date_of_birth FROM customers WHERE customer_status_code = 'Good Customer'
spider
CREATE TABLE table_17091 ( "Player" text, "Position" text, "School" text, "Hometown" text, "College" text )
who are all the players for mission viejo high school
SELECT "Player" FROM table_17091 WHERE "School" = 'Mission Viejo High School'
wikisql
CREATE TABLE table_name_86 ( premiere VARCHAR, channel VARCHAR )
When was the premiere on the TVB Jade Channel?
SELECT premiere FROM table_name_86 WHERE channel = "tvb jade"
sql_create_context
CREATE TABLE table_25033 ( "Year" text, "Network" text, "Play-by-play" text, "Color commentator(s)" text, "Ice level reporters" text, "Studio host" text, "Studio analysts" text )
Which network has bob costas as the studio host and darren pang as the ice level reporters?
SELECT "Network" FROM table_25033 WHERE "Studio host" = 'Bob Costas' AND "Ice level reporters" = 'Darren Pang'
wikisql
CREATE TABLE Skills_Required_To_Fix ( part_fault_id VARCHAR, skill_id VARCHAR ) CREATE TABLE Skills ( skill_description VARCHAR, skill_id VARCHAR ) CREATE TABLE Part_Faults ( fault_short_name VARCHAR, part_fault_id VARCHAR )
For all the faults of different parts, what are all the decriptions of the skills required to fix them? List the name of the faults and the skill description.
SELECT T1.fault_short_name, T3.skill_description FROM Part_Faults AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.part_fault_id = T2.part_fault_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id
sql_create_context
CREATE TABLE table_name_86 ( Id VARCHAR )
What was the value in 2003 when 2006 was WTA Premier Mandatory Tournaments?
SELECT 2003 FROM table_name_86 WHERE 2006 = "wta premier mandatory tournaments"
sql_create_context
CREATE TABLE table_name_76 ( area VARCHAR, decile VARCHAR )
What area is the school with a decile of 8 in?
SELECT area FROM table_name_76 WHERE decile = "8"
sql_create_context
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 ...
从13年5月29号到19年9月12日,患者17750351的检测指标939792情况如何?
SELECT * 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.BGDH = jyjgzbb.BG...
css
CREATE TABLE table_name_37 ( date VARCHAR, opponent VARCHAR )
On what Date was Rafael Nadal the Opponent?
SELECT date FROM table_name_37 WHERE opponent = "rafael nadal"
sql_create_context
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE PostsWithDeleted ( Id number, PostTyp...
Questions with pending close votes - off topic reasons.
SELECT pf.PostId AS "post_link", COUNT(*) AS CVs, p.ViewCount AS Views, p.Score, p.AnswerCount AS Answers, p.CreationDate AS Date FROM PendingFlags AS pf INNER JOIN Posts AS p ON p.Id = pf.PostId WHERE FlagTypeId = 14 AND CloseAsOffTopicReasonTypeId = '##CloseAsOffTopicReasonTypeId?16##' AND LENGTH(p.Body) < 550 GROUP ...
sede
CREATE TABLE table_62365 ( "Country" text, "Men's Open" real, "Women's Open" real, "Men's Wheelchair" real, "Women's Wheelchair" real, "Total" real )
What is the sum of men's wheelchair from Ireland and more than 1 total?
SELECT SUM("Men's Wheelchair") FROM table_62365 WHERE "Country" = 'ireland' AND "Total" > '1'
wikisql
CREATE TABLE table_name_77 ( total INTEGER, year_s__won VARCHAR )
What is the Total of the Player with a Year(s) won of 1982?
SELECT MIN(total) FROM table_name_77 WHERE year_s__won = "1982"
sql_create_context
CREATE TABLE table_204_135 ( id number, "position" number, "club" text, "played" number, "points" number, "wins" number, "draws" number, "losses" number, "goals for" number, "goals against" number, "goal difference" number )
what are the point differences between the first and last team ?
SELECT (SELECT "points" FROM table_204_135 ORDER BY "position" LIMIT 1) - (SELECT "points" FROM table_204_135 ORDER BY "position" DESC LIMIT 1)
squall
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,...
自2001-06-04起,截止到2004-12-26,做手术术数量排第一科室的和最后一名差多少
SELECT (SELECT COUNT(*) FROM t_kc22 WHERE STA_DATE BETWEEN '2001-06-04' AND '2004-12-26' AND MED_INV_ITEM_TYPE = '手术费' GROUP BY MED_ORG_DEPT_CD ORDER BY COUNT(*) DESC LIMIT 1) - (SELECT COUNT(*) FROM t_kc22 WHERE STA_DATE BETWEEN '2001-06-04' AND '2004-12-26' AND MED_INV_ITEM_TYPE = '手术费' GROUP BY MED_ORG_DEPT_CD ORDER...
css
CREATE TABLE table_11213 ( "Week" text, "Date" text, "Opponent" text, "Result" text, "Kickoff [a ]" text, "Game site" text, "Attendance" text, "Record" text )
When was the date that week 9 started?
SELECT "Date" FROM table_11213 WHERE "Week" = '9'
wikisql
CREATE TABLE qtb ( CLINIC_ID text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, IN...
有多少公务员在2019年8月10日到2021年8月28日内期间在医疗机构8313730有过医疗就诊记录?
SELECT COUNT(*) FROM qtb WHERE qtb.MED_SER_ORG_NO = '8313730' AND qtb.IN_HOSP_DATE BETWEEN '2019-08-10' AND '2021-08-28' AND qtb.SERVANT_FLG = '公务员' UNION SELECT COUNT(*) FROM gyb WHERE gyb.MED_SER_ORG_NO = '8313730' AND gyb.IN_HOSP_DATE BETWEEN '2019-08-10' AND '2021-08-28' AND gyb.SERVANT_FLG = '公务员' UNION SELECT COU...
css
CREATE TABLE table_name_5 ( bronze INTEGER, rank VARCHAR, silver VARCHAR )
How many Bronzes have a Rank of 9, and a Silver larger than 2?
SELECT SUM(bronze) FROM table_name_5 WHERE rank = "9" AND silver > 2
sql_create_context
CREATE TABLE course ( cid text, cname text, credits number, instructor number, days text, hours text, dno number ) CREATE TABLE department ( dno number, division text, dname text, room text, building text, dphone number ) CREATE TABLE minor_in ( stuid number, ...
Find the rank of the faculty that the fewest faculties belong to.
SELECT rank FROM faculty GROUP BY rank ORDER BY COUNT(*) LIMIT 1
spider
CREATE TABLE table_name_37 ( tuf_competitor VARCHAR, method VARCHAR )
who is the tuf competitor when the method id decision (unanimous)?
SELECT tuf_competitor FROM table_name_37 WHERE method = "decision (unanimous)"
sql_create_context
CREATE TABLE table_12983929_1 ( total_power VARCHAR, construction_finish VARCHAR )
What's the total power of the unit whose construction finished on 14.06.1963?
SELECT total_power FROM table_12983929_1 WHERE construction_finish = "14.06.1963"
sql_create_context
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...
has patient 005-26011 had a pleural effusion - etiology unknown diagnosis on the last hospital encounter?
SELECT COUNT(*) > 0 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-26011' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.ho...
eicu
CREATE TABLE table_63917 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
How many Gold medals did Puerto Rico receive with 1 Silver and a Total of 1 or less?
SELECT COUNT("Gold") FROM table_63917 WHERE "Silver" = '1' AND "Nation" = 'puerto rico' AND "Total" < '1'
wikisql
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...
when was the last time that patient 033-17325 was prescribed a medicine via intra-cathet route until 11/2105?
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '033-17325')) AND medication.routeadmin = 'intra-cathet' AND ST...
eicu
CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1...
Show the number of male and female assistant professors with a bar chart, and order names from low to high order.
SELECT Sex, COUNT(*) FROM Faculty WHERE Rank = "AsstProf" GROUP BY Sex ORDER BY Sex
nvbench
CREATE TABLE table_203_189 ( id number, "year" number, "competition" text, "venue" text, "position" text, "notes" text )
how many times has jifar placed third or better in the 10,000 meter race ?
SELECT COUNT(*) FROM table_203_189 WHERE "position" <= 3 AND "notes" = 10000
squall
CREATE TABLE table_58935 ( "County" text, "Per capita income" text, "Median household income" text, "Median family income" text, "Population" real, "Number of households" real )
What is the number of households in the county with median income of $65,240 and population greater than 744,344?
SELECT SUM("Number of households") FROM table_58935 WHERE "Median family income" = '$65,240' AND "Population" > '744,344'
wikisql
CREATE TABLE customers ( id number, first_name text, last_name text, company text, address text, city text, state text, country text, postal_code text, phone text, fax text, email text, support_rep_id number ) CREATE TABLE invoice_lines ( id number, invoice_i...
Find the name of tracks which are in both Movies and music playlists.
SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Movies' INTERSECT SELECT T1.name FROM tracks AS T1 JOIN playlist_tracks AS T2 ON T1.id = T2.track_id JOIN playlists AS T3 ON T2.playlist_id = T3.id WHERE T3.name = 'Music'
spider
CREATE TABLE table_203_444 ( id number, "week" number, "start date" text, "type" text, "tournament" text, "surface" text, "town" text, "country" text, "continent" text, "prize money" text )
what is the number of tournaments played on grass ?
SELECT COUNT("tournament") FROM table_203_444 WHERE "surface" = 'grass'
squall
CREATE TABLE table_23150 ( "Player" text, "Team" text, "Matches" real, "Overs" text, "Wickets" real, "Economy Rate" text, "Average" text, "Strike Rate" text, "BBI" text, "BBM" text )
What is the strike rate when there are 17 wickets?
SELECT "Strike Rate" FROM table_23150 WHERE "Wickets" = '17'
wikisql
CREATE TABLE table_28460 ( "Modern English day name" text, "Old English day name" text, "English day name meaning" text, "Glossed from Latin day name" text, "Latin day name meaning" text )
how many different meanings does Wednesday have?
SELECT COUNT("English day name meaning") FROM table_28460 WHERE "Modern English day name" = 'Wednesday'
wikisql
CREATE TABLE table_name_61 ( category VARCHAR, winner_nominee_s_ VARCHAR )
Which category was Dev Patel nominated for?
SELECT category FROM table_name_61 WHERE winner_nominee_s_ = "dev patel"
sql_create_context
CREATE TABLE table_52154 ( "Entrant" text, "Constructor" text, "Chassis" text, "Engine" text, "Tyre" text, "Driver" text, "Rounds" text )
What was the Zakspeed 1500/4 1.5 l4 t chassis?
SELECT "Chassis" FROM table_52154 WHERE "Engine" = 'zakspeed 1500/4 1.5 l4 t'
wikisql
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefin...
How many users with the first name John?.
SELECT COUNT(Id) FROM Users WHERE DisplayName LIKE ('% Anthony %')
sede
CREATE TABLE table_5703 ( "Year" real, "League" text, "Wins" real, "Losses" real, "Draws" real, "Points" real )
How many points have a loss less than 5, and 0 for draws?
SELECT COUNT("Points") FROM table_5703 WHERE "Losses" < '5' AND "Draws" = '0'
wikisql
CREATE TABLE table_21716139_1 ( train_name VARCHAR, category VARCHAR, frequency VARCHAR )
What trains have a category of express and a weekly frequency?
SELECT train_name FROM table_21716139_1 WHERE category = "Express" AND frequency = "Weekly"
sql_create_context
CREATE TABLE table_3597 ( "District" text, "Incumbent" text, "Party" text, "First elected" text, "Result" text, "Candidates" text )
What was the result for Henry Daniel's race?
SELECT "Result" FROM table_3597 WHERE "Incumbent" = 'Henry Daniel'
wikisql
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE wdmzjzjlb ( HXPLC number, HZX...
13年10月30号到21年6月3号,患者07524990的苯巴比妥是怎样的
SELECT * FROM hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz_i...
css
CREATE TABLE table_48520 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text )
What type of surface did the tournament canada f9, markham have?
SELECT "Surface" FROM table_48520 WHERE "Tournament" = 'canada f9, markham'
wikisql
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, h...
what are the top four most frequent procedures among the patients who have 20s in 2103?
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 20 AND 29) AND STRFTIME('%y', treatment.treatmenttime) = '2103' GROUP BY treatment.t...
eicu
CREATE TABLE table_2159571_1 ( vacator VARCHAR, date_of_successors_formal_installation VARCHAR )
Who is every vacator if date of successors formal installation is August 8, 1960?
SELECT vacator FROM table_2159571_1 WHERE date_of_successors_formal_installation = "August 8, 1960"
sql_create_context
CREATE TABLE table_name_55 ( date_of_delivery VARCHAR, baby_gender VARCHAR, congresswoman VARCHAR )
What was the delivery date of Congresswoman Kirsten Gillibrand's baby boy?
SELECT date_of_delivery FROM table_name_55 WHERE baby_gender = "boy" AND congresswoman = "kirsten gillibrand"
sql_create_context
CREATE TABLE table_name_8 ( region VARCHAR, most_populous_city_town VARCHAR, irish_name VARCHAR )
Most populous city/town of clonmel, and a Irish name of tiobraid rann (contae thiobraid rann) is which region?
SELECT region FROM table_name_8 WHERE most_populous_city_town = "clonmel" AND irish_name = "tiobraid árann (contae thiobraid árann)"
sql_create_context
CREATE TABLE table_71688 ( "Year" text, "Start" text, "Qual" text, "Rank" text, "Finish" text, "Laps" real )
What was the lowest lap with the ranking of 19?
SELECT MIN("Laps") FROM table_71688 WHERE "Start" = '19'
wikisql
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE d_items ( row_id number, itemid number, label text,...
count the number of patients who had received a endo emb hd/nk,bare coil procedure since 2103 two times.
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'endo emb hd/nk,bare c...
mimic_iii
CREATE TABLE table_name_19 ( gold INTEGER, bronze INTEGER )
Name the sum of gold when Bronze is less than 0
SELECT SUM(gold) FROM table_name_19 WHERE bronze < 0
sql_create_context
CREATE TABLE table_name_77 ( number_of_electorates__2009_ INTEGER, constituency_number VARCHAR )
Which Number of electorates (2009) has a Constituency number of 46?
SELECT AVG(number_of_electorates__2009_) FROM table_name_77 WHERE constituency_number = "46"
sql_create_context
CREATE TABLE classroom ( building varchar(15), room_number varchar(7), capacity numeric(4,0) ) CREATE TABLE department ( dept_name varchar(20), building varchar(15), budget numeric(12,2) ) CREATE TABLE prereq ( course_id varchar(8), prereq_id varchar(8) ) CREATE TABLE section ( co...
List the number of instructors for each course in year 2008 with a bar chart, and I want to rank by the X in ascending.
SELECT title, COUNT(title) FROM course AS T1 JOIN teaches AS T2 ON T1.course_id = T2.course_id JOIN instructor AS T3 ON T2.ID = T3.ID WHERE year = 2008 GROUP BY title ORDER BY title
nvbench
CREATE TABLE VOTING_RECORD ( President_Vote VARCHAR )
Find the distinct number of president votes.
SELECT COUNT(DISTINCT President_Vote) FROM VOTING_RECORD
sql_create_context
CREATE TABLE table_name_15 ( pick INTEGER, round VARCHAR, overall VARCHAR )
What is the lowest pick with fewer than 3 rounds and more than 4 overall?
SELECT MIN(pick) FROM table_name_15 WHERE round < 3 AND overall > 4
sql_create_context
CREATE TABLE member_attendance ( Member_ID int, Performance_ID int, Num_of_Pieces int ) CREATE TABLE member ( Member_ID text, Name text, Nationality text, Role text ) CREATE TABLE performance ( Performance_ID real, Date text, Host text, Location text, Attendance int )
Compute the total the total number across location as a pie chart.
SELECT Location, COUNT(*) FROM performance GROUP BY Location
nvbench
CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId num...
Dump answers to questions for user.
SELECT q.Id, q.CreationDate, q.Title, q.Body, a.Id, a.CreationDate, a.Body FROM Posts AS q INNER JOIN Posts AS a ON q.Id = a.ParentId AND a.PostTypeId = 2 AND q.PostTypeId = 1 WHERE a.OwnerUserId = '##UserId##' ORDER BY a.Id DESC
sede
CREATE TABLE table_1430 ( "Municipality" text, "Population" text, "Inhabitants per km\u00b2" real, "Area (in km\u00b2)" real, "Markatal" real, "Island" text, "Region" text )
Name the minimum inhabitants for markatal 49
SELECT MIN("Inhabitants per km\u00b2") FROM table_1430 WHERE "Markatal" = '49'
wikisql
CREATE TABLE table_27948565_1 ( circuit VARCHAR, grand_prix VARCHAR )
Name the circuit for hertz british grand prix
SELECT circuit FROM table_27948565_1 WHERE grand_prix = "Hertz British grand_prix"
sql_create_context
CREATE TABLE table_74128 ( "Game" real, "December" real, "Opponent" text, "Score" text, "Decision" text, "Location/Attendance" text, "Record" text )
Name the number of game 2-6
SELECT COUNT("Game") FROM table_74128 WHERE "Score" = '2-6'
wikisql
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 ...
韩霞飞患者以前都有过哪些异常情况吗?
SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb 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_MZJZ...
css
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...
how many patients having procedure under icd9 code 3142 passed away in or before the year 2168?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2168.0" AND procedures.icd9_code = "3142"
mimicsql_data
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, ...
Average question score per month.
SELECT DATEADD(mm, (YEAR(Posts.CreationDate) - 1900) * 12 + MONTH(Posts.CreationDate) - 1, 0) AS Month, AVG(CAST(Posts.Score AS FLOAT)) AS Score FROM Posts LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE PostTypes.Name IN ('Question') AND Posts.CreationDate < DATEADD(month, DATEDIFF(month, 0, GETDATE()), 0...
sede
CREATE TABLE table_11677691_1 ( hometown VARCHAR, college VARCHAR, position VARCHAR )
How many offensive line players played for a college in Alabama?
SELECT COUNT(hometown) FROM table_11677691_1 WHERE college = "Alabama" AND position = "Offensive line"
sql_create_context
CREATE TABLE table_name_41 ( rocket VARCHAR, block VARCHAR, cospar_id VARCHAR )
What rocket has a Block of block i and a COSPAR ID of 1995-060a?
SELECT rocket FROM table_name_41 WHERE block = "block i" AND cospar_id = "1995-060a"
sql_create_context
CREATE TABLE table_name_75 ( host_team VARCHAR, stadium VARCHAR )
What team hosted at Tampa Stadium?
SELECT host_team FROM table_name_75 WHERE stadium = "tampa stadium"
sql_create_context