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 table_26162 ( "Episode" text, "First broadcast" text, "Davids team" text, "Lees team" text, "Scores" text ) ### Question ### When kevin bridges and katy wix are both on the less team what is the score? ### Accurate SQL ###
SELECT "Scores" FROM table_26162 WHERE "Lees team" = 'Kevin Bridges and Katy Wix'
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_468 ( id number, "pos" number, "no" number, "driver" text, "team" text, "laps" number, "time/retired" text, "grid" number, "points" number ) ### Question ### what are the total number of laps driven by scott pruett ? ### Accurate SQL ###
SELECT "laps" FROM table_204_468 WHERE "driver" = 'scott pruett'
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 university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) TABLE: CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) ### Question ### A bar chart shows the distribution of All_Home and School_ID , and group by attribute ACC_Home, order by the y axis from high to low please. ### Accurate SQL ###
SELECT All_Home, School_ID FROM basketball_match GROUP BY ACC_Home, All_Home ORDER BY School_ID DESC
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_80447 ( "Rank" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) ### Question ### What is the total gold that has bronze less than 2, a silver of 1 and total more than 4? ### Accurate SQL ###
SELECT SUM("Gold") FROM table_80447 WHERE "Bronze" < '2' AND "Silver" = '1' AND "Total" > '4'
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_10975 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) ### Question ### At the match which took place in arden street oval, how much did the away team score? ### Accurate SQL ###
SELECT "Away team score" FROM table_10975 WHERE "Venue" = 'arden street oval'
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_22151 ( "Year to April" real, "Revenue (US $million)" text, "EBIT (US $m)" text, "Net profit (US $m)" text, "Earnings per share (\u00a2)" text ) ### Question ### How many dollars is the revenue when the net profit is 55.4 million dollars? ### Accurate SQL ###
SELECT "Revenue (US $million)" FROM table_22151 WHERE "Net profit (US $m)" = '55.4'
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_72280 ( "Name" text, "Location" text, "Light vehicle" text, "Heavy vehicle (2 axles)" text, "Heavy vehicle (3/4 axles)" text, "Heavy vehicle (5+ axles)" text ) ### Question ### What is the toll for light vehicles at the plaza between bela bela and modimolle? ### Accurate SQL ###
SELECT "Light vehicle" FROM table_72280 WHERE "Location" = 'between Bela Bela and Modimolle'
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_93 ( entrant VARCHAR, engine VARCHAR, year VARCHAR ) ### Question ### Who used Gordini Straight-6 in 1956? ### Accurate SQL ###
SELECT entrant FROM table_name_93 WHERE engine = "gordini straight-6" AND year = 1956
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_11764007_2 ( week_arrived_on_main_island VARCHAR, original_tribe VARCHAR, week_sent_to_third_island VARCHAR ) ### Question ### What week did the member who's original tribe was shark and who was sent to the third island on week 14 arrive on the main island? ### Accurate SQL ###
SELECT week_arrived_on_main_island FROM table_11764007_2 WHERE original_tribe = "Shark" AND week_sent_to_third_island = "14"
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 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 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 lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) 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 allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) ### Question ### when was the first time in the last month that patient 006-36108 had the minimum -lymphs? ### Accurate SQL ###
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-36108')) AND lab.labname = '-lymphs' AND DATETIME(lab.labresulttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY lab.labresult, lab.labresulttime 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_27254 ( "Rank" real, "WS Points" real, "Name" text, "Country" text, "09-10 I/O best" real, "09-10 GP/JGP best" real, "09-10 GP/JGP 2nd" real, "09-10 OI best" real, "09-10 OI 2nd" real, "08-09 I/O best" real, "08-09 GP/JGP best" real, "08-09 GP/JGP 2nd" real, "08-09 OI best" real, "08-09 OI 2nd" real ) ### Question ### If the rank is 17, what are the names? ### Accurate SQL ###
SELECT "Name" FROM table_27254 WHERE "Rank" = '17'
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 (year INTEGER, nation_represented VARCHAR) ### Question ### What is the latest result where a person from the Philippines won? ### Accurate SQL ###
SELECT MAX(year) FROM table_name_72 WHERE nation_represented = "philippines"
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_13676 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text ) ### Question ### what is the outcome when the tournament is tokyo? ### Accurate SQL ###
SELECT "Outcome" FROM table_13676 WHERE "Tournament" = 'tokyo'
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 diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) 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 lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) ### Question ### how many days have it been since patient 006-195316's last prescription of furosemide 40 mg tab in the current hospital visit? ### Accurate SQL ###
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', medication.drugstarttime)) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-195316') AND patient.hospitaldischargetime IS NULL) AND medication.drugname = 'furosemide 40 mg tab' 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 certificate ( eid number(9,0), aid number(9,0) ) TABLE: CREATE TABLE employee ( eid number(9,0), name varchar2(30), salary number(10,2) ) TABLE: 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) ) TABLE: CREATE TABLE aircraft ( aid number(9,0), name varchar2(30), distance number(6,0) ) ### Question ### Show the number of flights in each destination city with a bar chart, rank by the X from low to high. ### Accurate SQL ###
SELECT destination, COUNT(destination) FROM flight GROUP BY destination ORDER BY destination
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 (team VARCHAR, county VARCHAR) ### Question ### Which team is in Sussex county? ### Accurate SQL ###
SELECT team FROM table_name_5 WHERE county = "sussex"
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_36944 ( "Season" text, "Tropical Lows" real, "Tropical Cyclones" real, "Severe Tropical Cyclones" real, "Strongest storm" text ) ### Question ### What is the total number of Tropical Lows for more than 11 tropical cyclones in 1998 99, and a Severe Tropical Cyclones larger than 9? ### Accurate SQL ###
SELECT COUNT("Tropical Lows") FROM table_36944 WHERE "Tropical Cyclones" > '11' AND "Season" = '1998–99' AND "Severe Tropical Cyclones" > '9'
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 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 intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) 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 allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime 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 lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) ### Question ### did patient 028-47306 have levothyroxine sodium 75 mcg po tabs prescribed since 32 months ago? ### Accurate SQL ###
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-47306')) AND medication.drugname = 'levothyroxine sodium 75 mcg po tabs' AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-32 month')
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_14521 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text ) ### Question ### On games against the Devil Rays and a score of 2 - 1 (10), what was the attendance? ### Accurate SQL ###
SELECT AVG("Attendance") FROM table_14521 WHERE "Opponent" = 'devil rays' AND "Score" = '2 - 1 (10)'
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_68538 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Record" text ) ### Question ### Who was the opponent when the loss was Wells (4-7)? ### Accurate SQL ###
SELECT "Opponent" FROM table_68538 WHERE "Loss" = 'wells (4-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_47 ( pick INTEGER, round VARCHAR, overall VARCHAR ) ### Question ### How many picks had a round smaller than 6 and an overall bigger than 153? ### Accurate SQL ###
SELECT SUM(pick) FROM table_name_47 WHERE round < 6 AND overall > 153
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_70550 ( "Rider" text, "Manufacturer" text, "Laps" real, "Time/Retired" text, "Grid" real ) ### Question ### what is the smallest number of laps imre toth has? ### Accurate SQL ###
SELECT MIN("Laps") FROM table_70550 WHERE "Rider" = 'imre toth'
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 wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TEXT, Year INTEGER, Price INTEGER, Score INTEGER, Cases INTEGER, Drink TEXT ) TABLE: CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) TABLE: CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) ### Question ### Please give me a bar chart that counts the number of grape of wine, and I want to display in ascending by the X-axis. ### Accurate SQL ###
SELECT Grape, COUNT(Grape) FROM wine GROUP BY Grape ORDER BY Grape
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 management ( department_ID int, head_ID int, temporary_acting text ) TABLE: CREATE TABLE department ( Department_ID int, Name text, Creation text, Ranking int, Budget_in_Billions real, Num_Employees real ) TABLE: CREATE TABLE head ( head_ID int, name text, born_state text, age real ) ### Question ### Can you draw the trend of sum budget in billions over the creation?, I want to rank x axis in descending order. ### Accurate SQL ###
SELECT Creation, SUM(Budget_in_Billions) FROM department GROUP BY Creation ORDER BY Creation DESC
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_20524090_1 (obama_percentage VARCHAR, county VARCHAR) ### Question ### What was Obama's percentage in the county of Surry? ### Accurate SQL ###
SELECT obama_percentage FROM table_20524090_1 WHERE county = "Surry"
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_77 (venue VARCHAR, competition VARCHAR) ### Question ### What is the venue of the 1990 Asian games? ### Accurate SQL ###
SELECT venue FROM table_name_77 WHERE competition = "1990 asian games"
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 ( written_by VARCHAR, production_code VARCHAR ) ### Question ### Who wrote the episode that has the production code ad1c05? ### Accurate SQL ###
SELECT written_by FROM table_name_4 WHERE production_code = "ad1c05"
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_46820 ( "Place" text, "Player" text, "Country" text, "Score" real, "To par" text ) ### Question ### Who is the player with a to par of +1? ### Accurate SQL ###
SELECT "Player" FROM table_46820 WHERE "To par" = '+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_13599 ( "Municipality" text, "Inhabitants" real, "Mayor" text, "Party" text, "Election" real ) ### Question ### What is livorno's average election? ### Accurate SQL ###
SELECT AVG("Election") FROM table_13599 WHERE "Municipality" = 'livorno'
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_1108394_43 (party VARCHAR, brooklyn VARCHAR) ### Question ### what's the party with brooklyn value of 51.0% ### Accurate SQL ###
SELECT party FROM table_1108394_43 WHERE brooklyn = "51.0_percentage"
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 Movie ( mID int, title text, year int, director text ) TABLE: CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) TABLE: CREATE TABLE Reviewer ( rID int, name text ) ### Question ### Please tell me the average star ratings of each movie title using a bar chart, list x-axis from low to high order. ### Accurate SQL ###
SELECT title, AVG(stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY title ORDER BY title
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 allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) 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 intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime 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 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 microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) 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 diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) ### Question ### what is the top five most frequent output events in this year? ### Accurate SQL ###
SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%output%' AND DATETIME(intakeoutput.intakeoutputtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY intakeoutput.celllabel) AS t1 WHERE t1.c1 <= 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_78745 ( "Nat." text, "Name" text, "First game" text, "Final game" text, "Apps" real, "Goals" real ) ### Question ### What name has 118 as the apps? ### Accurate SQL ###
SELECT "Name" FROM table_78745 WHERE "Apps" = '118'
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_84 ( number_range VARCHAR, builder VARCHAR, introduced VARCHAR ) ### Question ### What is the number range for the Gloucester RCW builder introduced in 1937? ### Accurate SQL ###
SELECT number_range FROM table_name_84 WHERE builder = "gloucester rcw" AND introduced = "1937"
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_54 (h___a VARCHAR, date VARCHAR) ### Question ### What is the H/A for 20 february 2007? ### Accurate SQL ###
SELECT h___a FROM table_name_54 WHERE date = "20 february 2007"
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_20760802_1 ( drawn VARCHAR, points_against VARCHAR ) ### Question ### How may drawn equal points against at 129? ### Accurate SQL ###
SELECT drawn FROM table_20760802_1 WHERE points_against = "129"
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_58999 ( "Title" text, "Developer" text, "Genre" text, "Release date" text, "Version" real ) ### Question ### What is the highest Version, when Release Date is '2011-04-01'? ### Accurate SQL ###
SELECT MAX("Version") FROM table_58999 WHERE "Release date" = '2011-04-01'
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_54787 ( "Type" text, "Sign" real, "Exponent" real, "Significand" real, "Total bits" real, "Exponent bias" real, "Bits precision" real, "Number of decimal digits" text ) ### Question ### What's the sum of significand with ~34.0 decimal digits and an exponent bias larger than 16383? ### Accurate SQL ###
SELECT SUM("Significand") FROM table_54787 WHERE "Number of decimal digits" = '~34.0' AND "Exponent bias" > '16383'
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_28 (date VARCHAR, event VARCHAR) ### Question ### When was the Metallica: Escape from the Studio show? ### Accurate SQL ###
SELECT date FROM table_name_28 WHERE event = "metallica: escape from the studio"
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_63 (wins INTEGER, top_10 VARCHAR) ### Question ### How many total wins are associated with events with 1 top-10? ### Accurate SQL ###
SELECT SUM(wins) FROM table_name_63 WHERE top_10 = 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_4844 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) ### Question ### At what venue was the away team score 3.11 (29)? ### Accurate SQL ###
SELECT "Venue" FROM table_4844 WHERE "Away team score" = '3.11 (29)'
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_429 ( id number, "battle" text, "location" text, "date(s)" text, "engagement remarks" text, "victor" text ) ### Question ### what is the total number of texan victories ? ### Accurate SQL ###
SELECT COUNT(*) FROM table_204_429 WHERE "victor" = 't'
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 Things ( thing_id INTEGER, organization_id INTEGER, Type_of_Thing_Code CHAR(15), service_type_code CHAR(10), service_details VARCHAR(255) ) TABLE: CREATE TABLE Customer_Event_Notes ( Customer_Event_Note_ID INTEGER, Customer_Event_ID INTEGER, service_type_code CHAR(15), resident_id INTEGER, property_id INTEGER, date_moved_in DATETIME ) TABLE: CREATE TABLE Timed_Status_of_Things ( thing_id INTEGER, Date_and_Date DATETIME, Status_of_Thing_Code CHAR(15) ) TABLE: CREATE TABLE Residents ( resident_id INTEGER, property_id INTEGER, date_moved_in DATETIME, date_moved_out DATETIME, other_details VARCHAR(255) ) TABLE: CREATE TABLE Properties ( property_id INTEGER, property_type_code CHAR(15), property_address VARCHAR(255), other_details VARCHAR(255) ) TABLE: CREATE TABLE Customers ( customer_id INTEGER, customer_details VARCHAR(255) ) TABLE: CREATE TABLE Organizations ( organization_id INTEGER, parent_organization_id INTEGER, organization_details VARCHAR(255) ) TABLE: CREATE TABLE Services ( service_id INTEGER, organization_id INTEGER, service_type_code CHAR(15), service_details VARCHAR(255) ) TABLE: CREATE TABLE Timed_Locations_of_Things ( thing_id INTEGER, Date_and_Time DATETIME, Location_Code CHAR(15) ) TABLE: CREATE TABLE Customer_Events ( Customer_Event_ID INTEGER, customer_id INTEGER, date_moved_in DATETIME, property_id INTEGER, resident_id INTEGER, thing_id INTEGER ) TABLE: CREATE TABLE Residents_Services ( resident_id INTEGER, service_id INTEGER, date_moved_in DATETIME, property_id INTEGER, date_requested DATETIME, date_provided DATETIME, other_details VARCHAR(255) ) ### Question ### Group and count the move in date in a bar chart, and I want to bin the X into Year interval, and I want to sort y-axis from high to low order. ### Accurate SQL ###
SELECT date_moved_in, COUNT(date_moved_in) FROM Customer_Events ORDER BY COUNT(date_moved_in) DESC
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_75 (constructor VARCHAR, grid VARCHAR) ### Question ### Which Constructor has grid 2? ### Accurate SQL ###
SELECT constructor FROM table_name_75 WHERE grid = 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_39012 ( "Game" real, "February" real, "Opponent" text, "Score" text, "Record" text, "Points" real ) ### Question ### which Record has a Score of 1 4? ### Accurate SQL ###
SELECT "Record" FROM table_39012 WHERE "Score" = '1–4'
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_prerequisite ( pre_course_id int, course_id int ) 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 instructor ( instructor_id int, name varchar, uniqname varchar ) 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 program ( program_id int, name varchar, college varchar, introduction varchar ) TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int ) 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 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 comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) TABLE: CREATE TABLE area ( course_id int, area 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 program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location 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 gsi ( course_offering_id int, student_id int ) TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) ### Question ### Which professor is running the ULCS classes next Winter ? ### Accurate SQL ###
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id WHERE program_course.category LIKE '%ULCS%' AND semester.semester = 'Winter' AND semester.year = 2017
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_75397 ( "Years tallest" text, "Name" text, "Height ft / m" text, "Floors" real, "Year completed" real ) ### Question ### How tall is the florida life building, completed before 1990? ### Accurate SQL ###
SELECT "Height ft / m" FROM table_75397 WHERE "Year completed" < '1990' AND "Name" = 'florida life building'
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_62992 ( "Title" text, "Series" text, "Director" text, "Production Num." text, "Release date" text ) ### Question ### What series was called Egghead Rides Again? ### Accurate SQL ###
SELECT "Series" FROM table_62992 WHERE "Title" = 'egghead rides again'
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_50 (date VARCHAR, surface VARCHAR, tournament VARCHAR) ### Question ### What is the date of the Sydney, Australia tournament with a hard surface? ### Accurate SQL ###
SELECT date FROM table_name_50 WHERE surface = "hard" AND tournament = "sydney, australia"
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_58 ( date VARCHAR, record VARCHAR ) ### Question ### On what date was the record 19-11? ### Accurate SQL ###
SELECT date FROM table_name_58 WHERE record = "19-11"
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_9 ( tournament VARCHAR, partner VARCHAR ) ### Question ### Which tournament had a partner of Erika Sema? ### Accurate SQL ###
SELECT tournament FROM table_name_9 WHERE partner = "erika sema"
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 d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title 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 labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) 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_items ( row_id number, itemid number, label text, linksto 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 cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) 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 microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) 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 procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title 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 patients ( row_id number, subject_id number, gender text, dob time, dod time ) ### Question ### when did patient 67005 last get stool microbiology test in 08/last year? ### Accurate SQL ###
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 67005) AND microbiologyevents.spec_type_desc = 'stool' AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', microbiologyevents.charttime) = '08' ORDER BY microbiologyevents.charttime 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_1336 ( "Week #" text, "Theme" text, "Song choice" text, "Original artist" text, "Order #" text, "Result" text ) ### Question ### How many themes have the original artist of Judy Garland? ### Accurate SQL ###
SELECT COUNT("Theme") FROM table_1336 WHERE "Original artist" = 'Judy Garland'
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 ( 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 ) 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 ### count the number of patients whose admission year is less than 2148 and lab test category is hematology? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2148" AND lab."CATEGORY" = "Hematology"
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_10058 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text ) ### Question ### WHAT IS THE SCORE WITH A TIE NUMBER OF 13? ### Accurate SQL ###
SELECT "Score" FROM table_10058 WHERE "Tie no" = '13'
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_6 ( opponent_in_the_final VARCHAR, outcome VARCHAR, date VARCHAR ) ### Question ### Which opponent was a runner-up on 2 march 1998? ### Accurate SQL ###
SELECT opponent_in_the_final FROM table_name_6 WHERE outcome = "runner-up" AND date = "2 march 1998"
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_18546 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text ) ### Question ### How many people on this list are named thomas abernethy? ### Accurate SQL ###
SELECT COUNT("Candidates") FROM table_18546 WHERE "Incumbent" = 'Thomas Abernethy'
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_23242933_2 ( original_air_date VARCHAR, us_viewers__millions_ VARCHAR ) ### Question ### When did 6.09 million people in the US see the original airing of an episode of the show? ### Accurate SQL ###
SELECT original_air_date FROM table_23242933_2 WHERE us_viewers__millions_ = "6.09"
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_46250 ( "Date" text, "Home team" text, "Score" text, "Away team" text, "Venue" text, "Crowd" real, "Box Score" text, "Report" text ) ### Question ### Which Date has a Crowd smaller than 4,485? ### Accurate SQL ###
SELECT "Date" FROM table_46250 WHERE "Crowd" < '4,485'
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 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 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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount 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 procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime 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 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 outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) 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 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_labitems ( row_id number, itemid number, label text ) TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) ### Question ### what are the top five most common diagnoses among patients 20s? ### Accurate SQL ###
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 20 AND 29) GROUP BY diagnoses_icd.icd9_code) AS t1 WHERE t1.c1 <= 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_12 ( team VARCHAR, class VARCHAR, points VARCHAR, year VARCHAR ) ### Question ### Name the Team which has Points larger than 9, and a Year larger than 1971, and a Class of 250cc? ### Accurate SQL ###
SELECT team FROM table_name_12 WHERE points > 9 AND year > 1971 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_25727 ( "District" text, "SC/ST" text, "Nairs" text, "Ezhavas" text, "Syrian Christians" text, "Latin Christians" text, "Muslims" text, "Others" text, "Total" real ) ### Question ### Name the ezhavas for muslims being 5.4 ### Accurate SQL ###
SELECT "Ezhavas" FROM table_25727 WHERE "Muslims" = '5.4'
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 View_Unit_Status ( apt_id INTEGER, apt_booking_id INTEGER, status_date DATETIME, available_yn BIT ) TABLE: CREATE TABLE Apartment_Bookings ( apt_booking_id INTEGER, apt_id INTEGER, guest_id INTEGER, booking_status_code CHAR(15), booking_start_date DATETIME, booking_end_date DATETIME ) TABLE: CREATE TABLE Apartments ( apt_id INTEGER, building_id INTEGER, apt_type_code CHAR(15), apt_number CHAR(10), bathroom_count INTEGER, bedroom_count INTEGER, room_count CHAR(5) ) TABLE: CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) TABLE: CREATE TABLE Apartment_Facilities ( apt_id INTEGER, facility_code CHAR(15) ) TABLE: CREATE TABLE Guests ( guest_id INTEGER, gender_code CHAR(1), guest_first_name VARCHAR(80), guest_last_name VARCHAR(80), date_of_birth DATETIME ) ### Question ### Show me a bar chart for what are the apartment number and the room count of each apartment?, list in asc by the bar. ### Accurate SQL ###
SELECT apt_number, room_count FROM Apartments ORDER BY apt_number
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_76 ( class VARCHAR, frequency_mhz VARCHAR ) ### Question ### Which Class has a Frequency MHz of 107.5? ### Accurate SQL ###
SELECT class FROM table_name_76 WHERE frequency_mhz = 107.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 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 ) 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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title 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 ) ### Question ### provide the minimum number of days of hospital stay for patients whose primary disease is chest pain. ### Accurate SQL ###
SELECT MIN(demographic.days_stay) FROM demographic WHERE demographic.diagnosis = "CHEST PAIN"
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_58 (title VARCHAR, songwriter_s_ VARCHAR, time VARCHAR) ### Question ### Which song was written by Nigel Stock and is 4:12 long? ### Accurate SQL ###
SELECT title FROM table_name_58 WHERE songwriter_s_ = "nigel stock" AND time = "4:12"
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 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 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 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 ### what is age and discharge time of subject id 2560? ### Accurate SQL ###
SELECT demographic.age, demographic.dischtime FROM demographic WHERE demographic.subject_id = "2560"
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_1783 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Game site" text, "Record" text, "Attendance" real ) ### Question ### What is the record when the game was at the San Diego Stadium? ### Accurate SQL ###
SELECT "Record" FROM table_1783 WHERE "Game site" = 'San Diego Stadium'
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_29285076_2 (location VARCHAR, fastest_lap VARCHAR, winning_driver VARCHAR) ### Question ### Where was the race with Luke Ellery as fastest lap and Wayne Boyd as winning driver? ### Accurate SQL ###
SELECT location FROM table_29285076_2 WHERE fastest_lap = "Luke Ellery" AND winning_driver = "Wayne Boyd"
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 trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER ) TABLE: CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT ) TABLE: CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_dew_point_f INTEGER, max_humidity INTEGER, mean_humidity INTEGER, min_humidity INTEGER, max_sea_level_pressure_inches NUMERIC, mean_sea_level_pressure_inches NUMERIC, min_sea_level_pressure_inches NUMERIC, max_visibility_miles INTEGER, mean_visibility_miles INTEGER, min_visibility_miles INTEGER, max_wind_Speed_mph INTEGER, mean_wind_speed_mph INTEGER, max_gust_speed_mph INTEGER, precipitation_inches INTEGER, cloud_cover INTEGER, events TEXT, wind_dir_degrees INTEGER, zip_code INTEGER ) TABLE: CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT ) ### Question ### Please give me a bar chart that bins the installation date of stations into the day of week interval as the X-axis, and count for showing how many stations are installed each year, sort in asc by the Y-axis. ### Accurate SQL ###
SELECT installation_date, COUNT(installation_date) FROM station ORDER BY COUNT(installation_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_37 (label VARCHAR, date VARCHAR, format VARCHAR) ### Question ### What label released a CD in 1988? ### Accurate SQL ###
SELECT label FROM table_name_37 WHERE date = "1988" AND format = "cd"
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_99 (place INTEGER, goals_scored VARCHAR, draw VARCHAR) ### Question ### What is the highest place that has a draw entry smaller than 6 and goal score of 28? ### Accurate SQL ###
SELECT MAX(place) FROM table_name_99 WHERE goals_scored = 28 AND draw < 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_21501518_1 ( week__number VARCHAR, theme VARCHAR ) ### Question ### Which week is the theme First Solo ### Accurate SQL ###
SELECT week__number FROM table_21501518_1 WHERE theme = "First Solo"
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_69 ( bronze INTEGER, total VARCHAR, gold VARCHAR ) ### Question ### What is the average bronze with a total of 15 and less than 2 gold? ### Accurate SQL ###
SELECT AVG(bronze) FROM table_name_69 WHERE total = 15 AND gold < 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 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 ### list the number of patients with congestive heart failure. ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CONGESTIVE HEART FAILURE"
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_84 (joined INTEGER, conference_championships VARCHAR, institution VARCHAR) ### Question ### What is the latest year joined with a Conference championships of 5, and an Institution of university of north carolina? ### Accurate SQL ###
SELECT MAX(joined) FROM table_name_84 WHERE conference_championships = 5 AND institution = "university of north carolina"
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_23662272_4 (couple VARCHAR, total_points_earned VARCHAR) ### Question ### What is the name of the couple if the total points earned is 161? ### Accurate SQL ###
SELECT couple FROM table_23662272_4 WHERE total_points_earned = 161
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_44 ( d_43 VARCHAR, d_41 VARCHAR ) ### Question ### What is the D43 associated with a D41 of r 21? ### Accurate SQL ###
SELECT d_43 FROM table_name_44 WHERE d_41 = "r 21"
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_17360840_4 ( date VARCHAR, record VARCHAR ) ### Question ### State the dates of games with record 1-2-3 ### Accurate SQL ###
SELECT date FROM table_17360840_4 WHERE record = "1-2-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 table_63792 ( "Rank" real, "Lane" real, "Name" text, "Nationality" text, "Time" text ) ### Question ### What is the highest lane that has nimrod shapira bar-or as the name? ### Accurate SQL ###
SELECT MAX("Lane") FROM table_63792 WHERE "Name" = 'nimrod shapira bar-or'
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_23 (date VARCHAR, rank VARCHAR) ### Question ### What Date has a Rank of 2? ### Accurate SQL ###
SELECT date FROM table_name_23 WHERE rank = 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_69172 ( "Film" text, "Director(s)" text, "Producer(s)" text, "Writer(s)" text, "Date" text, "Award" text ) ### Question ### Which producer worked with Robert Sproul-cran as writer? ### Accurate SQL ###
SELECT "Producer(s)" FROM table_69172 WHERE "Writer(s)" = 'robert sproul-cran'
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 d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label 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 chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) 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 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 outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) 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 microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) 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 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 ) ### Question ### what are the ways to consume sterile water? ### Accurate SQL ###
SELECT DISTINCT prescriptions.route FROM prescriptions WHERE prescriptions.drug = 'sterile water'
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 invoices ( invoice_number number, invoice_date time, invoice_details text ) TABLE: CREATE TABLE shipment_items ( shipment_id number, order_item_id number ) TABLE: CREATE TABLE order_items ( order_item_id number, product_id number, order_id number, order_item_status text, order_item_details text ) TABLE: CREATE TABLE products ( product_id number, product_name text, product_details text ) TABLE: CREATE TABLE customers ( customer_id number, customer_name text, customer_details text ) TABLE: CREATE TABLE orders ( order_id number, customer_id number, order_status text, date_order_placed time, order_details text ) TABLE: CREATE TABLE shipments ( shipment_id number, order_id number, invoice_number number, shipment_tracking_number text, shipment_date time, other_shipment_details text ) ### Question ### Find the names of the customers who have order status both 'On Road' and 'Shipped'. ### Accurate SQL ###
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "On Road" INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "Shipped"
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_54 ( built INTEGER, vessel_name VARCHAR, class VARCHAR, type VARCHAR ) ### Question ### Which year was the vessel Deva built as a Panamax DNV class ship? ### Accurate SQL ###
SELECT SUM(built) FROM table_name_54 WHERE class = "dnv" AND type = "panamax" AND vessel_name = "deva"
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_31166 ( "District" real, "Representative" text, "Party" text, "Residence" text, "First Elected" text, "Term Limited" real ) ### Question ### which district does andy thompson represent ### Accurate SQL ###
SELECT COUNT("District") FROM table_31166 WHERE "Representative" = 'Andy Thompson'
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_1370559_1 (pf INTEGER) ### Question ### What is the lowest PF? ### Accurate SQL ###
SELECT MIN(pf) FROM table_1370559_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 film ( film_id number, rank_in_series number, number_in_season number, title text, directed_by text, original_air_date text, production_code text ) TABLE: CREATE TABLE schedule ( cinema_id number, film_id number, date text, show_times_per_day number, price number ) TABLE: CREATE TABLE cinema ( cinema_id number, name text, openning_year number, capacity number, location text ) ### Question ### Who are all the directors? ### Accurate SQL ###
SELECT DISTINCT directed_by FROM film
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 station (name VARCHAR, station_id VARCHAR) TABLE: CREATE TABLE train_station (station_id VARCHAR) ### Question ### Show the station name with greatest number of trains. ### Accurate SQL ###
SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id ORDER BY COUNT(*) 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 Addresses ( address_id INTEGER, address_details VARCHAR(255) ) TABLE: CREATE TABLE Customer_Orders ( order_id INTEGER, customer_id INTEGER, order_status_code VARCHAR(10), order_date DATETIME ) TABLE: CREATE TABLE Department_Store_Chain ( dept_store_chain_id INTEGER, dept_store_chain_name VARCHAR(80) ) TABLE: CREATE TABLE Departments ( department_id INTEGER, dept_store_id INTEGER, department_name VARCHAR(80) ) TABLE: CREATE TABLE Order_Items ( order_item_id INTEGER, order_id INTEGER, product_id INTEGER ) TABLE: CREATE TABLE Products ( product_id INTEGER, product_type_code VARCHAR(10), product_name VARCHAR(80), product_price DECIMAL(19,4) ) TABLE: CREATE TABLE Customer_Addresses ( customer_id INTEGER, address_id INTEGER, date_from DATETIME, date_to DATETIME ) TABLE: CREATE TABLE Staff_Department_Assignments ( staff_id INTEGER, department_id INTEGER, date_assigned_from DATETIME, job_title_code VARCHAR(10), date_assigned_to DATETIME ) TABLE: CREATE TABLE Customers ( customer_id INTEGER, payment_method_code VARCHAR(10), customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80) ) TABLE: CREATE TABLE Staff ( staff_id INTEGER, staff_gender VARCHAR(1), staff_name VARCHAR(80) ) TABLE: CREATE TABLE Product_Suppliers ( product_id INTEGER, supplier_id INTEGER, date_supplied_from DATETIME, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19,4) ) TABLE: CREATE TABLE Suppliers ( supplier_id INTEGER, supplier_name VARCHAR(80), supplier_phone VARCHAR(80) ) TABLE: CREATE TABLE Supplier_Addresses ( supplier_id INTEGER, address_id INTEGER, date_from DATETIME, date_to DATETIME ) TABLE: CREATE TABLE Department_Stores ( dept_store_id INTEGER, dept_store_chain_id INTEGER, store_name VARCHAR(80), store_address VARCHAR(255), store_phone VARCHAR(80), store_email VARCHAR(80) ) ### Question ### What is the lowest price of product, grouped by product type? Show a bar chart. ### Accurate SQL ###
SELECT product_type_code, MIN(product_price) FROM Products GROUP BY product_type_code ORDER BY product_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_23453931_5 (location VARCHAR, opponent VARCHAR) ### Question ### Name the location of buffalo sabres ### Accurate SQL ###
SELECT location FROM table_23453931_5 WHERE opponent = "Buffalo Sabres"
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_19 ( population INTEGER, code VARCHAR, area__km_2__ VARCHAR ) ### Question ### What's the population with a code more than 90902 and an area less than 1,335.47? ### Accurate SQL ###
SELECT MIN(population) FROM table_name_19 WHERE code > 90902 AND area__km_2__ < 1 OFFSET 335.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_35768 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) ### Question ### Name the home with chicago visiting ### Accurate SQL ###
SELECT "Home" FROM table_35768 WHERE "Visitor" = 'chicago'
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 district ( city_population INTEGER, city_area INTEGER ) ### Question ### Find the total population of the districts where the area is bigger than the average city area. ### Accurate SQL ###
SELECT SUM(city_population) FROM district WHERE city_area > (SELECT AVG(city_area) FROM district)
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 musical ( Musical_ID int, Name text, Year int, Award text, Category text, Nominee text, Result text ) TABLE: CREATE TABLE actor ( Actor_ID int, Name text, Musical_ID int, Character text, Duration text, age int ) ### Question ### Show the musical nominee with award 'Bob Fosse' or 'Cleavant Derricks', and count them by a bar chart, I want to sort y axis in ascending order. ### Accurate SQL ###
SELECT Nominee, COUNT(Nominee) FROM musical WHERE Award = "Tony Award" OR Award = "Cleavant Derricks" GROUP BY Nominee ORDER BY COUNT(Nominee)
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_13857700_1 ( mens_doubles VARCHAR, mixed_doubles VARCHAR ) ### Question ### who is the the mens doubles with mixed doubles being jimm aalto nina sarnesto ### Accurate SQL ###
SELECT mens_doubles FROM table_13857700_1 WHERE mixed_doubles = "Jimm Aalto Nina Sarnesto"
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 offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) 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 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 course_prerequisite ( pre_course_id int, course_id int ) TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location 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 ) TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int ) 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 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 jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) 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 ( program_id int, name varchar, college varchar, introduction varchar ) TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) ### Question ### When will Sarah Mcdowell teach 763 next ? ### Accurate SQL ###
SELECT DISTINCT semester.semester, semester.year FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.number = 763 AND course_offering.semester = semester.semester_id AND instructor.name LIKE '%Sarah Mcdowell%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id AND semester.semester_id > (SELECT SEMESTERalias1.semester_id FROM semester AS SEMESTERalias1 WHERE SEMESTERalias1.semester = 'WN' AND SEMESTERalias1.year = 2016) ORDER BY semester.semester_id 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_77698 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Game site" text ) ### Question ### What's the result at psinet stadium when the cincinnati bengals are the opponent? ### Accurate SQL ###
SELECT "Result" FROM table_77698 WHERE "Game site" = 'psinet stadium' AND "Opponent" = 'cincinnati bengals'
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_65 (city VARCHAR, date VARCHAR) ### Question ### Wjich city had a date of october 13? ### Accurate SQL ###
SELECT city FROM table_name_65 WHERE date = "october 13"
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_48000 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" real ) ### Question ### Which country has a score of 71-72-73-69=285? ### Accurate SQL ###
SELECT "Country" FROM table_48000 WHERE "Score" = '71-72-73-69=285'