table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE table_name_90 ( cardinal_direction VARCHAR, english VARCHAR )
What is the cardinal direction of Wednesday p.m. in English?
SELECT cardinal_direction FROM table_name_90 WHERE english = "wednesday p.m."
CREATE TABLE table_71543 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text )
What was the loss of the game attended by 14,691?
SELECT "Loss" FROM table_71543 WHERE "Attendance" = '14,691'
CREATE TABLE table_1035 ( "Player" text, "Position" text, "Starter" text, "Touchdowns" real, "Extra points" real, "Field goals" real, "Points" real )
How many field goals were made by someone playing position of right end?
SELECT COUNT("Field goals") FROM table_1035 WHERE "Position" = 'Right end'
CREATE TABLE customer ( customer_id number, store_id number, first_name text, last_name text, email text, address_id number, active boolean, create_date time, last_update time ) CREATE TABLE store ( store_id number, manager_staff_id number, address_id number, last_up...
Which language does the film AIRPORT POLLOCK use? List the language name.
SELECT T2.name FROM film AS T1 JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'AIRPORT POLLOCK'
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
provide the number of patients whose ethnicity is hispanic or latino and item id is 51132?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND lab.itemid = "51132"
CREATE TABLE table_203_723 ( id number, "year" number, "song" text, "us hot 100" number, "us msr" number, "us a.c." number, "can" number, "uk singles" number, "album" text )
what song was a hit in 1995 after i live my life for you ?
SELECT "song" FROM table_203_723 WHERE "year" = 1995 AND id > (SELECT id FROM table_203_723 WHERE "song" = '"i live my life for you"')
CREATE TABLE rooms ( roomid text, roomname text, beds number, bedtype text, maxoccupancy number, baseprice number, decor text ) CREATE TABLE reservations ( code number, room text, checkin text, checkout text, rate number, lastname text, firstname text, adults...
Find the number of rooms with king bed for each decor type.
SELECT decor, COUNT(*) FROM rooms WHERE bedtype = "King" GROUP BY decor
CREATE TABLE table_22669044_9 ( team VARCHAR, high_assists VARCHAR )
Name the team for kirk hinrich , derrick rose , john salmons (6)
SELECT team FROM table_22669044_9 WHERE high_assists = "Kirk Hinrich , Derrick Rose , John Salmons (6)"
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE TagSynonyms ( Id number...
People who has both iOS and Android badges.
SELECT Users.Id FROM Users, Badges WHERE Badges.UserId = Users.Id AND (Badges.Name = 'android')
CREATE TABLE course ( title VARCHAR, credits VARCHAR )
List the names of all courses ordered by their titles and credits.
SELECT title FROM course ORDER BY title, credits
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE prescriptions ( row_id number, subject_id number,...
count the number of patients who were diagnosed with fracture of ilium-closed but did not come back to hospital within 2 months until 2103.
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 = 'fracture o...
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 prescriptions ( subject_id text, hadm_id...
give me the number of patients whose days of hospital stay is greater than 13 and drug name is tizanidine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "13" AND prescriptions.drug = "Tizanidine"
CREATE TABLE table_33722 ( "Year" real, "Kit Supplier" text, "Sponsor" text, "Shirt Printing" text, "Notes" text )
What are the notes for the shirt that said Pavv before 2005?
SELECT "Notes" FROM table_33722 WHERE "Shirt Printing" = 'pavv' AND "Year" < '2005'
CREATE TABLE table_54907 ( "From" text, "Adult Rate" text, "Development Rate" text, "16-17 Year Olds Rate" text, "Apprentice Rate" text )
What was the adult rate when the 16-17 year old rate was 3.40?
SELECT "Adult Rate" FROM table_54907 WHERE "16-17 Year Olds Rate" = '£3.40'
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
count the number of patients whose age is less than 43 and diagnoses short title is prob-head/neck/trunk nos?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "43" AND diagnoses.short_title = "Prob-head/neck/trunk NOS"
CREATE TABLE table_name_57 ( right_ascension___j2000__ VARCHAR, constellation VARCHAR, ngc_number VARCHAR )
What is the right ascension of Pegasus with a 7343 NGC?
SELECT right_ascension___j2000__ FROM table_name_57 WHERE constellation = "pegasus" AND ngc_number = "7343"
CREATE TABLE table_name_29 ( record VARCHAR, score VARCHAR )
What is the record of the game with a score of 101 92?
SELECT record FROM table_name_29 WHERE score = "101–92"
CREATE TABLE party_events ( event_id number, event_name text, party_id number, member_in_charge_id number ) CREATE TABLE party ( party_id number, minister text, took_office text, left_office text, region_id number, party_name text ) CREATE TABLE region ( region_id number, ...
How many parties do we have?
SELECT COUNT(DISTINCT party_name) FROM party
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
among patients tested for ascites, how many of them had dysthymic disorder?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Dysthymic disorder" AND lab.fluid = "Ascites"
CREATE TABLE table_name_7 ( goals INTEGER, nat VARCHAR, transfer_fee VARCHAR )
Name the highest goals for youth system and ita
SELECT MAX(goals) FROM table_name_7 WHERE nat = "ita" AND transfer_fee = "youth system"
CREATE TABLE table_name_15 ( course VARCHAR, type VARCHAR )
Which course has km (mi) as a type?
SELECT course FROM table_name_15 WHERE type = "km (mi)"
CREATE TABLE table_name_83 ( site VARCHAR, attendance VARCHAR, date VARCHAR )
What Site has Attendance of 53,000, and a Date of october 21, 1967?
SELECT site FROM table_name_83 WHERE attendance = "53,000" AND date = "october 21, 1967"
CREATE TABLE table_72678 ( "Player" text, "G" real, "Tackles" real, "Solo" real, "Assts" real, "Sacks" text, "Int" real, "Int yards" real, "Int avg." text, "Int TD" real, "Fum. rec" real, "Fum. rec TD" real )
Name the most tackles for 3.5 sacks
SELECT MAX("Tackles") FROM table_72678 WHERE "Sacks" = '3.5'
CREATE TABLE Financial_Transactions ( transaction_id INTEGER, previous_transaction_id INTEGER, account_id INTEGER, card_id INTEGER, transaction_type VARCHAR(15), transaction_date DATETIME, transaction_amount DOUBLE, transaction_comment VARCHAR(255), other_transaction_details VARCHAR(...
Plot a scatter chart, customer id by card_number.
SELECT customer_id, card_number FROM Customers_Cards
CREATE TABLE table_70994 ( "Week" real, "Date" text, "Kickoff ( ET )" text, "Opponent" text, "Result" text, "Record" text, "Game Site" text )
Who was the opponent at the Steelers game that had a result of l 20 17?
SELECT "Opponent" FROM table_70994 WHERE "Result" = 'l 20–17'
CREATE TABLE table_name_59 ( date VARCHAR, opponents_in_the_final VARCHAR )
What is Date, when Opponents In The Final, is Maria-Fernanda Alves St phanie Dubois?
SELECT date FROM table_name_59 WHERE opponents_in_the_final = "maria-fernanda alves stéphanie dubois"
CREATE TABLE table_name_92 ( week INTEGER, result VARCHAR, attendance VARCHAR )
Which Week is the highest one that has a Result of w 23-20, and an Attendance smaller than 34,127?
SELECT MAX(week) FROM table_name_92 WHERE result = "w 23-20" AND attendance < 34 OFFSET 127
CREATE TABLE table_name_79 ( city___state VARCHAR, event_circuit VARCHAR )
What city is the hidden valley raceway in?
SELECT city___state FROM table_name_79 WHERE event_circuit = "hidden valley raceway"
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CRE...
what is the daily average g tube output that patient 006-171217 has had in 01/last year?
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 = '006-171217')) AND intakeoutput.celllabel = 'g tu...
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 job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), ...
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about employee_id over the phone_number by a bar chart.
SELECT PHONE_NUMBER, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
CREATE TABLE table_204_435 ( id number, "sport" text, "gold" number, "silver" number, "bronze" number, "total" number )
what sport has more silver medals : wrestling or rowing
SELECT "sport" FROM table_204_435 WHERE "sport" IN ('wrestling', 'rowing') ORDER BY "silver" DESC LIMIT 1
CREATE TABLE table_204_131 ( id number, "tops design code" text, "electrical system" text, "max speed" text, "weight" text, "brakes" text, "route availability" number, "notes" text )
is 08-0av heavier than 08-0lx ?
SELECT (SELECT "weight" FROM table_204_131 WHERE "tops design code" = '08-0av') > (SELECT "weight" FROM table_204_131 WHERE "tops design code" = '08-0lx')
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
Stacked bar chart of school_id for with each ACC_Home in each acc road, list in desc by the names.
SELECT ACC_Road, School_ID FROM basketball_match GROUP BY ACC_Home, ACC_Road ORDER BY ACC_Road DESC
CREATE TABLE table_name_42 ( total_medals VARCHAR, ensemble VARCHAR, silver_medals VARCHAR )
What was the total number of medals received by James Logan High School when it received less than 1 silver medal?
SELECT COUNT(total_medals) FROM table_name_42 WHERE ensemble = "james logan high school" AND silver_medals < 1
CREATE TABLE table_72581 ( "Cardinal direction" text, "Burmese" text, "Sanskrit" text, "English" text, "Planet" text, "Sign" text )
What is the Burmese term associated with a cardinal direction of west?
SELECT "Burmese" FROM table_72581 WHERE "Cardinal direction" = 'West'
CREATE TABLE table_39269 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Game site" text, "Attendance" text )
When is it has 15,557 Attendances?
SELECT "Date" FROM table_39269 WHERE "Attendance" = '15,557'
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, ...
give me the number of patients whose insurance is private and diagnoses icd9 code is 45341?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Private" AND diagnoses.icd9_code = "45341"
CREATE TABLE table_name_34 ( city_of_license VARCHAR, resolution VARCHAR, official_website VARCHAR )
Name the city of license with resolution of sd 480i and official website of telemundo.com
SELECT city_of_license FROM table_name_34 WHERE resolution = "sd 480i" AND official_website = "telemundo.com"
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
what is days of hospital stay and primary disease of subject id 8323?
SELECT demographic.days_stay, demographic.diagnosis FROM demographic WHERE demographic.subject_id = "8323"
CREATE TABLE table_name_39 ( total INTEGER, bronze VARCHAR, gold VARCHAR, rank VARCHAR )
What is the average total for teams with more than 1 gold, ranked over 3 and more than 3 bronze?
SELECT AVG(total) FROM table_name_39 WHERE gold > 1 AND rank > 3 AND bronze > 3
CREATE TABLE table_22707 ( "Period" text, "Live births per year" text, "Deaths per year" text, "Natural change per year" text, "CBR*" text, "CDR*" text, "NC*" text, "TFR*" text, "IMR*" real, "Life expectancy total" text, "Life expectancy males" text, "Life expectancy fema...
How many live births per year are there in the period where the life expectancy for females is 73.3?
SELECT "Live births per year" FROM table_22707 WHERE "Life expectancy females" = '73.3'
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 diagnoses ( ...
how many patients whose gender is m and days of hospital stay is greater than 7?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.days_stay > "7"
CREATE TABLE table_name_67 ( draw INTEGER, performer VARCHAR, points VARCHAR )
Which Draw has a Performer of jenny newman, and Points smaller than 77?
SELECT AVG(draw) FROM table_name_67 WHERE performer = "jenny newman" AND points < 77
CREATE TABLE table_name_75 ( home_team VARCHAR, away_team VARCHAR )
Which team played as the home team when north melbourne played as away?
SELECT home_team FROM table_name_75 WHERE away_team = "north melbourne"
CREATE TABLE table_name_7 ( score VARCHAR, home VARCHAR )
What was the score for the game with FK Bratstvo as home team?
SELECT score FROM table_name_7 WHERE home = "fk bratstvo"
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 ...
tell me the percentile of hematocrit 35.0 among all patients of the same age as patient 99791 on their first hospital visit?
SELECT DISTINCT t1.c1 FROM (SELECT labevents.valuenum, PERCENT_RANK() OVER (ORDER BY labevents.valuenum) AS c1 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'hematocrit') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.ag...
CREATE TABLE table_name_61 ( set_2 VARCHAR, set_1 VARCHAR )
What shows for set 2 when Set 1 is 29 27?
SELECT set_2 FROM table_name_61 WHERE set_1 = "29–27"
CREATE TABLE table_67167 ( "Pick #" text, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
What team draft a player from Canada that was picked #43 and plays right wing?
SELECT "NHL team" FROM table_67167 WHERE "Nationality" = 'canada' AND "Position" = 'right wing' AND "Pick #" = '43'
CREATE TABLE flight ( flno number(4,0), origin varchar2(20), destination varchar2(20), distance number(6,0), departure_date date, arrival_date date, price number(7,2), aid number(9,0) ) CREATE TABLE employee ( eid number(9,0), name varchar2(30), salary number(10,2) ) CREATE...
Show me distance by name in a histogram, and order names from low to high order please.
SELECT name, distance FROM aircraft ORDER BY name
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE chartevents ...
what was the first time that patient 1249 had the maximum arterial bp [systolic] until 07/05/2105?
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 = 1249)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial ...
CREATE TABLE table_name_39 ( association VARCHAR, result VARCHAR, nominee VARCHAR, year VARCHAR )
What was the association for Indonesian Idol after 2005 with a Nominated Result?
SELECT association FROM table_name_39 WHERE nominee = "indonesian idol" AND year > 2005 AND result = "nominated"
CREATE TABLE table_74716 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
What is the largest crowd size at a match against the Chicago Cardinals after Week 10 of the season?
SELECT MAX("Attendance") FROM table_74716 WHERE "Opponent" = 'chicago cardinals' AND "Week" > '10'
CREATE TABLE table_name_51 ( laps INTEGER, driver VARCHAR )
What is the highest number of laps for chris amon?
SELECT MAX(laps) FROM table_name_51 WHERE driver = "chris amon"
CREATE TABLE table_name_51 ( total INTEGER, tour VARCHAR, giro VARCHAR )
The sun of total that has a tour of 7 and a Giro smaller than 3 is 12.
SELECT SUM(total) FROM table_name_51 WHERE tour = 7 AND giro < 3
CREATE TABLE table_41411 ( "Name" text, "Status" text, "Authors" text, "Location" text, "Notes" text )
Which Notes has Authors of zhou clarke zhang?
SELECT "Notes" FROM table_41411 WHERE "Authors" = 'zhou clarke zhang'
CREATE TABLE advisor ( s_ID varchar(5), i_ID varchar(5) ) CREATE TABLE instructor ( ID varchar(5), name varchar(20), dept_name varchar(20), salary numeric(8,2) ) CREATE TABLE teaches ( ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric...
Return a histogram on what are the names and budgets of departments with budgets greater than the average?, order by the budget from high to low.
SELECT dept_name, budget FROM department WHERE budget > (SELECT AVG(budget) FROM department) ORDER BY budget DESC
CREATE TABLE table_25800134_18 ( series__number INTEGER, season__number VARCHAR )
name the most series number for season 22
SELECT MAX(series__number) FROM table_25800134_18 WHERE season__number = 22
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE cost ( costid number, uniquepid text,...
how many times has the zofran been ordered for patient 006-66039 since 179 months ago?
SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-66039')) AND medication.drugname = 'zofran' AND DATETIME(medication.drugst...
CREATE TABLE table_name_87 ( opponent VARCHAR, week VARCHAR, date VARCHAR )
Who was the opponent for the game taht was before week 5 on October 10, 1954?
SELECT opponent FROM table_name_87 WHERE week < 5 AND date = "october 10, 1954"
CREATE TABLE table_1875157_2 ( starts INTEGER, winnings VARCHAR )
How many starts were there when the winnings are $690,321?
SELECT MIN(starts) FROM table_1875157_2 WHERE winnings = "$690,321"
CREATE TABLE table_41747 ( "Variant id" text, "5\u2019UTR splice" text, "Coding" text, "3\u2019UTR sequence" text, "GenBank id" text )
Which coding's variant id is abd'1a 3?
SELECT "Coding" FROM table_41747 WHERE "Variant id" = 'abd''1a 3'
CREATE TABLE has_amenity ( dormid number, amenid number ) CREATE TABLE dorm ( dormid number, dorm_name text, student_capacity number, gender text ) CREATE TABLE lives_in ( stuid number, dormid number, room_number number ) CREATE TABLE student ( stuid number, lname text, ...
How many girl students who are younger than 25?
SELECT COUNT(*) FROM student WHERE sex = 'F' AND age < 25
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions...
give me the number of patients whose gender is f and drug code is azit500i?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "F" AND prescriptions.formulary_drug_cd = "AZIT500I"
CREATE TABLE table_name_24 ( year INTEGER, wins INTEGER )
What is the lowest year that have wins greater than 0?
SELECT MIN(year) FROM table_name_24 WHERE wins > 0
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartr...
how did patient 027-4674 get admitted to the hospital for the first time until 1 year ago?
SELECT patient.hospitaladmitsource FROM patient WHERE patient.uniquepid = '027-4674' AND DATETIME(patient.hospitaladmittime) <= DATETIME(CURRENT_TIME(), '-1 year') ORDER BY patient.hospitaladmittime LIMIT 1
CREATE TABLE table_47400 ( "Position" real, "Club" text, "Played" real, "Points" real, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real )
What is the total number of goals when there are 3 draws, more than 18 losses, and played is smaller than 38?
SELECT COUNT("Goals for") FROM table_47400 WHERE "Draws" = '3' AND "Losses" > '18' AND "Played" < '38'
CREATE TABLE table_36082 ( "Name" text, "Species Specific" text, "Intra-molecular structure" text, "Comparative" text, "Link" text )
Which Name has an Intra-molecular structure of no, and a Link of webserver, and a Comparative of no?
SELECT "Name" FROM table_36082 WHERE "Intra-molecular structure" = 'no' AND "Link" = 'webserver' AND "Comparative" = 'no'
CREATE TABLE table_name_18 ( draw INTEGER, performer VARCHAR, televotes VARCHAR )
Name the lowest Draw which has a Performer of kaliopi and a Televotes larger than 3834?
SELECT MIN(draw) FROM table_name_18 WHERE performer = "kaliopi" AND televotes > 3834
CREATE TABLE table_23812628_1 ( team__number1 VARCHAR, team__number2 VARCHAR )
Name the team number 1 for san lorenzo
SELECT team__number1 FROM table_23812628_1 WHERE team__number2 = "San Lorenzo"
CREATE TABLE table_35120 ( "Call sign" text, "Frequency MHz" real, "City of license" text, "ERP W" real, "Class" text, "FCC info" text )
What is the FCC info for the city of Tribune, Kansas?
SELECT "FCC info" FROM table_35120 WHERE "City of license" = 'tribune, kansas'
CREATE TABLE table_name_84 ( score VARCHAR, date VARCHAR )
What was the score from the game played on June 22?
SELECT score FROM table_name_84 WHERE date = "june 22"
CREATE TABLE bridge ( architect_id int, id int, name text, location text, length_meters real, length_feet real ) CREATE TABLE architect ( id text, name text, nationality text, gender text ) CREATE TABLE mill ( architect_id int, id int, location text, name text, ...
Give me a histogram for what are the ids and names of the architects who built at least 3 bridges ?, sort by the names in ascending.
SELECT T1.name, T1.id FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id ORDER BY T1.name
CREATE TABLE table_dev_17 ( "id" int, "gender" string, "white_blood_cell_count_wbc" int, "hemoglobin_a1c_hba1c" float, "cd4_count" int, "dyslipidemia" bool, "renal_disease" bool, "fasting_blood_glucose_fbg" float, "creatinine_clearance_cl" float, "platelet_count" float, "high...
fast blood glucose ( fbg ) >= 7 mmol / l, and hemoglobin a1c ( hgba1c ) >= 7 %
SELECT * FROM table_dev_17 WHERE fasting_blood_glucose_fbg >= 7 AND hemoglobin_a1c_hba1c >= 7
CREATE TABLE table_name_53 ( winner VARCHAR, year VARCHAR )
who was the winner in 2003?
SELECT winner FROM table_name_53 WHERE year = "2003"
CREATE TABLE table_203_586 ( id number, "#" number, "nation" text, "qualification tournament" text, "place in qt" number, "sailor" text )
list the nation which participated in the 2008 worlds qualification tournament and hans spitzauer was one of the sailors .
SELECT "nation" FROM table_203_586 WHERE "qualification tournament" = '2008 worlds' AND "sailor" = 'hans spitzauer'
CREATE TABLE procedures_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, ...
what is the total dosage of levothyroxine sodium that patient 5887 has been prescribed in 11/this year?
SELECT SUM(prescriptions.dose_val_rx) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5887) AND prescriptions.drug = 'levothyroxine sodium' AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 ye...
CREATE TABLE table_name_11 ( format VARCHAR, catalog INTEGER )
Which Format has a Catalog smaller than 61298?
SELECT format FROM table_name_11 WHERE catalog < 61298
CREATE TABLE table_7859 ( "Position" real, "Club" text, "Played" real, "Points" real, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real )
What is the average points with less than 30 played?
SELECT AVG("Points") FROM table_7859 WHERE "Played" < '30'
CREATE TABLE table_name_32 ( Id VARCHAR )
What is the value for 2011 corresponding to a 2007 value of 1r?
SELECT 2011 FROM table_name_32 WHERE 2007 = "1r"
CREATE TABLE table_6174 ( "Date" text, "Tournament" text, "Location" text, "Winner" text, "Score" text, "1st prize ( $ )" real )
How many 1st prizes have a Date of aug 17?
SELECT COUNT("1st prize ( $ )") FROM table_6174 WHERE "Date" = 'aug 17'
CREATE TABLE Accounts ( account_id INTEGER, customer_id INTEGER, date_account_opened DATETIME, account_name VARCHAR(50), other_account_details VARCHAR(255) ) CREATE TABLE Product_Categories ( production_type_code VARCHAR(15), product_type_description VARCHAR(80), vat_rating DECIMAL(19,4...
Draw a pie chart for what are the first names and ids for customers who have two or more accounts?
SELECT T2.customer_first_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id
CREATE TABLE table_52213 ( "Year" real, "Theme" text, "Artist" text, "Mintage" text, "Issue Price" text )
What is the theme of the Year 2002 which was created by Artist Dan Fell?
SELECT "Theme" FROM table_52213 WHERE "Year" = '2002' AND "Artist" = 'dan fell'
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, Mark...
Deleted user's answers (w. scores & attributed questions).
SELECT a.Id AS link, q.Title AS title, q.Body AS question, q.OwnerUserId AS asker, q.OwnerDisplayName AS asker_name, a.Body AS answer, q.Tags AS tags, a.Score AS score FROM Posts AS q INNER JOIN Posts AS a ON q.Id = a.ParentId AND a.PostTypeId = 2 AND q.PostTypeId = 1 WHERE a.CommunityOwnedDate IS NULL AND a.OwnerDispl...
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE fare ( fare_id int, from_...
i wish to book a flight from PITTSBURGH to ATLANTA COACH discount fare
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, fare, fare_basis AS FARE_BASIS_0, fare_basis AS FARE_BASIS_1, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND F...
CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int ) CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text )
Stack bar chart of the number of type vs Nationality based on type, and list x-axis in descending order.
SELECT Type, COUNT(Type) FROM ship GROUP BY Nationality, Type ORDER BY Type DESC
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 intakeoutput ( in...
how many days have passed since patient 007-15837 had a d5w intake for the first time on the current intensive care unit visit?
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 =...
CREATE TABLE table_23425 ( "Team" text, "Province" text, "Owner(s)" text, "Price" text, "Captain" text, "Head coach" text, "Icon Player" text )
In how many teams is Waqar Younis the head coach?
SELECT COUNT("Team") FROM table_23425 WHERE "Head coach" = 'Waqar Younis'
CREATE TABLE table_name_48 ( class VARCHAR, wheel_arrangement VARCHAR, quantity_made VARCHAR )
What is the locomotive class that has a wheel arrangement of 2-8-2 and a quantity made of 25?
SELECT class FROM table_name_48 WHERE wheel_arrangement = "2-8-2" AND quantity_made = "25"
CREATE TABLE table_name_5 ( score VARCHAR, year VARCHAR, country VARCHAR )
What is the Score, when the Year is after 2007, and when the Country is England?
SELECT score FROM table_name_5 WHERE year > 2007 AND country = "england"
CREATE TABLE table_8723 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is the Country of the Player with a Score of 75-70-74=219?
SELECT "Country" FROM table_8723 WHERE "Score" = '75-70-74=219'
CREATE TABLE table_name_48 ( cost___usd__ VARCHAR, latest_stable_date__version_ VARCHAR )
Name the cost for latest stable date of online
SELECT cost___usd__ FROM table_name_48 WHERE latest_stable_date__version_ = "online"
CREATE TABLE table_name_70 ( opponent VARCHAR, score VARCHAR )
What is the oppenent when the score was 5 0?
SELECT opponent FROM table_name_70 WHERE score = "5–0"
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
count the number of patients whose ethnicity is white - russian and admission year is less than 2150?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND demographic.admityear < "2150"
CREATE TABLE table_203_358 ( id number, "pos." number, "athlete" text, "run 1" number, "run 2" number, "total" text )
what 's the difference between adam cole 's first run and his second run ?
SELECT ABS((SELECT "run 1" FROM table_203_358 WHERE "athlete" = 'adam cole') - (SELECT "run 2" FROM table_203_358 WHERE "athlete" = 'adam cole'))
CREATE TABLE table_12028543_3 ( season VARCHAR, losingteam VARCHAR )
How many seasons was the losing team Adelaide City?
SELECT COUNT(season) FROM table_12028543_3 WHERE losingteam = "Adelaide City"
CREATE TABLE table_name_80 ( venue VARCHAR, goal INTEGER )
What venue had less than 2 goals?
SELECT venue FROM table_name_80 WHERE goal < 2
CREATE TABLE WINE ( Name VARCHAR )
List the names of all distinct wines in alphabetical order.
SELECT DISTINCT Name FROM WINE ORDER BY Name
CREATE TABLE table_name_22 ( wins INTEGER, events INTEGER )
What is the average number of wins for events larger than 28?
SELECT AVG(wins) FROM table_name_22 WHERE events > 28
CREATE TABLE table_23944006_4 ( surface VARCHAR, opponents VARCHAR )
Name the surface for cara black rennae stubbs
SELECT surface FROM table_23944006_4 WHERE opponents = "Cara Black Rennae Stubbs"
CREATE TABLE table_203_251 ( id number, "place" text, "player" text, "country" text, "score" text, "to par" number )
how many total players played ?
SELECT COUNT("player") FROM table_203_251