instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
On which date is high assists Dupree (6)? | CREATE TABLE table_17118657_10 (date VARCHAR,high_assists VARCHAR) | SELECT date FROM table_17118657_10 WHERE high_assists = "Dupree (6)" |
What is the 2006 value with a 2011 value greater than 4113 and a 2008 value less than 7181? | CREATE TABLE table_name_83 (Id VARCHAR) | SELECT SUM(2006) FROM table_name_83 WHERE 2011 > 4113 AND 2008 < 7181 |
how many patients younger than 70 years have got the cerebrospinal fluid (csf) lab test done? | 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)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "70" AND lab.fluid = "Cerebrospinal Fluid (CSF)" |
Who is the best player in the 1998 season? | CREATE TABLE table_2527617_1 (best_player VARCHAR,season VARCHAR) | SELECT best_player FROM table_2527617_1 WHERE season = 1998 |
how much patient 84346 has changed in urea nitrogen last measured on the last hospital visit compared to the first value measured on the last hospital visit? | 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 patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE procedur... | SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 84346 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.l... |
What is the Lower index Kcal/ Nm 3 entry, for the row with entries of an Upper index Kcal/ Nm 3 smaller than 19,376, and a Lower index MJ/ Nm 3 of 74.54? | CREATE TABLE table_name_5 (lower_index_kcal__nm_3 INTEGER,lower_index_mj__nm_3 VARCHAR,upper_index_kcal__nm_3 VARCHAR) | SELECT AVG(lower_index_kcal__nm_3) FROM table_name_5 WHERE lower_index_mj__nm_3 = 74.54 AND upper_index_kcal__nm_3 < 19 OFFSET 376 |
Which player has a last name of baron? | CREATE TABLE table_75276 ("Surname" text,"First" text,"D.O.B." text,"Uni#" real,"Bats" text,"Throws" text,"Position" text) | SELECT "Bats" FROM table_75276 WHERE "Surname" = 'baron' |
What is the Profit / (Loss) Before Tax ( m) that has a Revenue ( m) larger than 1,115.8, and on 31 december 2012? | CREATE TABLE table_5848 ("Year Ended" text,"Passengers Flown" real,"Passenger Load Factor (%)" real,"Revenue (\u20acm)" real,"Profit / (Loss) Before Tax (\u20acm)" text,"Net Profit / (Loss) (\u20acm)" text) | SELECT "Profit / (Loss) Before Tax (\u20acm)" FROM table_5848 WHERE "Revenue (\u20acm)" > '1,115.8' AND "Year Ended" = '31 december 2012' |
give me the number of patients whose admission type is elective and drug code is warf25? | 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 text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND prescriptions.formulary_drug_cd = "WARF25" |
what is the diagnosis short title and procedure short title of subject id 83678? | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)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 t... | SELECT diagnoses.short_title, procedures.short_title FROM diagnoses INNER JOIN procedures ON diagnoses.hadm_id = procedures.hadm_id WHERE diagnoses.subject_id = "83678" |
How many draws feature artist wendy fierce? | CREATE TABLE table_name_18 (draw INTEGER,artist VARCHAR) | SELECT SUM(draw) FROM table_name_18 WHERE artist = "wendy fierce" |
How many points did Carlton score? | CREATE TABLE table_33684 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Home team score" FROM table_33684 WHERE "Away team" = 'carlton' |
how many patients had been discharged from the hospital since 3 years ago. | CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmen... | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE NOT patient.hospitaldischargetime IS NULL AND DATETIME(patient.hospitaldischargetime) >= DATETIME(CURRENT_TIME(), '-3 year') |
List the lowest super league for a 0 champion league. | CREATE TABLE table_30280 ("Position" text,"Number" real,"Player" text,"Super League" real,"Champions League" real,"Swiss Cup" real,"Total" real) | SELECT MIN("Super League") FROM table_30280 WHERE "Champions League" = '0' |
Tell me the number of patients who had elective hospital admissions and other body fluid lab tests. | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab.fluid = "Other Body Fluid" |
Return the unique name for stations that have ever had 7 bikes available. | CREATE TABLE status (station_id VARCHAR,bikes_available VARCHAR)CREATE TABLE station (name VARCHAR,id VARCHAR) | SELECT DISTINCT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available = 7 |
How many were Wounded while in a Unit with a Complement of 83 off 9 Men? | CREATE TABLE table_name_79 (wounded VARCHAR,complement VARCHAR) | SELECT wounded FROM table_name_79 WHERE complement = "83 off 9 men" |
What season has a regionalliga s d league, a 1-0 home, and an away of 2-3? | CREATE TABLE table_name_38 (season VARCHAR,away VARCHAR,league VARCHAR,home VARCHAR) | SELECT season FROM table_name_38 WHERE league = "regionalliga süd" AND home = "1-0" AND away = "2-3" |
Top editors with type breakdown. Does not count edits to one's own posts.
Does not count rollbacks.
Does not count edits to community wiki posts after they were made CW. | 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 CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE FlagTypes (Id number,Name text,Description text)C... | SELECT h.UserId AS "user_link", SUM(CASE WHEN PostHistoryTypeId = 6 THEN 1 ELSE 0 END) AS "retags", SUM(CASE WHEN PostHistoryTypeId = 5 THEN 1 ELSE 0 END) AS "body_edits", SUM(CASE WHEN PostHistoryTypeId = 4 THEN 1 ELSE 0 END) AS "title_edits", COUNT(DISTINCT h.CreationDate) AS "total_edits", COUNT(DISTINCT h.PostId) A... |
what is the top five most common procedures that followed within 2 months for patients who received ins nondrug elut cor st since 2105? | CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid number,intime time,outtime time)CREATE TABLE d_icd_diagnoses (row_id... | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admi... |
What is FA Cup Goals, when Euro Competitions is 1, and when League Goals is 11? | CREATE TABLE table_76538 ("Scorer" text,"Club" text,"League goals" text,"FA Cup goals" text,"League Cup goals" real,"Texaco Cup goals" text,"Euro competitions" text,"Total" real) | SELECT "FA Cup goals" FROM table_76538 WHERE "Euro competitions" = '1' AND "League goals" = '11' |
Which player had a position of OT during round 27? | CREATE TABLE table_9768 ("Round" real,"Pick" real,"Overall" real,"Name" text,"Position" text,"College" text) | SELECT "Name" FROM table_9768 WHERE "Position" = 'ot' AND "Round" = '27' |
What is the premiere rating for a Chinese title of , and a Peak smaller than 41? | CREATE TABLE table_name_59 (premiere INTEGER,chinese_title VARCHAR,peak VARCHAR) | SELECT SUM(premiere) FROM table_name_59 WHERE chinese_title = "野蠻奶奶大戰戈師奶" AND peak < 41 |
what is the yearly average amount of cpk-mb index of patient 015-59552 since 01/2105? | 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 allergy (allergyid number,patientunitstayid number,drugname text,allergyna... | SELECT AVG(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 = '015-59552')) AND lab.labname = 'cpk-mb index' AND STRFTIME('%y-%m', lab.labresultt... |
Who is the runner-up for Ilhwa Chunma? | CREATE TABLE table_name_81 (runner_up VARCHAR,winner VARCHAR) | SELECT runner_up FROM table_name_81 WHERE winner = "ilhwa chunma" |
Where was the location when the record was 12-5? | CREATE TABLE table_name_89 (location VARCHAR,record VARCHAR) | SELECT location FROM table_name_89 WHERE record = "12-5" |
What is the date when streak was won 8? | CREATE TABLE table_name_50 (date VARCHAR,streak VARCHAR) | SELECT date FROM table_name_50 WHERE streak = "won 8" |
What is the score when TSV Siegen was the runner-up? | CREATE TABLE table_name_59 (score VARCHAR,runners_up VARCHAR) | SELECT score FROM table_name_59 WHERE runners_up = "tsv siegen" |
get SATURDAY fares from WASHINGTON to BOSTON | CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,saturday_stay_required text,minimum_stay int,maximum_stay int,application text,no_discounts text)CREATE TABLE compartment_class (compart... | SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND DAYS_1.day_name = ... |
Which player is in the position of Guard/Forward? | CREATE TABLE table_name_67 (name VARCHAR,position VARCHAR) | SELECT name FROM table_name_67 WHERE position = "guard/forward" |
What was the average value for Fall 07 when Fall 09 is less than 296? | CREATE TABLE table_name_99 (fall_07 INTEGER,fall_09 INTEGER) | SELECT AVG(fall_07) FROM table_name_99 WHERE fall_09 < 296 |
what is the number of patients whose admission location is clinic referral/premature and primary disease is aortic valve insuffiency\aortic valve replacement /sda? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethni... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" |
How many gold medals for the school with less than 1 total? | CREATE TABLE table_name_43 (gold_medals VARCHAR,total_medals INTEGER) | SELECT COUNT(gold_medals) FROM table_name_43 WHERE total_medals < 1 |
calculate the minimum age of patients who were hospitalized for 23 days and were discharged to skilled nursing facility. | 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)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime te... | SELECT MIN(demographic.age) FROM demographic WHERE demographic.discharge_location = "SHORT TERM HOSPITAL" AND demographic.days_stay = "23" |
What's the leader team in the Trofeo Fast Team in stage 20? | CREATE TABLE table_17563 ("Stage" text,"Winner" text,"General classification" text,"Points classification" text,"Mountains classification" text,"Young rider classification" text,"Intergiro classification" text,"Trofeo Fast Team" text) | SELECT "Trofeo Fast Team" FROM table_17563 WHERE "Stage" = '20' |
count the number of patients whose days of hospital stay is greater than 14 and diagnoses short title is noninf gastroenterit nec? | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "14" AND diagnoses.short_title = "Noninf gastroenterit NEC" |
what is the model of the only utility vehicle used by the philippine marines that has its origin in the united kingdom ? | CREATE TABLE table_204_295 (id number,"model" text,"origin" text,"type" text,"version" text,"in service" number,"notes" text) | SELECT "model" FROM table_204_295 WHERE "origin" = 'united kingdom' |
What is the number of inpatient hospital admission patients who are less than 59 years old? | 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 (subject_id text,hadm_id text,name text,marital_status text,age text,dob... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.age < "59" |
For each team, how many technicians are there? | CREATE TABLE repair_assignment (technician_id number,repair_id number,machine_id number)CREATE TABLE technician (technician_id number,name text,team text,starting_year number,age number)CREATE TABLE repair (repair_id number,name text,launch_date text,notes text)CREATE TABLE machine (machine_id number,making_year number... | SELECT team, COUNT(*) FROM technician GROUP BY team |
What clubs had 608 points against? | CREATE TABLE table_1676073_12 (club VARCHAR,points_against VARCHAR) | SELECT club FROM table_1676073_12 WHERE points_against = "608" |
Answers with references to Wikipedia by user. Returns all answers by chosen user that have 'en.wikipedia.org/wiki' in them somewhere. | CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,In... | SELECT A.Id AS "post_link", A.CreationDate AS "answer_date" FROM Posts AS A WHERE A.PostTypeId = 2 AND (A.Body LIKE '%en.m.wikipedia.org/wiki%') ORDER BY 'answer_date' DESC |
What year did she compete in tampere, finland? | CREATE TABLE table_71931 ("Year" real,"Competition" text,"Venue" text,"Position" text,"Event" text) | SELECT AVG("Year") FROM table_71931 WHERE "Venue" = 'tampere, finland' |
The 546 class - how big is it ? | CREATE TABLE student_record (student_id int,course_id int,semester int,grade varchar,how varchar,transfer_source varchar,earn_credit varchar,repeat_term varchar,test_id varchar)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE program_course (program_id int,course_id int,workload int,categ... | SELECT DISTINCT num_enrolled FROM course WHERE department = 'EECS' AND number = 546 |
How many years did Real Colorado Foxes make it to the Open Cup 1st Round? | CREATE TABLE table_8384 ("Year" real,"Division" real,"League" text,"Regular Season" text,"Playoffs" text,"Open Cup" text) | SELECT COUNT("Year") FROM table_8384 WHERE "Open Cup" = '1st round' |
give me the number of patients whose death status is 0 and lab test name is hematocrit, other fluid? | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.expire_flag = "0" AND lab.label = "Hematocrit, Other Fluid" |
Which Adelaide has a Melbourne of yes, an Auckland of yes, and a Perth of yes? | CREATE TABLE table_68016 ("Sydney" text,"Melbourne" text,"Perth" text,"Adelaide" text,"Gold Coast" text,"Auckland" text) | SELECT "Adelaide" FROM table_68016 WHERE "Melbourne" = 'yes' AND "Auckland" = 'yes' AND "Perth" = 'yes' |
how long was thomas stouch coach ? | CREATE TABLE table_203_577 (id number,"tenure" text,"coach" text,"years" number,"record" text,"pct." number) | SELECT "years" FROM table_203_577 WHERE "coach" = 'thomas stouch' |
How many laps did the grid 1 engine have? | CREATE TABLE table_name_96 (laps INTEGER,time_retired VARCHAR,grid VARCHAR) | SELECT SUM(laps) FROM table_name_96 WHERE time_retired = "engine" AND grid = 1 |
Which club plays soccer in the nwsl? | CREATE TABLE table_name_61 (club VARCHAR,sport VARCHAR,league VARCHAR) | SELECT club FROM table_name_61 WHERE sport = "soccer" AND league = "nwsl" |
What was the teams record when they played the ottawa senators? | CREATE TABLE table_3784 ("Game" real,"February" real,"Opponent" text,"Score" text,"Location/Attendance" text,"Record" text,"Points" real) | SELECT "Record" FROM table_3784 WHERE "Opponent" = 'Ottawa Senators' |
which senior advisor is after pete rouse ? | CREATE TABLE table_204_598 (id number,"name" text,"state of residence" text,"took office" text,"left office" text,"president served under" text) | SELECT "name" FROM table_204_598 WHERE "took office" > (SELECT "took office" FROM table_204_598 WHERE "name" = 'pete rouse') ORDER BY "took office" LIMIT 1 |
Find the name of companies whose revenue is between 100 and 150. | CREATE TABLE manufacturers (name VARCHAR,revenue INTEGER) | SELECT name FROM manufacturers WHERE revenue BETWEEN 100 AND 150 |
since 2105 what were the top four most frequent diagnoses that patients were given within the same month after receiving umbilical vein cath? | CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE outputevents (row_id number,subject_id nu... | SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissi... |
What is the average Game, when Date is 'December 23'? | CREATE TABLE table_76591 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT AVG("Game") FROM table_76591 WHERE "Date" = 'december 23' |
What was the minimum population in 2011? | CREATE TABLE table_25852 ("Mother Tongue" text,"Population (2006)" real,"Percentage (2006)" text,"Population (2011)" real,"Percentage (2011)" text) | SELECT MIN("Population (2011)") FROM table_25852 |
What team was the opponent when the score was 25-0? | CREATE TABLE table_14423 ("Date" text,"Opponent" text,"City" text,"Result" text,"Score" text) | SELECT "Opponent" FROM table_14423 WHERE "Score" = '25-0' |
how long was there between tarpan seasons and antologie ? | CREATE TABLE table_204_529 (id number,"year" number,"personnel" text,"album" text,"label" text,"peak positions\nnor" number) | SELECT ABS((SELECT "year" FROM table_204_529 WHERE "album" = 'tarpan seasons') - (SELECT "year" FROM table_204_529 WHERE "album" = 'antologie')) |
When 1462/63 was the elected what was the no.? | CREATE TABLE table_1847 ("No." text,"Summoned" text,"Elected" text,"Assembled" text,"Dissolved" text,"1st member" text,"2nd member" text) | SELECT "No." FROM table_1847 WHERE "Elected" = '1462/63' |
when was the last time that patient 73155 was prescribed with insulin during their last hospital encounter? | CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE inputevents_cv (row_id nu... | SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73155 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND prescriptions.drug = 'insulin' ORDER BY prescriptions.startdate DESC LIMIT ... |
What is the League Cup for 1947 1958? | CREATE TABLE table_7346 ("Name" text,"Years" text,"League a" text,"FA Cup" text,"League Cup" text,"Other b" text,"Total" text) | SELECT "League Cup" FROM table_7346 WHERE "Years" = '1947–1958' |
What province in Tumbes has less than 11 districts and a UBIGEO of 2401? | CREATE TABLE table_48661 ("Province" text,"Region" text,"Capital" text,"Districts" real,"UBIGEO" real) | SELECT "Province" FROM table_48661 WHERE "Districts" < '11' AND "Region" = 'tumbes' AND "UBIGEO" = '2401' |
What score has won as the result on the date of December 14, 2004? | CREATE TABLE table_14739 ("Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text) | SELECT "Score" FROM table_14739 WHERE "Result" = 'won' AND "Date" = 'december 14, 2004' |
For those employees who did not have any job in the past, what is the relationship between employee_id and commission_pct ? | 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 decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE ... | SELECT EMPLOYEE_ID, COMMISSION_PCT FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) |
what is the number of hours since patient 017-88691 had their first procedure in this hospital encounter? | CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid n... | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-88691... |
What is the highest Rank, when Director is 'Henry Hathaway'? | CREATE TABLE table_name_63 (rank INTEGER,director VARCHAR) | SELECT MAX(rank) FROM table_name_63 WHERE director = "henry hathaway" |
count the number of patients whose primary disease is abdominal pain and age is less than 68? | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ABDOMINAL PAIN" AND demographic.age < "68" |
Who was the opponent when the score was 6 4, 6 7 (2 7) , 7 5? | CREATE TABLE table_10684 ("Date" text,"Tournament" text,"Surface" text,"Opponent" text,"Score" text) | SELECT "Opponent" FROM table_10684 WHERE "Score" = '6–4, 6–7 (2–7) , 7–5' |
What is the sum of the erp w of the k222al call sign? | CREATE TABLE table_name_5 (erp_w INTEGER,call_sign VARCHAR) | SELECT SUM(erp_w) FROM table_name_5 WHERE call_sign = "k222al" |
\\ bug query on markdown. with bits stolen from http://data.stackexchange.com/stackoverflow/query/494264/longest-answers-by-markdown | CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,OwnerUserId number,Comment text,Text text,Title text,Tags text,RevisionGUID other)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId numbe... | SELECT p.Id AS "post_link", 'site://posts/' + CAST(p.Id AS TEXT) + '/edit|' + 'Edit' AS "edit_link", p.OwnerUserId AS "user_link", p.CreationDate FROM Posts AS p, PostHistory AS ph WHERE ph.PostId = p.Id AND ph.PostHistoryTypeId IN (2, 5, 8) AND NOT EXISTS(SELECT * FROM PostHistory AS phtwo WHERE phtwo.PostId = p.Id AN... |
provide the number of patients whose procedure long title is intraoperative cardiac pacemaker and lab test category is chemistry? | 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 text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Intraoperative cardiac pacemaker" AND lab."CATEGORY" = "Chemistry" |
which is the only company to have under 10 % arms sales as share of company 's total sales ? | CREATE TABLE table_204_681 (id number,"2011 rank" number,"2010 rank" number,"2009 rank" number,"2008 rank" number,"2007 rank" number,"company (country)" text,"2011 arms sales (us$ m.)" number,"2010 arms sales (us$ m.)" number,"2009 arms sales (us$ m.)" number,"2008 arms sales (us$ m.)" number,"2007 arms sales (us$ m.)"... | SELECT "company (country)" FROM table_204_681 WHERE "arms sales as share of company's total sales (%)," < 10 |
What is the highest goal difference that the club with 33-5 points and less than 12 wins? | CREATE TABLE table_14735 ("Position" real,"Club" text,"Played" real,"Points" text,"Wins" real,"Draws" real,"Losses" real,"Goals for" real,"Goals against" real,"Goal Difference" real) | SELECT MAX("Goal Difference") FROM table_14735 WHERE "Points" = '33-5' AND "Wins" < '12' |
Name the least lost | CREATE TABLE table_21991074_3 (lost INTEGER) | SELECT MIN(lost) FROM table_21991074_3 |
What was the highest number of goals when 2428 minutes were played? | CREATE TABLE table_name_91 (goals INTEGER,minutes VARCHAR) | SELECT MAX(goals) FROM table_name_91 WHERE minutes = 2428 |
provide the number of patients whose insurance is self pay and lab test name is c-reactive protein? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Self Pay" AND lab.label = "C-Reactive Protein" |
Draw a pie chart for what are the proportion of the teams in elimination? | CREATE TABLE Elimination (Elimination_ID text,Wrestler_ID text,Team text,Eliminated_By text,Elimination_Move text,Time text)CREATE TABLE wrestler (Wrestler_ID int,Name text,Reign text,Days_held text,Location text,Event text) | SELECT Team, COUNT(Team) FROM Elimination GROUP BY Team |
What is the least number of miss united continents? | CREATE TABLE table_21792 ("Rank" real,"Country" text,"Miss United Continent" real,"Virreina" real,"1st RU" real,"2nd RU" real,"3rd RU" real,"4th RU" real,"Semifinalists" real,"Total" real) | SELECT MIN("Miss United Continent") FROM table_21792 |
what is patient 18726's insurance plan in the last hospital encounter. | CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE inputevents_cv (row_id number,s... | SELECT admissions.insurance FROM admissions WHERE admissions.subject_id = 18726 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1 |
What is the lowest total GFR that has 95.80% of the population as Whites, and a TFR total larger than 2.14, in 2006? | CREATE TABLE table_70053 ("County" text,"Live births 2006" real,"GFR 2006" real,"TFR 2006" real,"Whites as % of Pop." text) | SELECT MIN("GFR 2006") FROM table_70053 WHERE "Whites as % of Pop." = '95.80%' AND "TFR 2006" > '2.14' |
Who was asked 20 questions in the issue where the cover model is Linda Brava? | CREATE TABLE table_20233 ("Date" text,"Cover model" text,"Centerfold model" text,"Interview subject" text,"20 Questions" text,"Pictorials" text) | SELECT "20 Questions" FROM table_20233 WHERE "Cover model" = 'Linda Brava' |
Name the record for october 11 | CREATE TABLE table_name_34 (record VARCHAR,date VARCHAR) | SELECT record FROM table_name_34 WHERE date = "october 11" |
english ( wumc ) or spanish speaking ( dh ) | CREATE TABLE table_train_256 ("id" int,"mini_mental_state_examination_mmse" int,"language" string,"mild_cognitive_impairment" bool,"moca_score" int,"dementia" bool,"body_mass_index_bmi" float,"age" float,"NOUSE" float) | SELECT * FROM table_train_256 WHERE language = 'english' OR language = 'spanish' |
Who was the visiting team at the game where Edmonton was the home team and the decision was Osgood? | CREATE TABLE table_name_98 (visitor VARCHAR,decision VARCHAR,home VARCHAR) | SELECT visitor FROM table_name_98 WHERE decision = "osgood" AND home = "edmonton" |
Name the first elected for alabama 3 | CREATE TABLE table_25030512_4 (first_elected VARCHAR,district VARCHAR) | SELECT COUNT(first_elected) FROM table_25030512_4 WHERE district = "Alabama 3" |
Runs smaller than 6106, and Inns smaller than 146 has what total number of matches? | CREATE TABLE table_name_24 (matches VARCHAR,runs VARCHAR,inns VARCHAR) | SELECT COUNT(matches) FROM table_name_24 WHERE runs < 6106 AND inns < 146 |
On which date was the game where the home teams score was 22.15 (147), and the away teams score was 9.8 (62) | CREATE TABLE table_53520 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Date" FROM table_53520 WHERE "Home team score" = '22.15 (147)' AND "Away team score" = '9.8 (62)' |
What was the year when West Manila has a tariff increase of 6.5? | CREATE TABLE table_21480 ("Year" real,"West Manila" text,"East Manila" text,"Consumer Price Index (2005=100)" text,"West Manila as a share of 1996 real tariff" text,"East Manila as a share of 1996 real tariff" text) | SELECT "Year" FROM table_21480 WHERE "West Manila" = '6.5' |
What is the mean on-site ATMS that have off-site ATMs of 1567, and the total number of ATMs less than 4772? | CREATE TABLE table_43964 ("Bank type" text,"Number of branches" real,"On-site ATMs" real,"Off-site ATMs" real,"Total ATMs" real) | SELECT AVG("On-site ATMs") FROM table_43964 WHERE "Off-site ATMs" = '1567' AND "Total ATMs" < '4772' |
What date is aston villa away? | CREATE TABLE table_43536 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text) | SELECT "Date" FROM table_43536 WHERE "Away team" = 'aston villa' |
How many conversions had 0 pens and 0 tries? | CREATE TABLE table_name_39 (conv VARCHAR,pens VARCHAR,tries VARCHAR) | SELECT conv FROM table_name_39 WHERE pens = "0" AND tries = "0" |
How many players played each position. Show a pie chart. | CREATE TABLE match_season (Season real,Player text,Position text,Country int,Team int,Draft_Pick_Number int,Draft_Class text,College text)CREATE TABLE player (Player_ID int,Player text,Years_Played text,Total_WL text,Singles_WL text,Doubles_WL text,Team int)CREATE TABLE team (Team_id int,Name text)CREATE TABLE country ... | SELECT Position, COUNT(*) FROM match_season GROUP BY Position |
What was the Final Score on February 24, 2002? | CREATE TABLE table_name_21 (score_in_final VARCHAR,date VARCHAR) | SELECT score_in_final FROM table_name_21 WHERE date = "february 24, 2002" |
What is the format of the date February 14, 2002? | CREATE TABLE table_name_53 (format VARCHAR,date VARCHAR) | SELECT format FROM table_name_53 WHERE date = "february 14, 2002" |
count the number of patients who are diagnosed with severe sepsis and have pb route of drug administration. | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Severe sepsis" AND prescriptions.route = "PB" |
what is an insurance plan for patient 138 in the first hospital visit? | CREATE TABLE d_icd_diagnoses (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 icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid numbe... | SELECT admissions.insurance FROM admissions WHERE admissions.subject_id = 138 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1 |
What is the 2009 value with lq in 2012, 2r in 2011, and lq in 2008? | CREATE TABLE table_61449 ("Tournament" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text) | SELECT "2009" FROM table_61449 WHERE "2012" = 'lq' AND "2011" = '2r' AND "2008" = 'lq' |
[draft] Questions with no up-voted or down-voted answers. | CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE Sugg... | SELECT DISTINCT * FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id WHERE q.PostTypeId = 1 AND a.PostTypeId = 2 AND a.DeletionDate IS NULL AND q.ClosedDate IS NULL AND q.AnswerCount >= '##numOfAnswers?1##' |
What was the date of the game attended by 45,122? | CREATE TABLE table_name_39 (date VARCHAR,attendance VARCHAR) | SELECT date FROM table_name_39 WHERE attendance = "45,122" |
what was the only single released in 1993 ? | CREATE TABLE table_204_56 (id number,"year" number,"song" text,"us r&b" number,"us rap" number,"album" text) | SELECT "song" FROM table_204_56 WHERE "year" = 1993 |
What is the highest 2nd in (m) that has a Rank more than 2 and Points more than 249.3 | CREATE TABLE table_name_14 (rank VARCHAR,points VARCHAR) | SELECT MAX(2 AS nd__m_) FROM table_name_14 WHERE rank > 2 AND points > 249.3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.