text
stringlengths
432
6.49k
target
stringlengths
2
4.44k
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) TABLE: 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 time, hospitaldischargetime time, hospitaldischargestatus text ) TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) ### Question ### what was the name of the drug prescribed to patient 029-19659 within the same day after having been in 04/2104 diagnosed with acute respiratory failure - etiology unknown? ### Accurate SQL ###
SELECT t2.drugname FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-19659') AND diagnosis.diagnosisname = 'acute respiratory failure - etiology unknown' AND STRFTIME('%y-%m', diagnosis.diagnosistime) = '2104-04') AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-19659') AND STRFTIME('%y-%m', medication.drugstarttime) = '2104-04') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.drugstarttime AND DATETIME(t1.diagnosistime, 'start of day') = DATETIME(t2.drugstarttime, 'start of day')
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_11082 ( "Episode Air Date" text, "Audition City" text, "Date" text, "First Audition Venue" text, "Callback Date" text, "Callback Venue" text, "Golden Tickets" real ) ### Question ### How many golden tickets were given out when the auditions were held in San Francisco, California? ### Accurate SQL ###
SELECT COUNT("Golden Tickets") FROM table_11082 WHERE "Audition City" = 'san francisco, california'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_54051 ( "Year" text, "Winner" text, "Jockey" text, "Trainer" text, "Owner" text, "Time" text, "Purse" text ) ### Question ### Who is the Trainer with the Year of 2013? ### Accurate SQL ###
SELECT "Trainer" FROM table_54051 WHERE "Year" = '2013'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Residents ( date_moved_in INTEGER ) ### Question ### When is the last day any resident moved in? ### Accurate SQL ###
SELECT MAX(date_moved_in) FROM Residents
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_25933764_1 ( w INTEGER, locale VARCHAR, Ontario VARCHAR ) ### Question ### If the locale is Ontario, what is the W minimum? ### Accurate SQL ###
SELECT MIN(w) FROM table_25933764_1 WHERE locale = Ontario
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_69910 ( "Region" text, "Date" text, "Label" text, "Format" text, "Catalog" text ) ### Question ### What is the format for July 27, 1994? ### Accurate SQL ###
SELECT "Format" FROM table_69910 WHERE "Date" = 'july 27, 1994'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Participants ( Participant_ID INTEGER, Participant_Type_Code CHAR(15), Participant_Details VARCHAR(255) ) TABLE: CREATE TABLE Services ( Service_ID INTEGER, Service_Type_Code CHAR(15) ) TABLE: CREATE TABLE Events ( Event_ID INTEGER, Service_ID INTEGER, Event_Details VARCHAR(255) ) TABLE: CREATE TABLE Participants_in_Events ( Event_ID INTEGER, Participant_ID INTEGER ) ### Question ### Compare the number of participants in each participant type code using a bar chart, order from low to high by the X-axis please. ### Accurate SQL ###
SELECT Participant_Type_Code, COUNT(Participant_Type_Code) FROM Participants GROUP BY Participant_Type_Code ORDER BY Participant_Type_Code
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_29225103_2 (gm_winning_team VARCHAR, ep_winning_team VARCHAR) ### Question ### Who the GM winning team when the EP winning team was #37 Porsche? ### Accurate SQL ###
SELECT gm_winning_team FROM table_29225103_2 WHERE ep_winning_team = "#37 Porsche"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_2623498_5 ( prod_code VARCHAR, episode__number VARCHAR ) ### Question ### What is the number of production codes for episode #73? ### Accurate SQL ###
SELECT COUNT(prod_code) FROM table_2623498_5 WHERE episode__number = "73"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: 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 ) TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) TABLE: 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 ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) TABLE: 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 ) TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) ### Question ### when did patient 18841 get admitted to the hospital for the first time the last year via emergency room admitting? ### Accurate SQL ###
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 18841 AND admissions.admission_location = 'emergency room admit' AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY admissions.admittime LIMIT 1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_32696 ( "Year" text, "Date" text, "Stages" text, "Distance" text, "Winner" text ) ### Question ### What stage was 1,648 km achieved? ### Accurate SQL ###
SELECT "Stages" FROM table_32696 WHERE "Distance" = '1,648 km'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_32 ( date VARCHAR, week VARCHAR ) ### Question ### What's the game date for week 7? ### Accurate SQL ###
SELECT date FROM table_name_32 WHERE week = 7
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_25382 ( "No." real, "Player" text, "Position" text, "Height" text, "Weight" real, "Class" text, "Hometown" text ) ### Question ### Who are the player's who weighed 170? ### Accurate SQL ###
SELECT "Player" FROM table_25382 WHERE "Weight" = '170'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_203_633 ( id number, "title" text, "year" number, "platform" text, "developer" text, "publisher" text ) ### Question ### how many consecutive games were released in 2006 ? ### Accurate SQL ###
SELECT COUNT("title") FROM table_203_633 WHERE "year" = 2006
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_25155 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Partner" text, "Opponents in the final" text, "Score in the final" text ) ### Question ### What was the partner count when the opponents in the final was forget leconte? ### Accurate SQL ###
SELECT COUNT("Partner") FROM table_25155 WHERE "Opponents in the final" = 'Forget Leconte'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_15 ( silver VARCHAR, year VARCHAR ) ### Question ### Who won silver in 1982? ### Accurate SQL ###
SELECT silver FROM table_name_15 WHERE year = 1982
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_203_374 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number ) ### Question ### who was the only nation with more total medals than belgium ? ### Accurate SQL ###
SELECT "nation" FROM table_203_374 WHERE "total" > (SELECT "total" FROM table_203_374 WHERE "nation" = 'belgium')
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_76293 ( "Name" text, "City" text, "Years as tallest" text, "Height ft / m" text, "Floors" real ) ### Question ### What building in Louisville had more than 35 floors? ### Accurate SQL ###
SELECT "Name" FROM table_76293 WHERE "City" = 'louisville' AND "Floors" > '35'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_27725 ( "Institution" text, "Location" text, "Nickname" text, "Founded" real, "Type" text, "Enrollment" real, "Joined" real, "Left" real, "Current Conference" text ) ### Question ### What location is nicknamed the 49ers? ### Accurate SQL ###
SELECT "Location" FROM table_27725 WHERE "Nickname" = '49ers'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_24945 ( "Rank" real, "Athlete" text, "Nation" text, "Olympics" text, "Gold" real, "Silver" real, "Bronze" real, "Total(min. 2 medals)" real ) ### Question ### What is the maximum number of golds? ### Accurate SQL ###
SELECT MAX("Gold") FROM table_24945
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_30120619_1 (barony VARCHAR, townland VARCHAR) ### Question ### What is the barony for the Ballintaggart townland? ### Accurate SQL ###
SELECT barony FROM table_30120619_1 WHERE townland = "Ballintaggart"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) TABLE: 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 ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text ) TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: 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 ) TABLE: 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 ) TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) ### Question ### have there been any microbiological tests for patient 9519 since 5 years ago? ### Accurate SQL ###
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9519) AND DATETIME(microbiologyevents.charttime) >= DATETIME(CURRENT_TIME(), '-5 year')
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_50018 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text ) ### Question ### What is the country with a 76-68=144 score? ### Accurate SQL ###
SELECT "Country" FROM table_50018 WHERE "Score" = '76-68=144'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_11633 ( "Pick" real, "Player" text, "Team" text, "Position" text, "School" text ) ### Question ### From which school did the Minnesota Twins SS come from? ### Accurate SQL ###
SELECT "School" FROM table_11633 WHERE "Team" = 'minnesota twins' AND "Position" = 'ss'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_1676 ( "Series #" real, "Season #" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text ) ### Question ### Name who directed the episode by joe sachs and david zabel ### Accurate SQL ###
SELECT "Directed by" FROM table_1676 WHERE "Written by" = 'Joe Sachs and David Zabel'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_85 (wicket VARCHAR, runs VARCHAR) ### Question ### Which wicket had 580 runs? ### Accurate SQL ###
SELECT wicket FROM table_name_85 WHERE runs = "580"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_20529 ( "Institution" text, "Location" text, "Founded" real, "Affiliation" text, "Enrollment" real, "Team Nickname" text, "Primary conference" text ) ### Question ### Which school's team has the nickname of the Wildcats? ### Accurate SQL ###
SELECT "Institution" FROM table_20529 WHERE "Team Nickname" = 'Wildcats'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: 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 ) TABLE: 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 text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### what is the number of patients with liver transplant primary disease who had open and other replacement of mitral valve with tissue graft? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "LIVER TRANSPLANT" AND procedures.short_title = "Opn/oth rep mtrl vlv-tis"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_1 (wins INTEGER, goals_for INTEGER) ### Question ### What is the low win count with more than 72 goals? ### Accurate SQL ###
SELECT MIN(wins) FROM table_name_1 WHERE goals_for > 72
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Products ( Product_Name VARCHAR, Product_ID VARCHAR ) TABLE: CREATE TABLE Products_in_Events ( Product_ID VARCHAR ) ### Question ### Show the names of products and the number of events they are in. ### Accurate SQL ###
SELECT T1.Product_Name, COUNT(*) FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_59598 ( "Outcome" text, "Date" real, "Tournament" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text ) ### Question ### What Tournament has an Outcome of winner, and Opponents of eddie dibbs harold solomon? ### Accurate SQL ###
SELECT "Tournament" FROM table_59598 WHERE "Outcome" = 'winner' AND "Opponents" = 'eddie dibbs harold solomon'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE school (Enrollment INTEGER) ### Question ### What is the average enrollment of schools? ### Accurate SQL ###
SELECT AVG(Enrollment) FROM school
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_92 (played INTEGER, draw INTEGER) ### Question ### What is the lowest number of games played where they tied more than 7 of them? ### Accurate SQL ###
SELECT MIN(played) FROM table_name_92 WHERE draw > 7
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_22 (opponent VARCHAR, date VARCHAR) ### Question ### Who did the Red Sox play against on July 8? ### Accurate SQL ###
SELECT opponent FROM table_name_22 WHERE date = "july 8"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_203_489 ( id number, "year" number, "title" text, "system" text, "developer" text, "publisher" text ) ### Question ### what was the game made in the year previous to 1994 ? ### Accurate SQL ###
SELECT "title" FROM table_203_489 WHERE "year" < 1994 ORDER BY "year" DESC LIMIT 1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_80 (pressure VARCHAR, name VARCHAR) ### Question ### What pressure is Ken? ### Accurate SQL ###
SELECT pressure FROM table_name_80 WHERE name = "ken"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_18 ( year_s__won VARCHAR, country VARCHAR, to_par VARCHAR, total VARCHAR ) ### Question ### Can you tell me the Year(s) Won that has the To par larger than 5, and the Total smaller than 155, and the Country of united states? ### Accurate SQL ###
SELECT year_s__won FROM table_name_18 WHERE to_par > 5 AND total < 155 AND country = "united states"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_33 (date VARCHAR, region VARCHAR, catalog VARCHAR) ### Question ### What Date has the Region Europe and a Catalog of 74321 45851 2? ### Accurate SQL ###
SELECT date FROM table_name_33 WHERE region = "europe" AND catalog = "74321 45851 2"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE gymnast ( Gymnast_ID VARCHAR ) TABLE: CREATE TABLE people ( Name VARCHAR, People_ID VARCHAR, Hometown VARCHAR ) ### Question ### What are the names of gymnasts whose hometown is not 'Santo Domingo'? ### Accurate SQL ###
SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID WHERE T2.Hometown <> "Santo Domingo"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_181240_1 ( modern_german__standard_wording_ VARCHAR, english___bcp__ VARCHAR ) ### Question ### What is the english (bcp) phrase 'for thine is the kingdom, the power' in modern german with standard wording? ### Accurate SQL ###
SELECT modern_german__standard_wording_ FROM table_181240_1 WHERE english___bcp__ = "For thine is the kingdom, the power"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE instructor ( id text, name text, dept_name text, salary number ) TABLE: CREATE TABLE takes ( id text, course_id text, sec_id text, semester text, year number, grade text ) TABLE: CREATE TABLE prereq ( course_id text, prereq_id text ) TABLE: CREATE TABLE classroom ( building text, room_number text, capacity number ) TABLE: CREATE TABLE section ( course_id text, sec_id text, semester text, year number, building text, room_number text, time_slot_id text ) TABLE: CREATE TABLE student ( id text, name text, dept_name text, tot_cred number ) TABLE: CREATE TABLE time_slot ( time_slot_id text, day text, start_hr number, start_min number, end_hr number, end_min number ) TABLE: CREATE TABLE teaches ( id text, course_id text, sec_id text, semester text, year number ) TABLE: CREATE TABLE course ( course_id text, title text, dept_name text, credits number ) TABLE: CREATE TABLE department ( dept_name text, building text, budget number ) TABLE: CREATE TABLE advisor ( s_id text, i_id text ) ### Question ### What are the names of instructors who have taught C Programming courses? ### Accurate SQL ###
SELECT T1.name FROM instructor AS T1 JOIN teaches AS T2 ON T1.id = T2.id JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.title = 'C Programming'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_24990183_6 ( Id VARCHAR ) ### Question ### What is the lowest overall number of 09-10 oi 2nd? ### Accurate SQL ###
SELECT MIN(09 AS _10_oi_2nd) FROM table_24990183_6
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_1139835_3 (grand_finalist VARCHAR, scores VARCHAR) ### Question ### who is the grand finalist where scores is 8.9 (57) – 7.12 (54) ### Accurate SQL ###
SELECT grand_finalist FROM table_1139835_3 WHERE scores = "8.9 (57) – 7.12 (54)"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) TABLE: CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) ### Question ### For those records from the products and each product's manufacturer, visualize a scatter chart about the correlation between price and revenue , and group by attribute headquarter. ### Accurate SQL ###
SELECT Price, Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_27846651_1 (writer VARCHAR, viewers__millions_ VARCHAR) ### Question ### Who wrote the episode that had 5.93 million viewers? ### Accurate SQL ###
SELECT writer FROM table_27846651_1 WHERE viewers__millions_ = "5.93"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_5 ( realization VARCHAR, phoneme VARCHAR, example VARCHAR ) ### Question ### Name the realization for phoneme of /i/ and example of /id a/ ### Accurate SQL ###
SELECT realization FROM table_name_5 WHERE phoneme = "/i/" AND example = "/idːa/"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_9426 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text ) ### Question ### What was the to par of the player of who scored 70-70=140? ### Accurate SQL ###
SELECT "To par" FROM table_9426 WHERE "Score" = '70-70=140'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Documents_with_Expenses ( Document_ID INTEGER, Budget_Type_Code CHAR(15), Document_Details VARCHAR(255) ) TABLE: CREATE TABLE Accounts ( Account_ID INTEGER, Statement_ID INTEGER, Account_Details VARCHAR(255) ) TABLE: CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15), Document_Type_Name VARCHAR(255), Document_Type_Description VARCHAR(255) ) TABLE: CREATE TABLE Statements ( Statement_ID INTEGER, Statement_Details VARCHAR(255) ) TABLE: CREATE TABLE Projects ( Project_ID INTEGER, Project_Details VARCHAR(255) ) TABLE: CREATE TABLE Ref_Budget_Codes ( Budget_Type_Code CHAR(15), Budget_Type_Description VARCHAR(255) ) TABLE: CREATE TABLE Documents ( Document_ID INTEGER, Document_Type_Code CHAR(15), Project_ID INTEGER, Document_Date DATETIME, Document_Name VARCHAR(255), Document_Description VARCHAR(255), Other_Details VARCHAR(255) ) ### Question ### Show the number of documents created in each day and bin document date by year interval and group by document type description with a group line chart, sort by the Document_Date in ascending. ### Accurate SQL ###
SELECT Document_Date, COUNT(Document_Date) FROM Ref_Document_Types AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code GROUP BY Document_Type_Description ORDER BY Document_Date
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_42 (date VARCHAR, total VARCHAR) ### Question ### What date was the total 75–45? ### Accurate SQL ###
SELECT date FROM table_name_42 WHERE total = "75–45"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_19146 ( "Season" real, "Class" text, "Team" text, "Motorcycle" text, "Type" text, "Races" real, "Wins" real, "Podiums" real, "Poles" real, "Fastest Laps" real, "Pts" text, "Position" text ) ### Question ### what's the pts with poles being smaller than 1.0 and motorcycle being aprilia and class being 250cc ### Accurate SQL ###
SELECT "Pts" FROM table_19146 WHERE "Poles" < '1.0' AND "Motorcycle" = 'Aprilia' AND "Class" = '250cc'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_52 (opponent VARCHAR, december VARCHAR) ### Question ### Can you tell me the Opponent that has the December of 2? ### Accurate SQL ###
SELECT opponent FROM table_name_52 WHERE december = 2
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_29394 ( "Model Number" text, "Frequency" text, "L2 Cache" text, "HT" text, "Mult. 1" text, "Voltage" text, "TDP" text, "Socket" text, "Release date" text, "Order Part Number" text ) ### Question ### What is the oder part number for the model with 10x mult. 1? ### Accurate SQL ###
SELECT "Order Part Number" FROM table_29394 WHERE "Mult. 1" = '10x'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int ) TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int ) TABLE: CREATE TABLE area ( course_id int, area varchar ) TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) TABLE: CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar ) TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int ) TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) TABLE: CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar ) TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) TABLE: CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments int, respected int, participation int, heavy_reading int, tough_grader int, hilarious int, would_take_again int, good_lecture int, no_skip int ) TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) ### Question ### Of the courses being offered this Fall , which are upper-level CHEMBIO classes ? ### Accurate SQL ###
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND course.department = 'CHEMBIO' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Fall' AND semester.semester_id = course_offering.semester AND semester.year = 2016
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_37 ( nation VARCHAR, club VARCHAR, competition VARCHAR, year VARCHAR ) ### Question ### What shows for nation when the Competition is preseason, Year less than 2011, and a Club of chivas de guadalajara? ### Accurate SQL ###
SELECT nation FROM table_name_37 WHERE competition = "preseason" AND year < 2011 AND club = "chivas de guadalajara"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar ) TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int ) TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) TABLE: CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments int, respected int, participation int, heavy_reading int, tough_grader int, hilarious int, would_take_again int, good_lecture int, no_skip int ) TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int ) TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) TABLE: CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar ) TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int ) TABLE: CREATE TABLE area ( course_id int, area varchar ) TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) ### Question ### How many classes are there available next semester ? ### Accurate SQL ###
SELECT COUNT(DISTINCT course_offering.course_id) FROM course_offering, semester WHERE semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_10 (visiting_team VARCHAR, host_team VARCHAR) ### Question ### Who was the visiting team in the game against the Dallas Cowboys? ### Accurate SQL ###
SELECT visiting_team FROM table_name_10 WHERE host_team = "dallas cowboys"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_17289224_1 ( poles INTEGER, team_name VARCHAR ) ### Question ### How many poles did David Price Racing win? ### Accurate SQL ###
SELECT MAX(poles) FROM table_17289224_1 WHERE team_name = "David Price Racing"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_8197 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real ) ### Question ### What was the total Attendance in weeks previous of 5, playing the Seattle Seahawks? ### Accurate SQL ###
SELECT COUNT("Attendance") FROM table_8197 WHERE "Week" < '5' AND "Opponent" = 'seattle seahawks'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_19744915_15 (rank INTEGER) ### Question ### What is the lowest rank? ### Accurate SQL ###
SELECT MIN(rank) FROM table_19744915_15
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_59946 ( "Rank" text, "Name" text, "Height ft (m)" text, "Floors" real, "Year" real ) ### Question ### How tall is the structure built in 1907? ### Accurate SQL ###
SELECT "Height ft (m)" FROM table_59946 WHERE "Year" = '1907'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: 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 text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: 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 ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### How many of the patients admitted before the year 2195 had a lab test for potassium level? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2195" AND lab.label = "Potassium"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_42590 ( "Rank" real, "Name" text, "Years" text, "Games" real, "Goals" real, "Goals/Games" real ) ### Question ### What is the average Goals/Games for Rummenigge, Karl-Heinz, with Goals less than 162? ### Accurate SQL ###
SELECT AVG("Goals/Games") FROM table_42590 WHERE "Name" = 'rummenigge, karl-heinz' AND "Goals" < '162'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: 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 text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: 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 ) ### Question ### provide the number of patients whose drug code is meto25? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "METO25"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_14587 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real ) ### Question ### What points did the ilmor v10 engine get after 1992? ### Accurate SQL ###
SELECT SUM("Points") FROM table_14587 WHERE "Engine" = 'ilmor v10' AND "Year" > '1992'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_204_227 ( id number, "week" number, "date" text, "opponent" text, "score" text, "result" text, "record" text ) ### Question ### which games did they not score under 30 points ? ### Accurate SQL ###
SELECT COUNT(*) FROM table_204_227 WHERE "score" >= 30
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_17025328_1 (year__ceremony_ VARCHAR, original_title VARCHAR) ### Question ### Name the year for le confessional ### Accurate SQL ###
SELECT year__ceremony_ FROM table_17025328_1 WHERE original_title = "Le Confessional"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_83 (game INTEGER, record VARCHAR) ### Question ### Which Game is the highest one that has a Record of 4-3-6? ### Accurate SQL ###
SELECT MAX(game) FROM table_name_83 WHERE record = "4-3-6"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_97 ( bronze INTEGER, nation VARCHAR, gold VARCHAR, rank VARCHAR ) ### Question ### Which Bronze has a Gold smaller than 16, a Rank of 10, and a Nation of italy? ### Accurate SQL ###
SELECT AVG(bronze) FROM table_name_97 WHERE gold < 16 AND rank = "10" AND nation = "italy"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_1953516_1 (winning_span VARCHAR, rank VARCHAR) ### Question ### What is the winning span with the rank of 5? ### Accurate SQL ###
SELECT winning_span FROM table_1953516_1 WHERE rank = "5"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_57 (country VARCHAR, label VARCHAR) ### Question ### What country has the label Control? ### Accurate SQL ###
SELECT country FROM table_name_57 WHERE label = "control"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_31 (lane VARCHAR, time VARCHAR, rank VARCHAR) ### Question ### What is the lane with a time of 1:56.64, and a tank smaller than 7? ### Accurate SQL ###
SELECT COUNT(lane) FROM table_name_31 WHERE time = "1:56.64" AND rank < 7
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_66 ( time INTEGER, rank VARCHAR, nationality VARCHAR, lane VARCHAR ) ### Question ### Name the lowest Time of jamaica with a Lane larger than 4 and a Rank smaller than 1? ### Accurate SQL ###
SELECT MIN(time) FROM table_name_66 WHERE nationality = "jamaica" AND lane > 4 AND rank < 1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_52 ( rank INTEGER, heat VARCHAR, nationality VARCHAR, lane VARCHAR ) ### Question ### What rank is from Japan, has a lane smaller than 7 and a heat smaller than 3? ### Accurate SQL ###
SELECT SUM(rank) FROM table_name_52 WHERE nationality = "japan" AND lane < 7 AND heat < 3
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: 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 text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: 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 ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### how many patients whose discharge location is home health care and lab test name is amylase? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.discharge_location = "HOME HEALTH CARE" AND lab.label = "Amylase"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE student (stu_num VARCHAR, stu_lname VARCHAR) TABLE: CREATE TABLE enroll (class_code VARCHAR, stu_num VARCHAR) TABLE: CREATE TABLE CLASS (crs_code VARCHAR, class_code VARCHAR) ### Question ### What is the code of the course which the student whose last name is Smithson took? ### Accurate SQL ###
SELECT T1.crs_code FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num WHERE T3.stu_lname = 'Smithson'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_4749 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) ### Question ### What was the away team score when the home team scored 6.11 (47)? ### Accurate SQL ###
SELECT "Away team score" FROM table_4749 WHERE "Home team score" = '6.11 (47)'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_50175 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text ) ### Question ### What was Nolan Henke's To par when he placed in t3? ### Accurate SQL ###
SELECT "To par" FROM table_50175 WHERE "Place" = 't3' AND "Player" = 'nolan henke'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_59677 ( "Abbr" text, "Common English" text, "French" text, "Italian" text, "Romansh" text ) ### Question ### What is the italian word for Glarus? ### Accurate SQL ###
SELECT "Italian" FROM table_59677 WHERE "Common English" = 'glarus'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_62 (location VARCHAR, home_team VARCHAR) ### Question ### What was the location of the home game for Slovakia? ### Accurate SQL ###
SELECT location FROM table_name_62 WHERE home_team = "slovakia"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_73 (date VARCHAR, game VARCHAR, score VARCHAR) ### Question ### What date has a game smaller than 4, and a score of 116-114? ### Accurate SQL ###
SELECT date FROM table_name_73 WHERE game < 4 AND score = "116-114"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_24565004_15 ( appearances¹ VARCHAR, goals¹ VARCHAR ) ### Question ### How many games had less than 7 goals scored? ### Accurate SQL ###
SELECT COUNT(appearances¹) FROM table_24565004_15 WHERE goals¹ = 7
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_46074 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) ### Question ### What's the rank average when the gold medals are less than 0? ### Accurate SQL ###
SELECT AVG("Rank") FROM table_46074 WHERE "Gold" < '0'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_1213511_7 ( nationality VARCHAR, pick__number VARCHAR ) ### Question ### What nationality is pick # 89 ### Accurate SQL ###
SELECT nationality FROM table_1213511_7 WHERE pick__number = 89
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_15187735_20 ( episode INTEGER, segment_d VARCHAR ) ### Question ### Which episode has segment D on custom motorcycle tanks? ### Accurate SQL ###
SELECT MIN(episode) FROM table_15187735_20 WHERE segment_d = "Custom Motorcycle Tanks"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: 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 ) TABLE: 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 ) TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: 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 ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text ) TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) ### Question ### count the number of patients in the hospital. ### Accurate SQL ###
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.dischtime IS NULL
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_80 (core__number INTEGER, part_number_opn_ VARCHAR, tdp__w_ VARCHAR) ### Question ### What is the sum of core# with a part number of osa242cep5au and TDP greater than 82.1? ### Accurate SQL ###
SELECT SUM(core__number) FROM table_name_80 WHERE part_number_opn_ = "osa242cep5au" AND tdp__w_ > 82.1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_17181 ( "model" text, "cylinders/ valves" text, "displacement cc" real, "max. power kW (PS) at rpm" text, "max. torque (Nm) at rpm" text, "engine code" text, "top speed (km/h)" real, "production period" text ) ### Question ### what's the cylinders/ valves with model being 1.8 20v ### Accurate SQL ###
SELECT "cylinders/ valves" FROM table_17181 WHERE "model" = '1.8 20V'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_67 (away VARCHAR, competition VARCHAR) ### Question ### What is the away team of the UEFA champions league? ### Accurate SQL ###
SELECT away FROM table_name_67 WHERE competition = "uefa champions league"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_73 ( rank INTEGER, lane VARCHAR ) ### Question ### What was the rank of the player in lane 6? ### Accurate SQL ###
SELECT AVG(rank) FROM table_name_73 WHERE lane = 6
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_39 (byes VARCHAR, benalla_dfl VARCHAR, losses VARCHAR) ### Question ### When Benalla DFL is swanpool with less than 16 losses, what is the sum of Byes? ### Accurate SQL ###
SELECT COUNT(byes) FROM table_name_39 WHERE benalla_dfl = "swanpool" AND losses < 16
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_41448 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) ### Question ### How many totals have a rank greater than 4, czech Republic as the nation, and a bronze greater than 0? ### Accurate SQL ###
SELECT SUM("Total") FROM table_41448 WHERE "Rank" > '4' AND "Nation" = 'czech republic' AND "Bronze" > '0'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_48987 ( "Position" real, "Team" text, "Played" real, "Drawn" real, "Lost" real, "Goals For" real, "Goals Against" real, "Goal Difference" text, "Points 1" real ) ### Question ### What is the highest goals for that has a drawn less than 11, with a played less than 42? ### Accurate SQL ###
SELECT MAX("Goals For") FROM table_48987 WHERE "Drawn" < '11' AND "Played" < '42'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER ) TABLE: CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT ) ### Question ### What is average age of male for different job title. Visualize by bar chart. ### Accurate SQL ###
SELECT job, AVG(age) FROM Person WHERE gender = 'male' GROUP BY job
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_72 (goals_for INTEGER, played INTEGER) ### Question ### What is the goals for when played is larger than 30? ### Accurate SQL ###
SELECT MIN(goals_for) FROM table_name_72 WHERE played > 30
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) TABLE: 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 time, hospitaldischargetime time, hospitaldischargestatus text ) TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) ### Question ### when did patient 002-41391 get his or her last prescription? ### Accurate SQL ###
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-41391')) ORDER BY medication.drugstarttime DESC LIMIT 1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_79256 ( "Japanese Title" text, "Romaji Title" text, "TV Station" text, "Theme Song(s)" text, "Episodes" real, "Average Ratings" text ) ### Question ### What Episode has a Theme Song of koh+ 'kiss ' (kiss shite)? ### Accurate SQL ###
SELECT MIN("Episodes") FROM table_79256 WHERE "Theme Song(s)" = 'koh+ "kissして" (kiss shite)'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_4 (prefix VARCHAR, chemical_class VARCHAR) ### Question ### What prefix has Haloalkane as the chemical class? ### Accurate SQL ###
SELECT prefix FROM table_name_4 WHERE chemical_class = "haloalkane"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_72 (full_professors VARCHAR, head VARCHAR, lecturers VARCHAR) ### Question ### How many full professors work under Hartmut Kliemt with more than 0 lecturers? ### Accurate SQL ###
SELECT COUNT(full_professors) FROM table_name_72 WHERE head = "hartmut kliemt" AND lecturers > 0
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_206359_1 (b_shares VARCHAR, shareholder_name VARCHAR) ### Question ### How many different numbers of B shares does Handelsbanken fonder have? ### Accurate SQL ###
SELECT COUNT(b_shares) FROM table_206359_1 WHERE shareholder_name = "Handelsbanken fonder"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_55 (institution VARCHAR, location VARCHAR) ### Question ### What institution is located in athens, ga, us? ### Accurate SQL ###
SELECT institution FROM table_name_55 WHERE location = "athens, ga, us"