instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
show me all flights from TORONTO | CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE city (city_code varchar,city... | SELECT DISTINCT flight.flight_id FROM airport_service, city, flight WHERE city.city_code = airport_service.city_code AND city.city_name = 'TORONTO' AND flight.from_airport = airport_service.airport_code |
Find Answer by Text and UserId. | 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 Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount numb... | SELECT * FROM Posts WHERE OwnerUserId = '##UserId##' AND ParentId > 0 AND Body LIKE '%##Text##%' |
What school had a team name of the Trojans? | CREATE TABLE table_37988 ("School" text,"Team Name" text,"Town" text,"County" text,"School Enrollment (2008\u201310)" real,"Football?" text) | SELECT "School" FROM table_37988 WHERE "Team Name" = 'trojans' |
how many patients whose admission year is less than 2166 and drug name is loperamide? | 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 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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2166" AND prescriptions.drug = "Loperamide" |
How many tree species are in the kitechura reserve? | CREATE TABLE table_16577990_1 (tree_species VARCHAR,central_forest_reserve VARCHAR) | SELECT tree_species FROM table_16577990_1 WHERE central_forest_reserve = "Kitechura" |
Tell me the horse when the faults are 9 and the total is 46.36 | CREATE TABLE table_12013 ("Rider" text,"Horse" text,"Faults" text,"Round 1 + 2A Points" text,"Total" real) | SELECT "Horse" FROM table_12013 WHERE "Faults" = '9' AND "Total" = '46.36' |
What average total has 0 as the gold, with 6 as the rank? | CREATE TABLE table_name_69 (total INTEGER,gold VARCHAR,rank VARCHAR) | SELECT AVG(total) FROM table_name_69 WHERE gold = 0 AND rank = "6" |
does patient 85169 had any drain out #1 jackson pratt output? | 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,linksto text)CREATE TABLE inputevents_cv (row_id number,subject_id n... | SELECT COUNT(*) > 0 FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 85169)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'drain out #1 j... |
What are the different names of the colleges involved in the tryout in alphabetical order? | CREATE TABLE tryout (pid number,cname text,ppos text,decision text)CREATE TABLE player (pid number,pname text,ycard text,hs number)CREATE TABLE college (cname text,state text,enr number) | SELECT DISTINCT cname FROM tryout ORDER BY cname |
what is the place when the score is 68-70-68=206? | CREATE TABLE table_name_3 (place VARCHAR,score VARCHAR) | SELECT place FROM table_name_3 WHERE score = 68 - 70 - 68 = 206 |
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of job_id and commission_pct , order in ascending by the total number. | CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE jobs (JOB_ID v... | SELECT JOB_ID, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY COMMISSION_PCT |
what year did the rush allow the most goals ? | CREATE TABLE table_204_32 (id number,"season" number,"division" text,"w-l" text,"finish" text,"home" text,"road" text,"gf" number,"ga" number,"coach" text,"playoffs" text,"avg attendance" number) | SELECT "season" FROM table_204_32 ORDER BY "ga" DESC LIMIT 1 |
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, draw a bar chart about the distribution of hire_date and the average of manager_id bin hire_date by weekday, and I want to order from low to high by the y axis. | CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE locations (LOCAT... | SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(MANAGER_ID) |
How many of the female patients belonged to a black/cape verdean ethnic origin? | 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.gender = "F" AND demographic.ethnicity = "BLACK/CAPE VERDEAN" |
what are the five most frequently prescribed drugs in 2101 for patients prescribed with dexmedetomidine hcl at the same time? | 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,first_careunit text,last_careunit text,first_wardid number,last_wardid nu... | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'dexmedetomidine hcl' AND STRFTIME('%y', prescriptions.startdate) ... |
Return a bar chart on how many movie reviews does each director get?, and order in asc by the bars. | CREATE TABLE Movie (mID int,title text,year int,director text)CREATE TABLE Reviewer (rID int,name text)CREATE TABLE Rating (rID int,mID int,stars int,ratingDate date) | SELECT director, COUNT(*) FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director ORDER BY director |
Total weeks of 49,980 attendance? | CREATE TABLE table_name_55 (week INTEGER,attendance VARCHAR) | SELECT SUM(week) FROM table_name_55 WHERE attendance = 49 OFFSET 980 |
Name the 2008 for 2012 of sf | CREATE TABLE table_name_41 (Id VARCHAR) | SELECT 2008 FROM table_name_41 WHERE 2012 = "sf" |
nejat konuk and dervi ş ero ğ lu are from which party ? | CREATE TABLE table_203_694 (id number,"#" number,"name" text,"took office" text,"left office" text,"party" text) | SELECT "party" FROM table_203_694 WHERE "name" IN ('nejat konuk', 'dervis eroglu') |
How many ansi codes are there for longitude 46.415037? | CREATE TABLE table_18600760_20 (ansi_code VARCHAR,latitude VARCHAR) | SELECT COUNT(ansi_code) FROM table_18600760_20 WHERE latitude = "46.415037" |
What's the railway number of a D(rebuild) class? | CREATE TABLE table_name_28 (railway_number_s_ VARCHAR,class VARCHAR) | SELECT railway_number_s_ FROM table_name_28 WHERE class = "d(rebuild)" |
screening egfr < 60 ml / min / 1.73 m2 | CREATE TABLE table_train_169 ("id" int,"leukocytes" int,"hemoglobin_a1c_hba1c" float,"urine_albumin_excretion" int,"estimated_glomerular_filtration_rate_egfr" int,"glucola_beverage_gct" int,"age" float,"NOUSE" float) | SELECT * FROM table_train_169 WHERE estimated_glomerular_filtration_rate_egfr < 60 |
what is the name of the drug that patient 002-41152 has been prescribed two or more times last month? | CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE treatment (treatmen... | SELECT t1.drugname FROM (SELECT medication.drugname, COUNT(medication.drugstarttime) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002... |
What is the average number lost when the PCT is more than 0.7334 and the total number of games is larger than 48? | CREATE TABLE table_10468 ("Independent" text,"Lost" real,"Tied" real,"Pct." real,"Years" real,"Total Games" real) | SELECT AVG("Lost") FROM table_10468 WHERE "Pct." > '0.7334' AND "Total Games" > '48' |
how many times did patient 010-6098 since 128 months ago receive crystalloids? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicm... | SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-6098')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput.cel... |
how much does the minimum hospital cost including a procedure called hypotonic fluid administration - d5w until 1 year ago? | CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,obs... | 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 treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'hypotonic fluid administration - d5w')) AND ... |
How much is the lowest Operating Expenditures when Contributions are more than 8,245,241? | CREATE TABLE table_54361 ("Candidate" text,"Contributions" real,"Loans Received" real,"All Receipts" real,"Operating Expenditures" real,"All Disbursements" real) | SELECT MIN("Operating Expenditures") FROM table_54361 WHERE "Contributions" > '8,245,241' |
what is the daily maximum amount of the foley of patient 14458 during their first hospital visit? | CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,l... | SELECT MAX(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14458 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND outputeven... |
How many gold medals does the country ranked higher than 2 with more than 8 bronze have? | CREATE TABLE table_70723 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT SUM("Gold") FROM table_70723 WHERE "Rank" < '2' AND "Bronze" > '8' |
total number of models created . | CREATE TABLE table_203_873 (id number,"model name" text,"length" text,"width" text,"height" text,"riders" number,"capacity" number,"description" text,"portable" text,"notes" number) | SELECT COUNT(DISTINCT "model name") FROM table_203_873 |
Which engine has a Year larger than 1969? | CREATE TABLE table_name_7 (engine VARCHAR,year INTEGER) | SELECT engine FROM table_name_7 WHERE year > 1969 |
Who was the home team when the away team was Footscray? | CREATE TABLE table_53738 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Home team" FROM table_53738 WHERE "Away team" = 'footscray' |
Which position was active in Jazz in 2002-03? | CREATE TABLE table_name_59 (position VARCHAR,years_for_jazz VARCHAR) | SELECT position FROM table_name_59 WHERE years_for_jazz = "2002-03" |
on this month/27 what was the respiration minimum value of patient 005-87465? | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweigh... | SELECT MIN(vitalperiodic.respiration) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-87465')) AND NOT vitalperiodic.respiration IS ... |
Which actor won in 1966? | CREATE TABLE table_name_43 (actor VARCHAR,year VARCHAR) | SELECT actor FROM table_name_43 WHERE year = 1966 |
i would like the earliest morning flight from ATLANTA to PHILADELPHIA on wednesday morning | 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 flight_stop (flight_id int,stop_number int,stop_days text,stop_airport text,arrival_time int,arrival_airline text,arrival_flig... | 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, date_day, days, flight WHERE (((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND date_day.day_number = 23 AND date_day.month_number = ... |
For outgoing manager is alberto malesani mention all the applicable replaced by person | CREATE TABLE table_3703 ("Team" text,"Outgoing manager" text,"Manner of departure" text,"Date of vacancy" text,"Replaced by" text,"Date of appointment" text) | SELECT "Replaced by" FROM table_3703 WHERE "Outgoing manager" = 'Alberto Malesani' |
How many losses are there for team tembetary? | CREATE TABLE table_18703133_6 (losses VARCHAR,team VARCHAR) | SELECT losses FROM table_18703133_6 WHERE team = "Tembetary" |
What is the main presenter of bulgaria? | CREATE TABLE table_1053802_1 (main_presenters VARCHAR,region_country VARCHAR) | SELECT main_presenters FROM table_1053802_1 WHERE region_country = "Bulgaria" |
What is the original artist when the vocal percussionist is Alexei Kalveks? | CREATE TABLE table_28715942_5 (original_artist VARCHAR,vocal_percussionist VARCHAR) | SELECT original_artist FROM table_28715942_5 WHERE vocal_percussionist = "Alexei Kalveks" |
How many documents in different ending date? Return a line chart grouping by ending date. | CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR(15),Document_Type_Name VARCHAR(255),Document_Type_Description VARCHAR(255))CREATE TABLE All_Documents (Document_ID INTEGER,Date_Stored DATETIME,Document_Type_Code CHAR(15),Document_Name CHAR(255),Document_Description CHAR(255),Other_Details VARCHAR(255))CREATE TA... | SELECT Date_in_Locaton_To, COUNT(Date_in_Locaton_To) FROM Document_Locations GROUP BY Date_in_Locaton_To |
What is the sum of all total medals with more than 2 bronze medals and more than 1 gold medal for the United States? | CREATE TABLE table_name_27 (total INTEGER,gold VARCHAR,bronze VARCHAR,nation VARCHAR) | SELECT SUM(total) FROM table_name_27 WHERE bronze > 2 AND nation = "united states" AND gold > 1 |
What was the winning score of the Buy.com Siouxland Open? | CREATE TABLE table_70472 ("Date" text,"Tournament" text,"Winning score" text,"Margin of victory" text,"Runner(s)-up" text) | SELECT "Winning score" FROM table_70472 WHERE "Tournament" = 'buy.com siouxland open' |
Provide me the number of patients born before 1846 who have an abnormal lab test status. | 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "1846" AND lab.flag = "abnormal" |
What is Country, when Previous Team (League) is 'Kingston Frontenacs ( OHL )', and when Player is 'Anthony Stewart Category:Articles with hCards'? | CREATE TABLE table_59768 ("Year" real,"Pick" text,"Player" text,"Position" text,"Country" text,"Previous team (League)" text) | SELECT "Country" FROM table_59768 WHERE "Previous team (League)" = 'kingston frontenacs ( ohl )' AND "Player" = 'anthony stewart category:articles with hcards' |
Find the title and star rating of the movie that got the least rating star for each reviewer. | CREATE TABLE rating (rid number,mid number,stars number,ratingdate time)CREATE TABLE reviewer (rid number,name text)CREATE TABLE movie (mid number,title text,year number,director text) | SELECT T2.title, T1.rid, T1.stars, MIN(T1.stars) FROM rating AS T1 JOIN movie AS T2 ON T1.mid = T2.mid GROUP BY T1.rid |
List roles that have more than one employee. List the role description and number of employees. | CREATE TABLE ref_document_status (document_status_code text,document_status_description text)CREATE TABLE circulation_history (document_id number,draft_number number,copy_number number,employee_id number)CREATE TABLE documents (document_id number,document_status_code text,document_type_code text,shipping_agent_code tex... | SELECT roles.role_description, COUNT(employees.employee_id) FROM roles JOIN employees ON employees.role_code = roles.role_code GROUP BY employees.role_code HAVING COUNT(employees.employee_id) > 1 |
What nations participated in 2007? | CREATE TABLE table_66466 ("Sport" text,"Body" text,"Year" text,"Event type" text,"Location" text,"Nations" text) | SELECT "Nations" FROM table_66466 WHERE "Year" = '2007' |
How many tourists visited the country that had 2.5 million tourists in 2011? | CREATE TABLE table_34550 ("Rank" real,"Country" text,"International tourist arrivals (2012)" text,"International tourist arrivals (2011)" text,"Change (2011 to 2012)" text,"Change (2010 to 2011)" text) | SELECT "International tourist arrivals (2012)" FROM table_34550 WHERE "International tourist arrivals (2011)" = '2.5 million' |
What stage did team Carrera Jeans-Tassoni have when Mario Cipollini won and Claudio Chiappucci had the points? | CREATE TABLE table_11219 ("Stage" text,"Winner" text,"General classification" text,"Points classification" text,"Trofeo Fast Team" text) | SELECT "Stage" FROM table_11219 WHERE "Trofeo Fast Team" = 'carrera jeans-tassoni' AND "Winner" = 'mario cipollini' AND "Points classification" = 'claudio chiappucci' |
Name the replaced by for august 9 | CREATE TABLE table_27597 ("Team" text,"Outgoing manager" text,"Manner of departure" text,"Date of vacancy" text,"Position in table" text,"Replaced by" text,"Date of appointment" text) | SELECT "Replaced by" FROM table_27597 WHERE "Date of vacancy" = 'August 9' AND "Date of appointment" = 'August 9' |
What venue was on 27 May 2000? | CREATE TABLE table_name_81 (venue VARCHAR,date VARCHAR) | SELECT venue FROM table_name_81 WHERE date = "27 may 2000" |
has patient 029-584 ever had a medication prescribed the last year? | 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 patient (uniquepid text,patienthealthsystemsta... | SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-584')) AND DATETIME(medication.drugstarttime, 'start of year') = DATET... |
What is Socket, when Part Number(s) is au80610003495aa? | CREATE TABLE table_9828 ("Model number" text,"sSpec number" text,"Frequency" text,"GPU frequency" text,"L2 cache" text,"I/O bus" text,"Memory" text,"Voltage" text,"Socket" text,"Release date" text,"Part number(s)" text) | SELECT "Socket" FROM table_9828 WHERE "Part number(s)" = 'au80610003495aa' |
how many hours have passed since the patient 95057 was admitted to the hospital? | CREATE TABLE d_icd_diagnoses (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 microbiologyevents (row_... | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', admissions.admittime)) FROM admissions WHERE admissions.subject_id = 95057 AND admissions.dischtime IS NULL |
how many of the patients aged below 76 had migraine unspecified w/o ntrc mgrn? | 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "76" AND diagnoses.short_title = "Migrne unsp wo ntrc mgrn" |
Which To par has a Year of 1994? | CREATE TABLE table_name_24 (to_par VARCHAR,year VARCHAR) | SELECT to_par FROM table_name_24 WHERE year = 1994 |
Draw a bar chart about the distribution of meter_700 and ID , and rank meter_700 in desc order. | CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year int)CREATE TABLE event (ID int,Name text,Stadium_ID int,Year text)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time ... | SELECT meter_700, ID FROM swimmer ORDER BY meter_700 DESC |
Which year was the peter jackson classic? | CREATE TABLE table_name_36 (year VARCHAR,championship VARCHAR) | SELECT year FROM table_name_36 WHERE championship = "peter jackson classic" |
TOTAL number of SUCCESSFUL questions. | CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,C... | SELECT COUNT(DISTINCT p.Id) FROM Posts AS p WHERE p.PostTypeId = 1 AND NOT p.AcceptedAnswerId IS NULL |
when did patient 19040 first get a procedure on their first 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 procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE inputevents_cv (row_id number,subject_id number,had... | SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19040 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) ORDER BY procedures_icd.charttime LIMIT 1 |
what are the procedures that are the top four most commonly received? | CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,dischargeweight number,hospitaladmittime time,hospitaladmitsource text,unitadmittime time,unitdischargetime tim... | SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 4 |
what is the number of patients whose gender is f and primary disease is st elevated myocardial infarction\cardiac cath? | 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 diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" |
give me the number of patients whose diagnoses short title is enterococcus group d? | 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 procedures (subject_id text,hadm_id text,icd9_code text,sho... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Enterococcus group d" |
What district has a constituency of 60? | CREATE TABLE table_name_27 (district VARCHAR,constituency_number VARCHAR) | SELECT district FROM table_name_27 WHERE constituency_number = "60" |
When were there less than 1 point with a cosworth v8 engine in jolly club switzerland? | CREATE TABLE table_14553 ("Year" real,"Entrant" text,"Chassis" text,"Engine" text,"Points" real) | SELECT "Year" FROM table_14553 WHERE "Points" < '1' AND "Engine" = 'cosworth v8' AND "Entrant" = 'jolly club switzerland' |
For the flyers, what's the minimum capacity? | CREATE TABLE table_20718 ("Institution" text,"Location" text,"Team Nickname" text,"Joined TSCHL" real,"Home Arena" text,"Capacity" real,"Team Website" text) | SELECT MIN("Capacity") FROM table_20718 WHERE "Team Nickname" = 'Flyers' |
give the number of patients who are born before 2180 with a ivpca drug route. | 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 lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2180" AND prescriptions.route = "IVPCA" |
You can return a bar chart with employees' first names and their salaries, display by the y axis from high to low. | CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2),COMMISSION_PCT decimal(2,2),MANAGE... | SELECT FIRST_NAME, SALARY FROM employees ORDER BY SALARY DESC |
Name the scores for chris ramsey and carol vorderman | CREATE TABLE table_23292220_17 (scores VARCHAR,seans_team VARCHAR) | SELECT scores FROM table_23292220_17 WHERE seans_team = "Chris Ramsey and Carol Vorderman" |
What is the number of games for the season with 10 ties? | CREATE TABLE table_name_86 (games VARCHAR,tied VARCHAR) | SELECT games FROM table_name_86 WHERE tied = 10 |
What year did she place 8th in the junior race? | CREATE TABLE table_name_9 (year VARCHAR,event VARCHAR,position VARCHAR) | SELECT year FROM table_name_9 WHERE event = "junior race" AND position = "8th" |
A bar chart for what are the number of the descriptions of the categories that products with product descriptions that contain the letter t are in?, and rank y-axis in ascending order. | CREATE TABLE Ref_Characteristic_Types (characteristic_type_code VARCHAR(15),characteristic_type_description VARCHAR(80))CREATE TABLE Products (product_id INTEGER,color_code VARCHAR(15),product_category_code VARCHAR(15),product_name VARCHAR(80),typical_buying_price VARCHAR(20),typical_selling_price VARCHAR(20),product_d... | SELECT product_category_description, COUNT(product_category_description) FROM Ref_Product_Categories AS T1 JOIN Products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%' GROUP BY product_category_description ORDER BY COUNT(product_category_description) |
What is the smallest Earnings that has a Money list rank of 6 and Starts smaller than 22? | CREATE TABLE table_56530 ("Year" text,"Starts" real,"Cuts made" real,"Wins" real,"Top 10" real,"Top 25" real,"Earnings ($)" real,"Money list rank" text) | SELECT MIN("Earnings ($)") FROM table_56530 WHERE "Money list rank" = '6' AND "Starts" < '22' |
What year had 32 moves? | CREATE TABLE table_8509 ("White" text,"Black" text,"Year" real,"Result" text,"Moves" real,"Tournament" text,"Opening" text) | SELECT SUM("Year") FROM table_8509 WHERE "Moves" = '32' |
how long was the m1894 rifle 's barrel ? | CREATE TABLE table_204_343 (id number,"nation" text,"model" text,"length" text,"barrel length" text,"weight" text) | SELECT "barrel length" FROM table_204_343 WHERE "model" = 'm1894 rifle' |
How many Atts that have Yards of 43 and a Long larger than 43? | CREATE TABLE table_name_65 (att INTEGER,yards VARCHAR,long VARCHAR) | SELECT SUM(att) FROM table_name_65 WHERE yards = 43 AND long > 43 |
How many times are listed for 31 May for the rider ranked 5? | CREATE TABLE table_25220821_4 (mon_31_may VARCHAR,rank VARCHAR) | SELECT COUNT(mon_31_may) FROM table_25220821_4 WHERE rank = 5 |
Plot how many name by grouped by name as a bar graph, and sort by the total number in descending. | CREATE TABLE train (id int,train_number int,name text,origin text,destination text,time text,interval text)CREATE TABLE weekly_weather (station_id int,day_of_week text,high_temperature int,low_temperature int,precipitation real,wind_speed_mph int)CREATE TABLE route (train_id int,station_id int)CREATE TABLE station (id ... | SELECT name, COUNT(name) FROM train GROUP BY name ORDER BY COUNT(name) DESC |
Which constructor has a Time/Retired of +37.311? | CREATE TABLE table_56316 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT "Constructor" FROM table_56316 WHERE "Time/Retired" = '+37.311' |
What is the 2007 result when the 2010 result was 2r, at the US Open? | CREATE TABLE table_name_91 (tournament VARCHAR) | SELECT 2007 FROM table_name_91 WHERE 2010 = "2r" AND tournament = "us open" |
when does the train arriving at bourne at 11.45 departure | CREATE TABLE table_22277 ("Departure" text,"Going to" text,"Calling at" text,"Arrival" text,"Operator" text) | SELECT "Departure" FROM table_22277 WHERE "Going to" = 'Bourne' AND "Arrival" = '11.45' |
Users with close-vote privileges ordered by last access date.. | CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE T... | SELECT ROW_NUMBER() OVER (ORDER BY LastAccessDate DESC) AS " ", Id AS "user_link", LastAccessDate FROM Users WHERE Reputation > 3000 ORDER BY LastAccessDate DESC |
Which Time/Retired has a Grid smaller than 3, and a Driver of mika h kkinen? | CREATE TABLE table_name_58 (time_retired VARCHAR,grid VARCHAR,driver VARCHAR) | SELECT time_retired FROM table_name_58 WHERE grid < 3 AND driver = "mika häkkinen" |
What was the higest attendance on November 9, 1958? | CREATE TABLE table_name_4 (attendance INTEGER,date VARCHAR) | SELECT MAX(attendance) FROM table_name_4 WHERE date = "november 9, 1958" |
How many losses did the team with 22 goals for andmore than 8 games played have? | CREATE TABLE table_78521 ("Team" text,"Games Played" real,"Wins" real,"Losses" real,"Ties" real,"Goals For" real,"Goals Against" real) | SELECT COUNT("Losses") FROM table_78521 WHERE "Goals For" = '22' AND "Games Played" > '8' |
What is the largest overall number of major hurricanes? | CREATE TABLE table_2930244_3 (number_of_major_hurricanes INTEGER) | SELECT MAX(number_of_major_hurricanes) FROM table_2930244_3 |
count the number of patients whose primary disease is morbid obesity/sda and drug name is soln.? | 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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "MORBID OBESITY/SDA" AND prescriptions.drug = "Soln." |
What is Position, when Caps is Example, and When Player is Shane Kelly? | CREATE TABLE table_41531 ("Player" text,"Position" text,"Date of Birth (Age)" text,"Caps" text,"Province / Club" text) | SELECT "Position" FROM table_41531 WHERE "Caps" = 'example' AND "Player" = 'shane kelly' |
Which Proto-Austronesian has a Proto-Oceanic of *lima? | CREATE TABLE table_name_97 (proto_austronesian VARCHAR,proto_oceanic VARCHAR) | SELECT proto_austronesian FROM table_name_97 WHERE proto_oceanic = "*lima" |
What is the Away team at the Wolverhampton Wanderers Home game with a Score of 2 0? | CREATE TABLE table_60349 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text) | SELECT "Away team" FROM table_60349 WHERE "Score" = '2–0' AND "Home team" = 'wolverhampton wanderers' |
The match against Oleg Taktarov had what result? | CREATE TABLE table_name_19 (res VARCHAR,opponent VARCHAR) | SELECT res FROM table_name_19 WHERE opponent = "oleg taktarov" |
what is the four most frequently ordered procedure for a patient with an age 40s? | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE vitalperiodic (vitalperiodicid number,... | 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 40 AND 49) GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 4 |
What was the featured in Engine through rounds 10-13? | CREATE TABLE table_55779 ("Entrant" text,"Constructor" text,"Chassis" text,"Engine" text,"Tyres" text,"Driver" text,"Rounds" text) | SELECT "Engine" FROM table_55779 WHERE "Rounds" = '10-13' |
What was Laurel's division record? | CREATE TABLE table_67113 ("School" text,"Team" text,"Division Record" text,"Overall Record" text,"Season Outcome" text) | SELECT "Division Record" FROM table_67113 WHERE "School" = 'laurel' |
What is the lowest Games, when Name is Jeremiah Massey, and when Points is less than 340? | CREATE TABLE table_name_91 (games INTEGER,name VARCHAR,points VARCHAR) | SELECT MIN(games) FROM table_name_91 WHERE name = "jeremiah massey" AND points < 340 |
How many people wrote the episode directed by Arvin Brown? | CREATE TABLE table_30030227_1 (written_by VARCHAR,directed_by VARCHAR) | SELECT COUNT(written_by) FROM table_30030227_1 WHERE directed_by = "Arvin Brown" |
How many years was ensign n180b a Chassis with 4 points? | CREATE TABLE table_70406 ("Year" real,"Entrant" text,"Chassis" text,"Engine" text,"Points" real) | SELECT SUM("Year") FROM table_70406 WHERE "Points" = '4' AND "Chassis" = 'ensign n180b' |
among patients who were diagnosed with routine circumcision during a year before, what are the top three most frequent procedures that followed afterwards within 2 months? | CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)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 t... | 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, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissi... |
Which Opponent has an Away of 1 1, and a Home of 3 3? | CREATE TABLE table_75827 ("Season" text,"Competition" text,"Round" text,"Opponent" text,"Home" text,"Away" text,"Series" text) | SELECT "Opponent" FROM table_75827 WHERE "Away" = '1–1' AND "Home" = '3–3' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.