instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
How many points against did Carmarthen Athletic RFC have when they played 22 games ?
CREATE TABLE table_67608 ("Club" text,"Played" text,"Drawn" text,"Lost" text,"Points for" text,"Points against" text,"Tries for" text,"Tries against" text,"Try bonus" text)
SELECT "Points against" FROM table_67608 WHERE "Played" = '22' AND "Club" = 'carmarthen athletic rfc'
What match had 240 points for?
CREATE TABLE table_name_81 (matches VARCHAR,points_for VARCHAR)
SELECT matches FROM table_name_81 WHERE points_for = "240"
What is the average wins has Top-25 less than 0?
CREATE TABLE table_name_66 (wins INTEGER,top_25 INTEGER)
SELECT AVG(wins) FROM table_name_66 WHERE top_25 < 0
What is the total number of decile for the redwood school locality?
CREATE TABLE table_name_34 (decile VARCHAR,name VARCHAR)
SELECT COUNT(decile) FROM table_name_34 WHERE name = "redwood school"
What number-one single is performed by artist Pep's?
CREATE TABLE table_27441210_17 (number_one_single_s_ VARCHAR,artist VARCHAR)
SELECT number_one_single_s_ FROM table_27441210_17 WHERE artist = "Pep's"
what DL flights from CINCINNATI to NEW YORK arrive at NEW YORK before 1800 on saturday
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 dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE airport_service (city_c...
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 (((((((flight.arrival_time < 41 OR flight.time_elapsed >= 60) AND flight.departure_time > flight.arrival_time) AND date_day.day_number = 26 AND d...
What is the highest number of draws that correlates with a percentage of 0.00% and less than 1 loss?
CREATE TABLE table_68192 ("First game" real,"Played" real,"Drawn" real,"Lost" real,"Percentage" text)
SELECT MAX("Drawn") FROM table_68192 WHERE "Percentage" = '0.00%' AND "Lost" < '1'
what is the average silver when the total is more than 20?
CREATE TABLE table_name_66 (silver INTEGER,total INTEGER)
SELECT AVG(silver) FROM table_name_66 WHERE total > 20
what procedure does patient 88659 receive in the last year for the first time?
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 outputevents (row_id number,subject_id number,hadm_...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT procedures_icd.icd9_code FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 88659) AND DATETIME(procedures_icd.charttime, 'start of year') = DAT...
What is the greatest successes that have failures greater than 1 and launches less than 28?
CREATE TABLE table_38106 ("Orbital regime" text,"Launches" real,"Successes" real,"Failures" real,"Accidentally Achieved" real)
SELECT MAX("Successes") FROM table_38106 WHERE "Failures" > '1' AND "Launches" < '28'
What is the highest laps of the year when the rank was 14?
CREATE TABLE table_name_73 (laps INTEGER,rank VARCHAR)
SELECT MAX(laps) FROM table_name_73 WHERE rank = "14"
Give me the trend about the number of church opening in each year, could you show by the X-axis in desc?
CREATE TABLE wedding (Church_ID int,Male_ID int,Female_ID int,Year int)CREATE TABLE church (Church_ID int,Name text,Organized_by text,Open_Date int,Continuation_of text)CREATE TABLE people (People_ID int,Name text,Country text,Is_Male text,Age int)
SELECT Open_Date, COUNT(Open_Date) FROM church GROUP BY Open_Date ORDER BY Open_Date DESC
What is 1994, when 1991 is 'QF', and when Tournament is 'Australian Open'?
CREATE TABLE table_name_59 (tournament VARCHAR)
SELECT 1994 FROM table_name_59 WHERE 1991 = "qf" AND tournament = "australian open"
What is the highest number listed?
CREATE TABLE table_12113888_1 (number INTEGER)
SELECT MAX(number) FROM table_12113888_1
Who drives the abc supply sponsored cor?
CREATE TABLE table_27305 ("Team" text,"#" real,"Primary Sponsor" text,"Driver(s)" text,"Listed Owner(s)" text,"Engine" text,"Chassis" text)
SELECT "Driver(s)" FROM table_27305 WHERE "Primary Sponsor" = 'ABC Supply'
What was the crowd number when the home team was Carlton?
CREATE TABLE table_10239 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT MIN("Crowd") FROM table_10239 WHERE "Home team" = 'carlton'
What is the pick number for the team toronto fc and affiliation is ldu quito?
CREATE TABLE table_29626583_3 (pick__number INTEGER,mls_team VARCHAR,affiliation VARCHAR)
SELECT MAX(pick__number) FROM table_29626583_3 WHERE mls_team = "Toronto FC" AND affiliation = "LDU Quito"
Who is the driver whose Constructor was Era, and whose entrant was T.A.S.O. Mathieson?
CREATE TABLE table_57164 ("Entrant" text,"Constructor" text,"Chassis" text,"Driver" text,"Rounds" text)
SELECT "Driver" FROM table_57164 WHERE "Constructor" = 'era' AND "Entrant" = 't.a.s.o. mathieson'
In what Round was Pick #12 drafted?
CREATE TABLE table_name_53 (round VARCHAR,pick__number VARCHAR)
SELECT round FROM table_name_53 WHERE pick__number = 12
What is Tournament, when 2001 is '1R'?
CREATE TABLE table_50644 ("Tournament" text,"2000" text,"2001" text,"2002" text,"2003" text,"2004" text,"2005" text,"Career SR" text,"Career Win-Loss" text)
SELECT "Tournament" FROM table_50644 WHERE "2001" = '1r'
Which date was associated with the release in Europe on the Wichita Recordings label?
CREATE TABLE table_name_5 (date VARCHAR,region VARCHAR,label VARCHAR)
SELECT date FROM table_name_5 WHERE region = "europe" AND label = "wichita recordings"
tell me the top four diagnosis that has the highest two year mortality rate?
CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)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 d_icd_diagnose...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t4.icd9_code FROM (SELECT t3.icd9_code, DENSE_RANK() OVER (ORDER BY t3.c1 DESC) AS c2 FROM (SELECT t2.icd9_code, 100 - SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t2.chartt...
How many original 3rd us tour cast were there while the original uk cast was alyssa dipalma?
CREATE TABLE table_24353141_1 (original_3rd_us_tour_cast VARCHAR,original_uk_cast VARCHAR)
SELECT COUNT(original_3rd_us_tour_cast) FROM table_24353141_1 WHERE original_uk_cast = "Alyssa DiPalma"
What is the name of the host nations if the winner was Hong Kong 207/6 (47.1 overs)?
CREATE TABLE table_25119 ("Details" text,"Host Nation(s)" text,"Final Venue" text,"Winner" text,"Result" text,"Runner-up" text)
SELECT "Host Nation(s)" FROM table_25119 WHERE "Winner" = 'Hong Kong 207/6 (47.1 overs)'
Which horse won with a time of 1:35.98 and what was their position?
CREATE TABLE table_20436 ("Result" text,"Date" text,"Race" text,"Venue" text,"Group" text,"Distance" text,"Weight (kg)" text,"Time" text,"Jockey" text,"Winner/2nd" text)
SELECT "Winner/2nd" FROM table_20436 WHERE "Time" = '1:35.98'
what are the flights from CHARLOTTE to ATLANTA returning on tuesday 7 13
CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion varchar,wide_body varchar,wing_span int,length int,weight int,capacity int,pay_load int,cruising_speed int,range_miles int,pressurized varchar)CREATE TABLE airport_service (city_code ...
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, state WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND date_day.day_number = 13 AND date_day.month_number = ...
How many Points have Goals against of 35, and less than 13 losses?
CREATE TABLE table_name_45 (points INTEGER,goals_against VARCHAR,losses VARCHAR)
SELECT SUM(points) FROM table_name_45 WHERE goals_against = 35 AND losses < 13
how many patients whose admission year is less than 2120 and procedure short title is suture of artery?
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2120" AND procedures.short_title = "Suture of artery"
What are the types of competition and number of competitions for that type Show bar chart, and display names in ascending order.
CREATE TABLE competition (Competition_ID int,Year real,Competition_type text,Country text)CREATE TABLE club (Club_ID int,name text,Region text,Start_year text)CREATE TABLE player (Player_ID int,name text,Position text,Club_ID int,Apps real,Tries real,Goals text,Points real)CREATE TABLE club_rank (Rank real,Club_ID int,...
SELECT Competition_type, COUNT(*) FROM competition GROUP BY Competition_type ORDER BY Competition_type
give me the number of patients born before 2184 who have lab test item id 51250.
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.dob_year < "2184" AND lab.itemid = "51250"
What is the lowest Grid with 25 laps manufactured by Honda with a time of +54.103?
CREATE TABLE table_name_91 (grid INTEGER,time_retired VARCHAR,laps VARCHAR,manufacturer VARCHAR)
SELECT MIN(grid) FROM table_name_91 WHERE laps = 25 AND manufacturer = "honda" AND time_retired = "+54.103"
Which Pick has a Player of chuck bryant, and an NFL Club of san diego chargers?
CREATE TABLE table_59756 ("Player" text,"Draft" text,"Round" real,"Pick" real,"Position" text,"NFL Club" text)
SELECT "Pick" FROM table_59756 WHERE "Player" = 'chuck bryant' AND "NFL Club" = 'san diego chargers'
A nucleus that is blue/black will specifically stain what?
CREATE TABLE table_816 ("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_816 WHERE "Nucleus" = 'Blue/black'
How many married patients died in or before 2165?
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.marital_status = "MARRIED" AND demographic.dod_year <= "2165.0"
the team 's record in 2011 was the same was it 's record in what year
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 WHERE "season" <> 2011 AND "w-l" = (SELECT "w-l" FROM table_204_32 WHERE "season" = 2011)
Name the most attendance for game site for los angeles memorial coliseum
CREATE TABLE table_14984103_1 (attendance INTEGER,game_site VARCHAR)
SELECT MAX(attendance) FROM table_14984103_1 WHERE game_site = "Los Angeles Memorial Coliseum"
How many synthesis are there for 5~16.2 pw per cycle (calculated) output power?
CREATE TABLE table_4266 ("Material" text,"Type" text,"Geometry" text,"Output voltage" text,"Output power" text,"Synthesis" text,"Researched at" text)
SELECT COUNT("Synthesis") FROM table_4266 WHERE "Output power" = '5~16.2 pW per cycle (calculated)'
how many patients whose drug code is lans30st and lab test fluid is cerebrospinal fluid (csf)?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "LANS30ST" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
What is the constructor of the race with Juan Manuel Fangio as the fastest lap and Giuseppe Farina as the winning driver?
CREATE TABLE table_56479 ("Race" text,"Circuit" text,"Date" text,"Pole position" text,"Fastest lap" text,"Winning driver" text,"Constructor" text,"Tyre" text,"Report" text)
SELECT "Constructor" FROM table_56479 WHERE "Fastest lap" = 'juan manuel fangio' AND "Winning driver" = 'giuseppe farina'
What is the Result when the Attendance is 1,634?
CREATE TABLE table_50213 ("Date" text,"Opponent" text,"Venue" text,"Result" text,"Attendance" text,"Competition" text,"Man of the Match" text)
SELECT "Result" FROM table_50213 WHERE "Attendance" = '1,634'
What tyres have 1 point and an ensign n177 chassis?
CREATE TABLE table_name_15 (tyres VARCHAR,points VARCHAR,chassis VARCHAR)
SELECT tyres FROM table_name_15 WHERE points = "1" AND chassis = "ensign n177"
What is the Away team at Bristol Rovers' Home game?
CREATE TABLE table_name_33 (away_team VARCHAR,home_team VARCHAR)
SELECT away_team FROM table_name_33 WHERE home_team = "bristol rovers"
Name the stgae with winner of robbie mcewen
CREATE TABLE table_name_22 (stage VARCHAR,winner VARCHAR)
SELECT stage FROM table_name_22 WHERE winner = "robbie mcewen"
How many records show Utah as the opponent?
CREATE TABLE table_25323 ("Game" real,"Date" text,"Opponent" text,"Result" text,"Cowboys points" real,"Opponents" real,"Record" text)
SELECT COUNT("Record") FROM table_25323 WHERE "Opponent" = 'Utah'
Calculate the number of patients treated with drug hydx25 who died in or before the year 2186.
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.dod_year <= "2186.0" AND prescriptions.formulary_drug_cd = "HYDX25"
What is the Japanese orthography for the abbreviation of ndmc?
CREATE TABLE table_name_39 (japanese_orthography VARCHAR,abbreviation VARCHAR)
SELECT japanese_orthography FROM table_name_39 WHERE abbreviation = "ndmc"
What is recorded as the lowest Year that has the Title of Cold Feet?
CREATE TABLE table_name_96 (year INTEGER,title VARCHAR)
SELECT MIN(year) FROM table_name_96 WHERE title = "cold feet"
What's the rating of the episode originally aired on May 5, 2009?
CREATE TABLE table_16601 ("No." real,"Episode" text,"Air Date" text,"Timeslot" text,"Rating" text,"Share" text,"18\u201349 (Rating/Share)" text,"Viewers (m)" text,"Rank (#)" text)
SELECT "Rating" FROM table_16601 WHERE "Air Date" = 'May 5, 2009'
WHich Open Cup has a Division larger than 4?
CREATE TABLE table_50804 ("Year" text,"Division" real,"League" text,"Regular Season" text,"Playoffs" text,"Open Cup" text)
SELECT "Open Cup" FROM table_50804 WHERE "Division" > '4'
What is the fleet number of Model Orion 01.507?
CREATE TABLE table_name_23 (fleet_number VARCHAR,model VARCHAR)
SELECT fleet_number FROM table_name_23 WHERE model = "orion 01.507"
Which team had 7 losses and 55 goals?
CREATE TABLE table_52805 ("Team" text,"Games Played" real,"Wins" real,"Losses" text,"Ties" real,"Goals For" real,"Goals Against" real)
SELECT "Team" FROM table_52805 WHERE "Losses" = '7' AND "Goals For" = '55'
what is the daily average intake of lipids that patient 005-87465 is getting on this hospital visit?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE lab (labid number,patientunitstayid number,labnam...
SELECT AVG(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-87465' AND patient.hospitaldischargetime IS ...
What was the result in the election where Hale Boggs was the incumbent?
CREATE TABLE table_1342149_18 (result VARCHAR,incumbent VARCHAR)
SELECT result FROM table_1342149_18 WHERE incumbent = "Hale Boggs"
what flights from HOUSTON to MILWAUKEE on friday in the evening on AA
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_days text,flight_id int,flight_number int,from_airport varchar,meal_code text,stops int,time_elapsed int,to_airport varchar)CREATE TABLE state (state_cod...
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 = 'MILWAUKEE' AND date_day.day_number = 25 AND date_day.month_number = 6 A...
How many patients' prescriptions are made by physician John Dorian?
CREATE TABLE physician (employeeid VARCHAR,name VARCHAR)CREATE TABLE patient (SSN VARCHAR)CREATE TABLE prescribes (patient VARCHAR,physician VARCHAR)
SELECT COUNT(T1.SSN) FROM patient AS T1 JOIN prescribes AS T2 ON T1.SSN = T2.patient JOIN physician AS T3 ON T2.physician = T3.employeeid WHERE T3.name = "John Dorian"
Name the stage for no award
CREATE TABLE table_22713796_14 (stage VARCHAR,mountains_classification VARCHAR)
SELECT stage FROM table_22713796_14 WHERE mountains_classification = "no award"
how many hours have it been since patient 97395 had the first idio periph neurpthy nos diagnosis during this hospital visit?
CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE d_items (row_id number,itemid number,label text,linksto 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 icus...
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 = 'idio periph neurpthy nos') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM ad...
when was the first lap gastric restric proc done for patient 4718 until 3 years ago?
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 procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE patients (...
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'lap gastric restric proc') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 4718) AND ...
What year was the congressional service elected for a term beginning on January 3, 1989?
CREATE TABLE table_23235 ("Office" text,"Branch" text,"Location" text,"Elected" real,"Term began" text,"Term ended" text)
SELECT "Elected" FROM table_23235 WHERE "Term began" = 'January 3, 1989'
What primary conference does the team nicknamed Phoenix belongs to?
CREATE TABLE table_50397 ("Institution" text,"Location" text,"Founded" real,"Affiliation" text,"Enrollment" real,"Team Nickname" text,"Primary conference" text,"Home Rink" text)
SELECT "Primary conference" FROM table_50397 WHERE "Team Nickname" = 'phoenix'
[draft] How many upvotes do I have for each tag?. How many upvotes do I have for each tag? (how long before I get tag badges?)
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAdd...
SELECT TagName, COUNT(*) AS UpVotes FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId INNER JOIN Votes ON Votes.PostId = Posts.Id AND VoteTypeId = 2 WHERE Posts.OwnerUserId = @UserId GROUP BY TagName ORDER BY UpVotes DESC
count the number of patients admitted on an urgent basis who stayed in hospital for more than 5 days.
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 WHERE demographic.admission_type = "URGENT" AND demographic.days_stay > "5"
give me the number of patients whose ethnicity is american indian/alaska native and their lab test is d-dimer.
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.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND lab.label = "D-Dimer"
What is the entry for Upper index Kcal/ Nm 3 for the row with an entry that has a Lower index MJ/ Nm 3 of 47.91, and an Upper index MJ/ Nm 3 larger than 53.28?
CREATE TABLE table_name_93 (upper_index_kcal__nm_3 INTEGER,lower_index_mj__nm_3 VARCHAR,upper_index_mj__nm_3 VARCHAR)
SELECT SUM(upper_index_kcal__nm_3) FROM table_name_93 WHERE lower_index_mj__nm_3 = 47.91 AND upper_index_mj__nm_3 > 53.28
Find out the time of admission and number of days for which the patient with patient id 15061 stayed in the hospital.
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 demographic.days_stay, demographic.admittime FROM demographic WHERE demographic.subject_id = "15061"
Create a bar chart showing the total number across premises type, I want to order Y in ascending order.
CREATE TABLE Mailshot_Campaigns (mailshot_id INTEGER,product_category VARCHAR(15),mailshot_name VARCHAR(80),mailshot_start_date DATETIME,mailshot_end_date DATETIME)CREATE TABLE Customer_Addresses (customer_id INTEGER,premise_id INTEGER,date_address_from DATETIME,address_type_code VARCHAR(15),date_address_to DATETIME)CR...
SELECT premises_type, COUNT(*) FROM Premises GROUP BY premises_type ORDER BY COUNT(*)
What season number is the episode 'The Gang Cracks The Liberty Bell'?
CREATE TABLE table_31051 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text)
SELECT MIN("No. in season") FROM table_31051 WHERE "Title" = 'The Gang Cracks the Liberty Bell'
How many courses are provided in each year? Visualize with a line chart, sort in descending by the x axis.
CREATE TABLE instructor (ID varchar(5),name varchar(20),dept_name varchar(20),salary numeric(8,2))CREATE TABLE section (course_id varchar(8),sec_id varchar(8),semester varchar(6),year numeric(4,0),building varchar(15),room_number varchar(7),time_slot_id varchar(4))CREATE TABLE prereq (course_id varchar(8),prereq_id var...
SELECT year, COUNT(*) FROM section ORDER BY year DESC
When Paul Whiting won the mixed veteran, who won the mixed restricted?
CREATE TABLE table_74255 ("Date/Location" text,"Mens singles" text,"Womens Singles" text,"U21 Mens" text,"U21 Womens" text,"Mixed Restricted" text,"Mixed Veteran" text)
SELECT "Mixed Restricted" FROM table_74255 WHERE "Mixed Veteran" = 'Paul Whiting'
Which was the home team that had an opponent have a score of 11.6 (72)?
CREATE TABLE table_54509 ("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_54509 WHERE "Away team score" = '11.6 (72)'
Which Number of electorates (2009) has a Reserved for (SC / ST /None) of total:?
CREATE TABLE table_name_21 (number_of_electorates__2009_ VARCHAR,reserved_for___sc___st__none_ VARCHAR)
SELECT number_of_electorates__2009_ FROM table_name_21 WHERE reserved_for___sc___st__none_ = "total:"
What is Beohari's reserved for (SC/ST/None)?
CREATE TABLE table_name_31 (reserved_for___sc___st__none_ VARCHAR,name VARCHAR)
SELECT reserved_for___sc___st__none_ FROM table_name_31 WHERE name = "beohari"
Who's the Republican ticket with a Democratic ticket of flora d. johnson?
CREATE TABLE table_40851 ("Republican ticket" text,"Democratic ticket" text,"American Labor ticket" text,"Communist ticket" text,"Socialist ticket" text)
SELECT "Republican ticket" FROM table_40851 WHERE "Democratic ticket" = 'flora d. johnson'
If the channels is wxyzuv, what is the number of channels?
CREATE TABLE table_233830_1 (number_of_channels VARCHAR,channels VARCHAR)
SELECT number_of_channels FROM table_233830_1 WHERE channels = "WXYZUV"
Who was the opponent at GCM D.O.G. 4?
CREATE TABLE table_71891 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" real,"Time" text,"Location" text)
SELECT "Opponent" FROM table_71891 WHERE "Event" = 'gcm – d.o.g. 4'
Which location has a capacity larger than 52,000?
CREATE TABLE table_70091 ("Project" text,"Year" text,"Location" text,"Capacity" real,"Suites" text,"Architect" text,"Cost" text)
SELECT "Location" FROM table_70091 WHERE "Capacity" > '52,000'
What is sheffield united's away team?
CREATE TABLE table_61415 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Attendance" real)
SELECT "Away team" FROM table_61415 WHERE "Home team" = 'sheffield united'
Top 150 users from Bulgaria.
CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE ...
SELECT Id, DisplayName, Reputation, WebsiteUrl, Location FROM Users WHERE Location LIKE '%Bulgaria%' OR Location LIKE '%Sofia%' ORDER BY Reputation DESC LIMIT 150
What losses did racing de santander, that scored less than 68 goals, had a goal difference of less than 23 and 10 draws?
CREATE TABLE table_name_25 (losses INTEGER,club VARCHAR,draws VARCHAR,goals_against VARCHAR,goal_difference VARCHAR)
SELECT MAX(losses) FROM table_name_25 WHERE goals_against < 68 AND goal_difference < 23 AND draws = 10 AND club = "racing de santander"
when was last time that patient 008-30575 had the minimum sao2 until 5 days ago?
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 cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text...
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 = '008-30575')) AND NOT vitalperiodic.sao2 IS NULL AND...
Which paper's title contains the word 'Database'?
CREATE TABLE authors (authid number,lname text,fname text)CREATE TABLE authorship (authid number,instid number,paperid number,authorder number)CREATE TABLE inst (instid number,name text,country text)CREATE TABLE papers (paperid number,title text)
SELECT title FROM papers WHERE title LIKE "%Database%"
what is the last drug which was prescribed to patient 016-29746 via ivs route since 96 months ago?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE microlab (microlabid number,patientunitstayid nu...
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-29746')) AND medication.routeadmin = 'ivs' AND DATETIME(medicat...
What name has a 1st (m) greater than 124.5, and a 2nd (m) greater than 136?
CREATE TABLE table_38299 ("Rank" real,"Name" text,"Nationality" text,"1st (m)" real,"2nd (m)" real,"Points" real,"Overall WC points (Rank)" text)
SELECT "Name" FROM table_38299 WHERE "1st (m)" > '124.5' AND "2nd (m)" > '136'
Which is the highest year that has 3 points?
CREATE TABLE table_name_28 (year INTEGER,points VARCHAR)
SELECT MAX(year) FROM table_name_28 WHERE points = 3
What is the average match score of CA?
CREATE TABLE ndecoreexcel_math_grade8 (year number,state text,all_students text,average_scale_score number)CREATE TABLE finrev_fed_key_17 (state_code number,state text,#_records text)CREATE TABLE finrev_fed_17 (state_code number,idcensus number,school_district text,nces_id text,yr_data number,t_fed_rev number,c14 numbe...
SELECT average_scale_score FROM ndecoreexcel_math_grade8 WHERE state = "California"
Return a scatter chart about the correlation between student_id and monthly_rental , and group by attribute other_details.
CREATE TABLE Students_in_Detention (student_id INTEGER,detention_id INTEGER,incident_id INTEGER)CREATE TABLE Addresses (address_id INTEGER,line_1 VARCHAR(120),line_2 VARCHAR(120),line_3 VARCHAR(120),city VARCHAR(80),zip_postcode VARCHAR(20),state_province_county VARCHAR(50),country VARCHAR(50),other_address_details VAR...
SELECT student_id, monthly_rental FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
what venue was before beijing , china ?
CREATE TABLE table_204_364 (id number,"year" number,"competition" text,"venue" text,"position" text,"event" text,"notes" text)
SELECT "venue" FROM table_204_364 WHERE id = (SELECT id FROM table_204_364 WHERE "venue" = 'beijing, china') - 1
When was the aircraft introduced that could seat 115 people?
CREATE TABLE table_60830 ("Aircraft" text,"Introduced" real,"Retired" text,"Seating" text,"Notes" text)
SELECT AVG("Introduced") FROM table_60830 WHERE "Seating" = '115'
What is the name of the stadium in Brisbane?
CREATE TABLE table_33512 ("Date" text,"Result" text,"Score" text,"Stadium" text,"City" text,"Crowd" real)
SELECT "Stadium" FROM table_33512 WHERE "City" = 'brisbane'
What was the status of the election featuring incumbent margaret kaiser?
CREATE TABLE table_3569 ("District" real,"Incumbent" text,"Party" text,"Elected" text,"Status" text,"2010 Candidates" text)
SELECT "Status" FROM table_3569 WHERE "Incumbent" = 'Margaret Kaiser'
What are the Poles for Season 2006
CREATE TABLE table_44589 ("Season" real,"Series" text,"Races" text,"Wins" text,"Poles" text,"F/Laps" text,"Podiums" text,"Points" text,"Position" text)
SELECT "Poles" FROM table_44589 WHERE "Season" = '2006'
Draw a bar chart for what is the name of every city that has at least 15 stations and how many stations does it have?, display Y from low to high order.
CREATE TABLE trip (id INTEGER,duration INTEGER,start_date TEXT,start_station_name TEXT,start_station_id INTEGER,end_date TEXT,end_station_name TEXT,end_station_id INTEGER,bike_id INTEGER,subscription_type TEXT,zip_code INTEGER)CREATE TABLE status (station_id INTEGER,bikes_available INTEGER,docks_available INTEGER,time ...
SELECT city, COUNT(*) FROM station GROUP BY city ORDER BY COUNT(*)
when was patient 4401's arterial bp mean first measured on the current icu visit?
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)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...
SELECT chartevents.charttime FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 4401) AND icustays.outtime IS NULL) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHE...
For countries with total number of medals less than 5 and more than 2 bronze medals, what's the lowest number of gold medals?
CREATE TABLE table_name_92 (gold INTEGER,total VARCHAR,bronze VARCHAR)
SELECT MIN(gold) FROM table_name_92 WHERE total < 5 AND bronze > 2
how many patients were admitted in the emergency room for the procedure titled percutan aspiration gb?
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND procedures.short_title = "Percutan aspiration gb"
How many total itv viewers were there for the episode with official itv hd ratings of 1.12 million?
CREATE TABLE table_29444 ("Episode" text,"Date" text,"Official ITV rating (millions)" text,"Weekly rank" real,"Share (%)" text,"Official ITV HD rating (millions)" text,"Total ITV viewers (millions)" text)
SELECT "Total ITV viewers (millions)" FROM table_29444 WHERE "Official ITV HD rating (millions)" = '1.12'
What round is sf/sg player sly williams from a year after 1965 from?
CREATE TABLE table_50037 ("Year" real,"Round" text,"Player" text,"Nationality" text,"Position" text,"College/High School/Club" text)
SELECT "Round" FROM table_50037 WHERE "Position" = 'sf/sg' AND "Year" > '1965' AND "Player" = 'sly williams'
For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of job_id and department_id .
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 regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_P...
SELECT JOB_ID, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
What Player's Score is 69-68-66-70=273?
CREATE TABLE table_62157 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text,"Money ($)" real)
SELECT "Player" FROM table_62157 WHERE "Score" = '69-68-66-70=273'
who is the constructor when the grid is more than 10 and the time/retired is +1 lap?
CREATE TABLE table_name_59 (constructor VARCHAR,grid VARCHAR,time_retired VARCHAR)
SELECT constructor FROM table_name_59 WHERE grid > 10 AND time_retired = "+1 lap"