instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
what is the number of patients whose marital status is married and admission year is less than 2200?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.admityear < "2200"
what is the cost of a flight from BOSTON to DENVER
CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE fare_basis (fare_basis_code text,booking_class text,class_type text,premium text,economy text,discounted text,night text,season text,basis_days text)CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE ...
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, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_...
What was the started round for the competition that had the last match on January 16, 2008?
CREATE TABLE table_name_57 (started_round VARCHAR,last_match VARCHAR)
SELECT started_round FROM table_name_57 WHERE last_match = "january 16, 2008"
Name the chairman for iker casillas
CREATE TABLE table_29398373_2 (chairman VARCHAR,captain VARCHAR)
SELECT chairman FROM table_29398373_2 WHERE captain = "Iker Casillas"
when did patient 028-55868 first have the maximum systemicdiastolic value?
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,c...
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-55868')) AND NOT vitalperiodic.systemicdiastoli...
Which home team had an away team of Reading?
CREATE TABLE table_48031 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text)
SELECT "Home team" FROM table_48031 WHERE "Away team" = 'reading'
What is the aggregate for the tie with a team 2 of Irtysh?
CREATE TABLE table_name_58 (agg VARCHAR,team_2 VARCHAR)
SELECT agg FROM table_name_58 WHERE team_2 = "irtysh"
How many teams have 7th position?
CREATE TABLE table_2543 ("Season" real,"Series" text,"Team" text,"Races" real,"Wins" real,"Poles" real,"F/Laps" real,"Podiums" real,"Points" text,"Position" text)
SELECT COUNT("Team") FROM table_2543 WHERE "Position" = '7th'
what is the abbreviation D10
CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE code_description (code varchar,description text)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,r...
SELECT DISTINCT aircraft_code FROM aircraft WHERE aircraft_code = 'D10'
Who are all the players with 156 rebounds?
CREATE TABLE table_25374 ("Player" text,"Games Played" real,"Minutes" real,"Field Goals" real,"Three Pointers" real,"Free Throws" real,"Rebounds" real,"Assists" real,"Blocks" real,"Steals" real,"Points" real)
SELECT "Player" FROM table_25374 WHERE "Rebounds" = '156'
Which Date has a Road Team of chicago, and a Result of 88-85 (ot)?
CREATE TABLE table_name_33 (date VARCHAR,road_team VARCHAR,result VARCHAR)
SELECT date FROM table_name_33 WHERE road_team = "chicago" AND result = "88-85 (ot)"
What is the download of the varies catch-up period?
CREATE TABLE table_78802 ("Service name" text,"Owner" text,"Catch-up period" text,"Streamed" text,"Download" text,"Technology" text)
SELECT "Download" FROM table_78802 WHERE "Catch-up period" = 'varies'
That stupid windows clock question.
CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE Review...
SELECT vt.Name, COUNT(pf.VoteTypeId) FROM PostFeedback AS pf INNER JOIN VoteTypes AS vt ON pf.VoteTypeId = vt.Id WHERE pf.PostId = 19051750 AND pf.IsAnonymous = 'true' AND vt.Name = '##UpDownMod:string?UpMod##' GROUP BY pf.VoteTypeId, vt.Name
give the number of patients who primarily came for chest pain and stayed in the hospital for more than 2 days.
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 WHERE demographic.diagnosis = "CHEST PAIN" AND demographic.days_stay > "2"
how many hours since the first cardiac tamponade diagnosis of patient 10624 in the current hospital visit?
CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icust...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', diagnoses_icd.charttime)) FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'cardiac tamponade') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admission...
What was the original air date of the episode 'nano nits'?
CREATE TABLE table_25689 ("Episode Number" text,"Title" text,"Villains" text,"Director" text,"Writer" text,"Original airdate" text)
SELECT "Original airdate" FROM table_25689 WHERE "Title" = 'Nano Nits'
What 2006 has 1r as the 2007?
CREATE TABLE table_name_74 (Id VARCHAR)
SELECT 2006 FROM table_name_74 WHERE 2007 = "1r"
what is the first flight after 1200 from WASHINGTON for DENVER
CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE ground_service (city_code text,airport_code text,transport_type text,ground_fare int)CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time int,connections int,departure_time int,dual_carrier text,flight_d...
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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND flight.departure_time > 1200 AND flight.to_airport = AIRPORT_SERVICE_1.airpo...
What is the total number of field goals a player had when there were more than 0 extra points and there were 5 touchdowns?
CREATE TABLE table_name_6 (field_goals VARCHAR,extra_points VARCHAR,touchdowns VARCHAR)
SELECT COUNT(field_goals) FROM table_name_6 WHERE extra_points > 0 AND touchdowns = 5
What is the total number of Wins when 98 is the rank and the scoring average is more than 73.52?
CREATE TABLE table_name_54 (wins VARCHAR,rank VARCHAR,scoring_average VARCHAR)
SELECT COUNT(wins) FROM table_name_54 WHERE rank = "98" AND scoring_average > 73.52
What is the total for the player with more snatches than 87.5 and bodyweight more than 74.8?
CREATE TABLE table_name_7 (total__kg_ INTEGER,snatch VARCHAR,bodyweight VARCHAR)
SELECT AVG(total__kg_) FROM table_name_7 WHERE snatch > 87.5 AND bodyweight > 74.8
find the maximum days of hospital stay for patients who were admitted in or after the year 2184.
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 text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id tex...
SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.admityear >= "2184"
Find all suggested edits made by a user.
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE VoteTypes (Id number,Name...
SELECT Id, PostId AS "post_link", CreationDate, ApprovalDate, RejectionDate, Comment FROM SuggestedEdits WHERE OwnerUserId = '##UserId##'
Bar chart of how many openning year from each openning year, and display by the the number of openning year from high to low.
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 cinema (Cinema_ID int,Name text,Openning_year int,Capacity int,Location text)CREATE TABLE schedule (Cinema_ID int,Film_ID int,Date text,Show_times_per_day int,Price...
SELECT Openning_year, COUNT(Openning_year) FROM cinema GROUP BY Openning_year ORDER BY COUNT(Openning_year) DESC
Who was nominated for outstanding director of a musical?
CREATE TABLE table_name_30 (nominee VARCHAR,category VARCHAR)
SELECT nominee FROM table_name_30 WHERE category = "outstanding director of a musical"
Count of new user registrations by month. It shows the stats only until the last completely dumped month to the SEDE.
CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,P...
SELECT DATEFROMPARTS(TIME_TO_STR(CreationDate, '%Y'), TIME_TO_STR(CreationDate, '%M'), 1) AS Month, COUNT(*) AS Count FROM Users WHERE CreationDate < @TsNow GROUP BY DATEFROMPARTS(TIME_TO_STR(CreationDate, '%Y'), TIME_TO_STR(CreationDate, '%M'), 1) ORDER BY Month
how tall -lrb- in meters -rrb- is the tallest building ?
CREATE TABLE table_204_489 (id number,"rank" number,"name" text,"height" text,"floors" number,"year" number,"notes" text)
SELECT "height" FROM table_204_489 ORDER BY "height" DESC LIMIT 1
What rank did Myleene Klass finish?
CREATE TABLE table_6583 ("Celebrity" text,"Famous for" text,"Entered" text,"Exited" text,"Finished" text)
SELECT "Finished" FROM table_6583 WHERE "Celebrity" = 'myleene klass'
Who is directed by when 'fade' is the title?
CREATE TABLE table_30650 ("No." real,"#" real,"Title" text,"Directed by" text,"Written by" text,"U.S. air date" text,"Production code" text,"U.S. viewers (million)" text)
SELECT "Directed by" FROM table_30650 WHERE "Title" = 'Fade'
please list the flights leaving from ST. LOUIS to ST. PAUL after 1000
CREATE TABLE fare_basis (fare_basis_code text,booking_class text,class_type text,premium text,economy text,discounted text,night text,season text,basis_days text)CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE equipment_sequence (aircraft_code_sequence varchar,aircraft_code varchar)CRE...
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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ST. PAUL' AND flight.departure_time > 1000 AND flight.to_airport = AIRPORT_SERVICE_1.airp...
how many patients were diagnosed with acute renal failure who did not return to the hospital within 2 months in this year?
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 medication (medicationid number,patientunitstayid number,drugname text,dosage text...
SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'acute renal failure' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(...
how many patients were diagnosed with end stage renal disease and they didn't come back to the hospital within 2 months until 2 years ago?
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 transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE ...
SELECT (SELECT COUNT(DISTINCT t1.subject_id) 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_diagnoses.short_title = 'end stage ...
what is the number of patients whose admission location is clinic referral/premature and procedure icd9 code is 46?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND procedures.icd9_code = "46"
how many awards total was scrubs nominated for ?
CREATE TABLE table_203_482 (id number,"year" number,"award" text,"result" text,"category" text,"series" text)
SELECT COUNT("award") FROM table_203_482
how many teams were founded in morwell ?
CREATE TABLE table_203_664 (id number,"club" text,"town" text,"founded" number,"nickname" text,"colours" text,"home ground" text,"titles" number,"website" text)
SELECT COUNT("club") FROM table_203_664 WHERE "town" = 'morwell'
How many codes have a density of 621.68, and a Land area (hectares) larger than 75.28?
CREATE TABLE table_name_24 (code INTEGER,density__inh_km²_ VARCHAR,land_area__hectares_ VARCHAR)
SELECT SUM(code) FROM table_name_24 WHERE density__inh_km²_ = 621.68 AND land_area__hectares_ > 75.28
whats the sex of patient 22315?
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 TABLE d_items (row_id number,itemid number,label text,linksto text)C...
SELECT patients.gender FROM patients WHERE patients.subject_id = 22315
WHAT IS THE TEAM WITH AN OF POSITION AND PICK OF 24?
CREATE TABLE table_name_93 (team VARCHAR,position VARCHAR,pick VARCHAR)
SELECT team FROM table_name_93 WHERE position = "of" AND pick = 24
what was the first time a drug was prescribed for patient 006-158338 on their current hospital visit?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatment...
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 = '006-158338' AND patient.hospitaldischargetime IS NULL)) ORDER ...
find out the number of patients diagnosed with chronic diastolic heart failure who had emergency admission.
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.long_title = "Chronic diastolic heart failure"
what would be the maximum daily number of patients diagnosed with acute renal failure - due to hypovolemia/decreased circulating volume in the previous year?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,...
SELECT MAX(t1.c1) FROM (SELECT COUNT(DISTINCT diagnosis.patientunitstayid) AS c1 FROM diagnosis WHERE diagnosis.diagnosisname = 'acute renal failure - due to hypovolemia/decreased circulating volume' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY S...
What is the average Start term with a 1912 end term?
CREATE TABLE table_52676 ("Name" text,"Title" text,"Start term" real,"End term" real,"House" text)
SELECT AVG("Start term") FROM table_52676 WHERE "End term" = '1912'
did any clubs have no losses ?
CREATE TABLE table_203_145 (id number,"position" number,"club" text,"played" number,"points" text,"wins" number,"draws" number,"losses" number,"goals for" number,"goals against" number,"goal difference" number)
SELECT (SELECT COUNT("club") FROM table_203_145 WHERE "losses" = 0) > 0
how many days have it been since the first time patient 035-24054 has had the oral intake on the current icu visit?
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,c...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', intakeoutput.intakeoutputtime)) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid =...
If Podiums is 2 and F/Laps are 2, what are the wins?
CREATE TABLE table_name_80 (wins VARCHAR,podiums VARCHAR,f_laps VARCHAR)
SELECT wins FROM table_name_80 WHERE podiums = "2" AND f_laps = "2"
What year were outputs is 2x pro bias, rca loop out and notes is vacuum tube released?
CREATE TABLE table_25276250_3 (release_year VARCHAR,outputs VARCHAR,notes VARCHAR)
SELECT release_year FROM table_25276250_3 WHERE outputs = "2x Pro Bias, RCA Loop Out" AND notes = "Vacuum tube"
what tournament had sam querrey as the opponent?
CREATE TABLE table_name_51 (tournament VARCHAR,opponent VARCHAR)
SELECT tournament FROM table_name_51 WHERE opponent = "sam querrey"
Which Event has a Year of 1986?
CREATE TABLE table_42876 ("Year" real,"Competition" text,"Venue" text,"Position" text,"Event" text,"Notes" text)
SELECT "Event" FROM table_42876 WHERE "Year" = '1986'
What is the record of the team that lost to Alexander (5-2)?
CREATE TABLE table_68601 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" text,"Record" text)
SELECT "Record" FROM table_68601 WHERE "Loss" = 'alexander (5-2)'
Name the city with september of 83 f / 28.3 c
CREATE TABLE table_name_15 (city VARCHAR,sep VARCHAR)
SELECT city FROM table_name_15 WHERE sep = "83 °f / 28.3 °c"
what is the maximum daily number of patients with thrombot microangiopathy diagnosed until 2104?
CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)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 labevents (row_id number,subject_id number,hadm_id number,itemid ...
SELECT MAX(t1.c1) FROM (SELECT COUNT(DISTINCT diagnoses_icd.hadm_id) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'thrombot microangiopathy') AND STRFTIME('%y', diagnoses_icd.charttime) <= '2104' GROUP BY STRFTIME('%y...
Who lost at schaefer stadium when the Winner was new england patriots, and a Date of october 18?
CREATE TABLE table_36643 ("Year" real,"Date" text,"Winner" text,"Result" text,"Loser" text,"Location" text)
SELECT "Loser" FROM table_36643 WHERE "Location" = 'schaefer stadium' AND "Winner" = 'new england patriots' AND "Date" = 'october 18'
What is the average event for the Open Championship Tournament, and a Top-5 less than 1?
CREATE TABLE table_name_18 (events INTEGER,tournament VARCHAR,top_5 VARCHAR)
SELECT AVG(events) FROM table_name_18 WHERE tournament = "the open championship" AND top_5 < 1
which player is the oldest ?
CREATE TABLE table_204_883 (id number,"pos." text,"name" text,"place of birth" text,"date of birth" text,"previous club" text,"date joined" text,"fee" text)
SELECT "name" FROM table_204_883 ORDER BY "date of birth" LIMIT 1
What is the Date of the Tournament with a Winning score of 9 (65-71-68-67=271)?
CREATE TABLE table_name_55 (date VARCHAR,winning_score VARCHAR)
SELECT date FROM table_name_55 WHERE winning_score = −9(65 - 71 - 68 - 67 = 271)
My favorites URL on Meta.
CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLi...
SELECT url = 'https://physics.meta.stackexchange.com/questions/' + CAST(q.Id AS TEXT) FROM Votes AS v INNER JOIN Posts AS q ON v.PostId = q.Id WHERE VoteTypeId = 5 AND UserId = '##UserId##' ORDER BY q.Id DESC
What is the highest total cargo of an airport ranked larger than 19 with a code of BKK/VTBS?
CREATE TABLE table_name_18 (total_cargo__metric_tonnes_ INTEGER,code__iata_icao_ VARCHAR,rank VARCHAR)
SELECT MAX(total_cargo__metric_tonnes_) FROM table_name_18 WHERE code__iata_icao_ = "bkk/vtbs" AND rank > 19
What driver raced for more than 9 laps on grid 7?
CREATE TABLE table_53109 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Driver" FROM table_53109 WHERE "Laps" > '9' AND "Grid" = '7'
What shows for 2010 when 2005 shows 1r?
CREATE TABLE table_42649 ("Tournament" text,"2002" text,"2003" text,"2004" text,"2005" text,"2006" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text)
SELECT "2010" FROM table_42649 WHERE "2005" = '1r'
Pink cytoplasm is seen in a test that specifically stains what?
CREATE TABLE table_814 ("Stain" text,"Common use" text,"Nucleus" text,"Cytoplasm" text,"Red blood cell (RBC)" text,"Collagen fibers" text,"Specifically stains" text)
SELECT "Specifically stains" FROM table_814 WHERE "Cytoplasm" = 'Pink'
Who does the lap-by-lap in 2011?
CREATE TABLE table_16267 ("Year" real,"Network" text,"Host" text,"Pre-race analyst" text,"Lap-by-lap" text,"Color commentator(s)" text,"Pit reporters" text)
SELECT "Lap-by-lap" FROM table_16267 WHERE "Year" = '2011'
what is the minimum hospital cost for a drug with a name called nacl 0.9% bolus until 2 years ago?
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,heartrate number,respiration number,systemicsystolic number,syst...
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'nacl 0.9% bolus')) AND DATETIME(cost.chargetim...
how much is the change of patient 018-47575's hct last measured on the first hospital visit compared to the first value measured on the first hospital visit?
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 microlab (microlabid number,patientunitstayid number,culturesite text,orga...
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 = '018-47575' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi...
what is the number of patients whose primary disease is gastrointestinal bleed?
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 WHERE demographic.diagnosis = "GASTROINTESTINAL BLEED"
provide the number of patients whose death status is 1 and lab test name is lactate dehydrogenase, pleural?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.expire_flag = "1" AND lab.label = "Lactate Dehydrogenase, Pleural"
what is the highest gold when the rank is 12 for the nation vietnam?
CREATE TABLE table_name_18 (gold INTEGER,rank VARCHAR,nation VARCHAR)
SELECT MAX(gold) FROM table_name_18 WHERE rank = "12" AND nation = "vietnam"
What is the most common company type, and how many are there?
CREATE TABLE operate_company (TYPE VARCHAR)
SELECT TYPE, COUNT(*) FROM operate_company GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1
how much is the average hospital cost involving cultures - bal/pbs since 2102?
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,...
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'cultures - bal/pbs')) AND STRFTIME('%y', cos...
Draw a bar chart about the distribution of Nationality and the amount of Nationality , and group by attribute Nationality.
CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year int)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time text)CREATE TABLE event (ID int,Name text,Stadium_ID int,Year ...
SELECT Nationality, COUNT(Nationality) FROM swimmer GROUP BY Nationality
what is the number of office admission patients who were admitted in hospital before 2111?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.admityear < "2111"
provide the number of patients whose days of hospital stay is greater than 8 and drug name is acetylcysteine 20%?
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 text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "8" AND prescriptions.drug = "Acetylcysteine 20%"
Draw a bar chart about the distribution of All_Home and the sum of Team_ID , and group by attribute All_Home, and I want to show from high to low by the All_Home.
CREATE TABLE basketball_match (Team_ID int,School_ID int,Team_Name text,ACC_Regular_Season text,ACC_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Percent int,All_Home text,All_Road text,All_Neutral text)CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,En...
SELECT All_Home, SUM(Team_ID) FROM basketball_match GROUP BY All_Home ORDER BY All_Home DESC
What is the position of club Melilla CF, with a goal difference smaller than -10?
CREATE TABLE table_name_63 (position INTEGER,club VARCHAR,goal_difference VARCHAR)
SELECT SUM(position) FROM table_name_63 WHERE club = "melilla cf" AND goal_difference < -10
Name the venue for margin less than 66 and opponent of north queensland cowboys
CREATE TABLE table_name_60 (venue VARCHAR,margin VARCHAR,opponent VARCHAR)
SELECT venue FROM table_name_60 WHERE margin < 66 AND opponent = "north queensland cowboys"
Which FA Cup is the highest one that has a Malaysia Cup of 0, and a Player of ahmad fouzee masuri, and a Total larger than 0?
CREATE TABLE table_name_25 (fa_cup INTEGER,total VARCHAR,malaysia_cup VARCHAR,player VARCHAR)
SELECT MAX(fa_cup) FROM table_name_25 WHERE malaysia_cup = 0 AND player = "ahmad fouzee masuri" AND total > 0
What is the Republican seat plurality of the state with a ratio of 12/4 Republicans to Democrats?
CREATE TABLE table_67120 ("State ranked in partisan order" text,"Percentage Republicans" text,"Percentage Democrats" text,"Republican/ Democratic" text,"Republican seat plurality" text)
SELECT "Republican seat plurality" FROM table_67120 WHERE "Republican/ Democratic" = '12/4'
What is the coverage when power kw is 25kw?
CREATE TABLE table_26390 ("Branding" text,"Callsign" text,"Frequency" text,"Power kW" text,"Coverage" text)
SELECT "Coverage" FROM table_26390 WHERE "Power kW" = '25kW'
What was the Venue of the San Francisco 49ers Home game with a Result of 30-10?
CREATE TABLE table_name_89 (venue VARCHAR,home_team VARCHAR,result VARCHAR)
SELECT venue FROM table_name_89 WHERE home_team = "san francisco 49ers" AND result = "30-10"
Name the general classification of stage 15
CREATE TABLE table_12261806_2 (general_classification VARCHAR,stage VARCHAR)
SELECT COUNT(general_classification) FROM table_12261806_2 WHERE stage = "15"
Accepted answers average score per user.
CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)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 Votes (Id number,PostId number,VoteTypeId number,Use...
SELECT CAST(AVG(CAST(a.Score AS FLOAT)) AS FLOAT(20, 3)) AS average, COUNT(a.Score) AS acceptedanswers, a.OwnerUserId AS "user_link", (SELECT Reputation FROM Users WHERE Id = a.OwnerUserId) AS rep FROM Posts AS a GROUP BY a.OwnerUserId HAVING (COUNT(a.Score) > 5 OR a.OwnerUserId = @UserId) ORDER BY average DESC
What season did the Sake Tuyas come in 1st place?
CREATE TABLE table_31266 ("Season" real,"Apocalypstix" text,"Denim Demons" text,"Sake Tuyas" text,"Toxic Shocks" text)
SELECT "Season" FROM table_31266 WHERE "Sake Tuyas" = '1st'
What is the number of vacators when the successor was William H. Wells ( F )?
CREATE TABLE table_224839_3 (vacator VARCHAR,successor VARCHAR)
SELECT COUNT(vacator) FROM table_224839_3 WHERE successor = "William H. Wells ( F )"
tell me the name of the drug that patient 005-77687 is allergic to the last month?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE lab (labid number,patientunitstayid number,lab...
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 = '005-77687')) AND DATETIME(allergy.allergytime, 'start of month') = DATETIME(...
what is admission type of subject id 53707?
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 text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag...
SELECT demographic.admission_type FROM demographic WHERE demographic.subject_id = "53707"
Who ran the fastest lap in the team that competed in Zolder, in which Ferrari was the Constructor?
CREATE TABLE table_name_39 (fastest_lap VARCHAR,constructor VARCHAR,location VARCHAR)
SELECT fastest_lap FROM table_name_39 WHERE constructor = "ferrari" AND location = "zolder"
What is the rad number for the dead end in rank 22?
CREATE TABLE table_name_75 (road_number VARCHAR,type VARCHAR,rank VARCHAR)
SELECT road_number FROM table_name_75 WHERE type = "dead end" AND rank = "22"
Show me easy 300 -level classes .
CREATE TABLE student (student_id int,lastname varchar,firstname varchar,program_id int,declare_major varchar,total_credit int,total_gpa float,entered_as varchar,admit_term int,predicted_graduation_semester int,degree varchar,minor varchar,internship varchar)CREATE TABLE instructor (instructor_id int,name varchar,uniqna...
SELECT DISTINCT course.name, course.number, program_course.workload FROM course, program_course WHERE course.department = 'EECS' AND course.number BETWEEN 300 AND 300 + 100 AND program_course.course_id = course.course_id AND program_course.workload < 3 ORDER BY program_course.workload
What is the To Par when the finish was t16 and the player was Julius Boros?
CREATE TABLE table_name_56 (to_par VARCHAR,finish VARCHAR,player VARCHAR)
SELECT to_par FROM table_name_56 WHERE finish = "t16" AND player = "julius boros"
Did the fighter beat Ryo Takigawa?
CREATE TABLE table_name_62 (res VARCHAR,opponent VARCHAR)
SELECT res FROM table_name_62 WHERE opponent = "ryo takigawa"
how many children casualties were there in temerin and titel ?
CREATE TABLE table_204_693 (id number,"place" text,"total" number,"men" number,"women" number,"children" number,"elderly" number,"serbs" number,"jews" number,"romani" number,"rusyns" number,"hungarians" number,"russians" number)
SELECT SUM("children") FROM table_204_693 WHERE "place" IN ('temerin', 'titel')
What is the total number of medals when the Bronze, Silver, and Gold medals are smaller than 1?
CREATE TABLE table_name_61 (total VARCHAR,gold VARCHAR,bronze VARCHAR,silver VARCHAR)
SELECT COUNT(total) FROM table_name_61 WHERE bronze < 1 AND silver < 1 AND gold < 1
Who are the owners of the programs that broadcast both in the morning and at night?
CREATE TABLE broadcast (channel_id number,program_id number,time_of_day text)CREATE TABLE program (program_id number,name text,origin text,launch number,owner text)CREATE TABLE channel (channel_id number,name text,owner text,share_in_percent number,rating_in_percent number)CREATE TABLE broadcast_share (channel_id numbe...
SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.time_of_day = "Morning" INTERSECT SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.time_of_day = "Night"
Which Country of origin has a Pick larger than 1 and a College named Far Eastern / PSBA?
CREATE TABLE table_11603 ("Pick" real,"Player" text,"Country of origin*" text,"PBA team" text,"College" text)
SELECT "Country of origin*" FROM table_11603 WHERE "Pick" > '1' AND "College" = 'far eastern / psba'
What state is Wesson in?
CREATE TABLE table_9198 ("Timetable" text,"Company name" text,"Production place" text,"State" text,"Owner" text)
SELECT "State" FROM table_9198 WHERE "Owner" = 'wesson'
show me all the flights from MONTREAL to DETROIT
CREATE TABLE class_of_service (booking_class varchar,rank int,class_description text)CREATE TABLE equipment_sequence (aircraft_code_sequence varchar,aircraft_code varchar)CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE flight_stop ...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'MONTREAL' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DETRO...
Which county has 438 (4%) listed under R. Bacon?
CREATE TABLE table_61431 ("County" text,"Precincts" text,"C. Abate" text,"R. Bacon" text,"D. Shulman" text)
SELECT "County" FROM table_61431 WHERE "R. Bacon" = '438 (4%)'
Which Points difference has Played of 32, and Points for of 840?
CREATE TABLE table_name_23 (points_difference VARCHAR,played VARCHAR,points_for VARCHAR)
SELECT points_difference FROM table_name_23 WHERE played = "32" AND points_for = "840"
count the number of patients whose age is less than 67 and procedure short title is sm bowel exteriorization?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "67" AND procedures.short_title = "Sm bowel exteriorization"
how many patients whose days of hospital stay is greater than 30 and drug name is hydromorphone (dilaudid)?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "30" AND prescriptions.drug = "HYDROmorphone (Dilaudid)"
count the number of times that since 103 months ago patient 1114 had been prescribed meropenem.
CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE transfers (row_id number,subject_id number,hadm_id n...
SELECT COUNT(*) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1114) AND prescriptions.drug = 'meropenem' AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-103 month')