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_47709 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text ) ### Question ### How long did the match last in the Rings: Final Capture event? ### Accurate SQL ###
SELECT "Time" FROM table_47709 WHERE "Event" = 'rings: final capture'
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 ( winner VARCHAR, mountains_classification VARCHAR, combativity_award VARCHAR ) ### Question ### Name the winner with mountains classification of franco pellizotti and combativity award of martijn maaskant ### Accurate SQL ###
SELECT winner FROM table_name_5 WHERE mountains_classification = "franco pellizotti" AND combativity_award = "martijn maaskant"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_203_549 ( id number, "player" text, "team" text, "date" text, "opponent" text, "venue" text ) ### Question ### what was the name of the last person to accomplish this up to date ? ### Accurate SQL ###
SELECT "player" FROM table_203_549 ORDER BY "date" 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_1888157_1 ( ga INTEGER, gf VARCHAR ) ### Question ### What is the highest GA when GF is 39? ### Accurate SQL ###
SELECT MAX(ga) FROM table_1888157_1 WHERE gf = 39
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 customers (customer_id VARCHAR, customer_name VARCHAR) TABLE: CREATE TABLE order_items (order_quantity INTEGER, order_id VARCHAR) TABLE: CREATE TABLE customer_orders (customer_id VARCHAR, order_id VARCHAR) ### Question ### What is the total quantity of products purchased by "Rodrick Heaney"? ### Accurate SQL ###
SELECT SUM(t3.order_quantity) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t1.customer_name = "Rodrick Heaney"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_62 (visitor VARCHAR, date VARCHAR) ### Question ### Who is the visitor on March 24? ### Accurate SQL ###
SELECT visitor FROM table_name_62 WHERE date = "march 24"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_203_70 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number ) ### Question ### what was the total medal count of switzerland ? ### Accurate SQL ###
SELECT "total" FROM table_203_70 WHERE "nation" = 'switzerland'
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_1998037_9 ( television_commentator VARCHAR, year_s_ VARCHAR ) ### Question ### Who is the television commentator for the year 2006? ### Accurate SQL ###
SELECT television_commentator FROM table_1998037_9 WHERE year_s_ = 2006
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_96 ( apps INTEGER, goals VARCHAR, rank VARCHAR ) ### Question ### How many apps when the rank was after 13 and having more than 73 goals? ### Accurate SQL ###
SELECT AVG(apps) FROM table_name_96 WHERE goals > 73 AND rank > 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_202_191 ( id number, "party" text, "votes" number, "%" number, "seats" number, "+/-" number ) ### Question ### how many more votes did the liberal democratic league win over the free thinking democratic league ? ### Accurate SQL ###
SELECT (SELECT "votes" FROM table_202_191 WHERE "party" = 'liberal democratic league') - (SELECT "votes" FROM table_202_191 WHERE "party" = 'free-thinking democratic league')
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_69 ( attendance VARCHAR, date VARCHAR ) ### Question ### What Attendance has a Date that is november 1, 1993? ### Accurate SQL ###
SELECT attendance FROM table_name_69 WHERE date = "november 1, 1993"
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_49552 ( "Date" text, "Home team" text, "Score" text, "Away team" text, "Venue" text, "Box Score" text, "Report" text ) ### Question ### what is the score when the home team is cairns taipans? ### Accurate SQL ###
SELECT "Score" FROM table_49552 WHERE "Home team" = 'cairns taipans'
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 written_by ( id int, msid int, wid int ) TABLE: CREATE TABLE actor ( aid int, gender text, name text, nationality text, birth_city text, birth_year int ) TABLE: CREATE TABLE tags ( id int, msid int, kid int ) TABLE: CREATE TABLE keyword ( id int, keyword text ) TABLE: CREATE TABLE copyright ( id int, msid int, cid int ) TABLE: CREATE TABLE writer ( wid int, gender text, name text, nationality text, birth_city text, birth_year int ) TABLE: CREATE TABLE genre ( gid int, genre text ) TABLE: CREATE TABLE tv_series ( sid int, title text, release_year int, num_of_seasons int, num_of_episodes int, title_aka text, budget text ) TABLE: CREATE TABLE cast ( id int, msid int, aid int, role text ) TABLE: CREATE TABLE made_by ( id int, msid int, pid int ) TABLE: CREATE TABLE movie ( mid int, title text, release_year int, title_aka text, budget text ) TABLE: CREATE TABLE company ( id int, name text, country_code varchar ) TABLE: CREATE TABLE producer ( pid int, gender text, name text, nationality text, birth_city text, birth_year int ) TABLE: CREATE TABLE directed_by ( id int, msid int, did int ) TABLE: CREATE TABLE director ( did int, gender text, name text, nationality text, birth_city text, birth_year int ) TABLE: CREATE TABLE classification ( id int, msid int, gid int ) ### Question ### Find the actors who played in the movie ' Camp X-Ray ### Accurate SQL ###
SELECT actor.name FROM actor, cast, movie WHERE cast.aid = actor.aid AND movie.mid = cast.msid AND movie.title = 'Camp X-Ray'
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_22809 ( "Episode title" text, "Subject" text, "Music by" text, "Performed by" text, "First aired" real ) ### Question ### When zachary sanders is the performer what is the lowerst first aired? ### Accurate SQL ###
SELECT MIN("First aired") FROM table_22809 WHERE "Performed by" = 'Zachary Sanders'
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_61 (loss VARCHAR, record VARCHAR) ### Question ### What was the loss of the game when the record was 27-17? ### Accurate SQL ###
SELECT loss FROM table_name_61 WHERE record = "27-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_49132 ( "Event" text, "Date" text, "Round" text, "Name" text, "Nationality" text, "Time" text, "Record" text ) ### Question ### Which event was Ye Shiwen in? ### Accurate SQL ###
SELECT "Event" FROM table_49132 WHERE "Name" = 'ye shiwen'
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_16 (young_rider_classification VARCHAR, general_classification VARCHAR, stage VARCHAR) ### Question ### Name the young rider classification for giuseppe saronni at stage 6 ### Accurate SQL ###
SELECT young_rider_classification FROM table_name_16 WHERE general_classification = "giuseppe saronni" AND stage = "6"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_8 (position VARCHAR, pick VARCHAR, team VARCHAR) ### Question ### what is the position when the pick is higher than 32 and the team is atlanta braves? ### Accurate SQL ###
SELECT position FROM table_name_8 WHERE pick > 32 AND team = "atlanta braves"
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_67386 ( "Position" text, "Number" real, "Name" text, "Class" text, "Injury (Status)" text, "Last Update" text ) ### Question ### for the name of jamar jackson what is the last update? ### Accurate SQL ###
SELECT "Last Update" FROM table_67386 WHERE "Name" = 'jamar jackson'
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_79858 ( "Game" real, "Date" text, "Location" text, "Time" text, "Attendance" real ) ### Question ### Location of ebbets field, and a Time of 2:56, and a Game larger than 6 has what sum of attendance? ### Accurate SQL ###
SELECT SUM("Attendance") FROM table_79858 WHERE "Location" = 'ebbets field' AND "Time" = '2:56' AND "Game" > '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 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 allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime 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 lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) ### Question ### have been prescribed acetaminophen, 50 ml vial : dextrose 50 % iv soln or acetaminophen (tylenol) tablet 650 mg to patient 022-89058 during the first hospital visit? ### 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 = '022-89058' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)) AND medication.drugname IN ('acetaminophen', '50 ml vial : dextrose 50 % iv soln', 'acetaminophen (tylenol) tablet 650 mg')
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_29 (games INTEGER, number VARCHAR) ### Question ### How many games has number 61 played in? ### Accurate SQL ###
SELECT MIN(games) AS ↑ FROM table_name_29 WHERE number = 61
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_26 (original_airdate VARCHAR, youtube_hero VARCHAR) ### Question ### What is the Original Airdate for the YouTube Hero greg pattillo? ### Accurate SQL ###
SELECT original_airdate FROM table_name_26 WHERE youtube_hero = "greg pattillo"
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 labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) 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 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 cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text ) TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) TABLE: CREATE TABLE 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 patients ( row_id number, subject_id number, gender text, dob time, dod 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 transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) ### Question ### what is the yearly minimum amount of the impact 2/3 strength of patient 58649 until 11/26/2105? ### Accurate SQL ###
SELECT MIN(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 58649)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'impact 2/3 strength' AND d_items.linksto = 'outputevents') AND STRFTIME('%y-%m-%d', outputevents.charttime) <= '2105-11-26' GROUP BY STRFTIME('%y', outputevents.charttime)
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_14118521_1 (edo_flight VARCHAR, duration VARCHAR) ### Question ### what's the edo flight with duration being 17 days, 15 hours, 53 minutes, 18 seconds ### Accurate SQL ###
SELECT edo_flight FROM table_14118521_1 WHERE duration = "17 days, 15 hours, 53 minutes, 18 seconds"
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_38 ( high_assists VARCHAR, team VARCHAR ) ### Question ### What is High Assists, when Team is 'Oklahoma City'? ### Accurate SQL ###
SELECT high_assists FROM table_name_38 WHERE team = "oklahoma city"
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_29569969_2 ( directed_by VARCHAR, us_viewers__millions_ VARCHAR ) ### Question ### Who directed the episode that had 1.48 million viewers in the U.S.? ### Accurate SQL ###
SELECT directed_by FROM table_29569969_2 WHERE us_viewers__millions_ = "1.48"
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_2 (launch_date VARCHAR, odds_of_winning VARCHAR) ### Question ### What is the launch date odds of winning 1 in 4.54? ### Accurate SQL ###
SELECT launch_date FROM table_name_2 WHERE odds_of_winning = "1 in 4.54"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_21926985_2 ( state_rank_by_revenue VARCHAR, company_name VARCHAR ) ### Question ### What is the rank for Murphy Oil? ### Accurate SQL ###
SELECT state_rank_by_revenue FROM table_21926985_2 WHERE company_name = "Murphy Oil"
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_17311783_9 ( team VARCHAR, date VARCHAR ) ### Question ### What team(s) did they play on march 9? ### Accurate SQL ###
SELECT team FROM table_17311783_9 WHERE date = "March 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 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 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 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 ### give me the number of patients whose gender is m and item id is 51148? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.gender = "M" AND lab.itemid = "51148"
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_910 ( id number, "rank" number, "name" text, "nationality" text, "result" number, "notes" text ) ### Question ### what was the average result of the top three jumpers ? ### Accurate SQL ###
SELECT AVG("result") FROM table_204_910 WHERE id <= 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_name_17 (attempts VARCHAR, completions VARCHAR) ### Question ### What number of attempts were recorded when the completions were 223? ### Accurate SQL ###
SELECT attempts FROM table_name_17 WHERE completions = "223"
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_51 (winning_amount VARCHAR, contestant_name VARCHAR) ### Question ### What winning amount has himesh reshammiya as the contestant name? ### Accurate SQL ###
SELECT winning_amount FROM table_name_51 WHERE contestant_name = "himesh reshammiya"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) TABLE: CREATE TABLE 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 treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) ### Question ### did patient 031-3355 have any organism on his last blood, venipuncture microbiology test in this year? ### Accurate SQL ###
SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355')) AND microlab.culturesite = 'blood, venipuncture' AND DATETIME(microlab.culturetakentime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY microlab.culturetakentime DESC LIMIT 1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_54 (score VARCHAR, player VARCHAR) ### Question ### What did Steve Stricker score? ### Accurate SQL ###
SELECT score FROM table_name_54 WHERE player = "steve stricker"
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_1341884_20 ( party VARCHAR, incumbent VARCHAR ) ### Question ### What party did Hale Boggs belong to? ### Accurate SQL ###
SELECT party FROM table_1341884_20 WHERE incumbent = "Hale Boggs"
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_27389024_2 ( original_air_date VARCHAR, written_by VARCHAR ) ### Question ### What is the original air date of the episode that was written by Rama Stagner? ### Accurate SQL ###
SELECT original_air_date FROM table_27389024_2 WHERE written_by = "Rama Stagner"
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_40 (date VARCHAR, round VARCHAR) ### Question ### What is the date where the round is R3? ### Accurate SQL ###
SELECT date FROM table_name_40 WHERE round = "r3"
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_35837 ( "Year" real, "Location" text, "Gold" text, "Silver" text, "Bronze" text ) ### Question ### Who won gold in the games where Pan Cheng-Tsung won silver? ### Accurate SQL ###
SELECT "Gold" FROM table_35837 WHERE "Silver" = 'pan cheng-tsung'
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 code_description ( code varchar, description text ) TABLE: CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) TABLE: CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) TABLE: CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar ) TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) TABLE: CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) TABLE: CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) TABLE: CREATE TABLE days ( days_code varchar, day_name varchar ) TABLE: CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) TABLE: CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_time int ) TABLE: CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar ) TABLE: CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) TABLE: CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) TABLE: CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) TABLE: CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) TABLE: CREATE TABLE state ( state_code text, state_name text, country_name text ) TABLE: CREATE TABLE month ( month_number int, month_name text ) TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id int ) ### Question ### show me the flights on DL that go through ATLANTA ### Accurate SQL ###
SELECT DISTINCT flight.flight_id FROM airport_service, city, flight, flight_stop WHERE city.city_code = airport_service.city_code AND city.city_name = 'ATLANTA' AND flight_stop.stop_airport = airport_service.airport_code AND flight.airline_code = 'DL' AND flight.flight_id = flight_stop.flight_id
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_train_236 ( "id" int, "renal_disease" bool, "creatinine_clearance_cl" float, "estimated_glomerular_filtration_rate_egfr" int, "hba1c" float, "fbg" int, "NOUSE" float ) ### Question ### fbg > 180 mg / dl ### Accurate SQL ###
SELECT * FROM table_train_236 WHERE fbg > 180
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_7 (total_votes INTEGER, outcome VARCHAR, candidate VARCHAR) ### Question ### How many votes did Lee Teng-Hui receive when he was elected? ### Accurate SQL ###
SELECT MAX(total_votes) FROM table_name_7 WHERE outcome = "elected" AND candidate = "lee teng-hui"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_42 (tournament VARCHAR) ### Question ### Which tournament had a 2010 finish of 4R? ### Accurate SQL ###
SELECT tournament FROM table_name_42 WHERE 2010 = "4r"
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_85 ( id number, "dates" text, "tournament" text, "host country" text, "winner" text, "notes" text ) ### Question ### how long did the estoril open last ? ### Accurate SQL ###
SELECT "dates" - "dates" FROM table_204_85 WHERE "tournament" = 'estoril open'
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 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 program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) TABLE: CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar ) TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) TABLE: CREATE TABLE gsi ( course_offering_id int, student_id 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 offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) 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 area ( course_id int, area varchar ) TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category 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 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 requirement ( requirement_id int, requirement varchar, college varchar ) ### Question ### What is the exact number of times that Prof. Joel Fish has taught course 141 ? ### Accurate SQL ###
SELECT COUNT(*) FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.number = 141 AND instructor.name LIKE '%Joel Fish%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id
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 CLASS ( CLASS_CODE varchar(5), CRS_CODE varchar(10), CLASS_SECTION varchar(2), CLASS_TIME varchar(20), CLASS_ROOM varchar(8), PROF_NUM int ) TABLE: CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER numeric, DEPT_CODE varchar(18), STU_PHONE varchar(4), PROF_NUM int ) TABLE: CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), EMP_HIREDATE datetime, EMP_DOB datetime ) TABLE: CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), DEPT_EXTENSION varchar(4) ) TABLE: CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) TABLE: CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) TABLE: CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) ### Question ### What is the lowest student GPA for every department? Return a pie chart. ### Accurate SQL ###
SELECT DEPT_CODE, MIN(STU_GPA) FROM STUDENT GROUP BY DEPT_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_13301516_1 ( no_in_series VARCHAR, original_air_date VARCHAR ) ### Question ### How many episodes originally aired on April 29, 2008? ### Accurate SQL ###
SELECT COUNT(no_in_series) FROM table_13301516_1 WHERE original_air_date = "April 29, 2008"
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 Customer_Orders ( order_id INTEGER, customer_id INTEGER, order_status_code VARCHAR(15), shipping_method_code VARCHAR(15), order_placed_datetime DATETIME, order_delivered_datetime DATETIME, order_shipping_charges VARCHAR(255) ) TABLE: CREATE TABLE Mailshot_Campaigns ( mailshot_id INTEGER, product_category VARCHAR(15), mailshot_name VARCHAR(80), mailshot_start_date DATETIME, mailshot_end_date DATETIME ) TABLE: CREATE TABLE Customers ( customer_id INTEGER, payment_method VARCHAR(15), customer_name VARCHAR(80), customer_phone VARCHAR(80), customer_email VARCHAR(80), customer_address VARCHAR(255), customer_login VARCHAR(80), customer_password VARCHAR(10) ) TABLE: CREATE TABLE Customer_Addresses ( customer_id INTEGER, premise_id INTEGER, date_address_from DATETIME, address_type_code VARCHAR(15), date_address_to DATETIME ) TABLE: CREATE TABLE Premises ( premise_id INTEGER, premises_type VARCHAR(15), premise_details VARCHAR(255) ) TABLE: CREATE TABLE Products ( product_id INTEGER, product_category VARCHAR(15), product_name VARCHAR(80) ) TABLE: CREATE TABLE Mailshot_Customers ( mailshot_id INTEGER, customer_id INTEGER, outcome_code VARCHAR(15), mailshot_customer_date DATETIME ) TABLE: CREATE TABLE Order_Items ( item_id INTEGER, order_item_status_code VARCHAR(15), order_id INTEGER, product_id INTEGER, item_status_code VARCHAR(15), item_delivered_datetime DATETIME, item_order_quantity VARCHAR(80) ) ### Question ### Show all distinct product categories along with the number of mailshots in each category Visualize by bar chart, and show from high to low by the total number please. ### Accurate SQL ###
SELECT product_category, COUNT(*) FROM Mailshot_Campaigns GROUP BY product_category ORDER BY COUNT(*) 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_22654073_7 ( high_points VARCHAR, high_rebounds VARCHAR ) ### Question ### Name the high points for mo williams , lebron james , j.j. hickson (6) ### Accurate SQL ###
SELECT COUNT(high_points) FROM table_22654073_7 WHERE high_rebounds = "Mo Williams , LeBron James , J.J. Hickson (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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) TABLE: CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(4,0) ) TABLE: CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) ### Question ### For all employees who have the letters D or S in their first name, give me the comparison about the average of department_id over the hire_date bin hire_date by weekday by a bar chart. ### Accurate SQL ###
SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
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_17 (inegi_code INTEGER, population_density___km_2__ VARCHAR, human_development_index__2000_ VARCHAR) ### Question ### WHich INEGI code has a Population density (/km 2 ) smaller than 81.4 and 0.6593 Human Development Index (2000)? ### Accurate SQL ###
SELECT AVG(inegi_code) FROM table_name_17 WHERE population_density___km_2__ < 81.4 AND human_development_index__2000_ = 0.6593
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_27 ( margin VARCHAR, date VARCHAR ) ### Question ### What is the Margin, when Date is 19 July 2008 (Round 19)? ### Accurate SQL ###
SELECT margin FROM table_name_27 WHERE date = "19 july 2008 (round 19)"
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_6584 ( "Date" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real ) ### Question ### Opponent of kilmarnock, and a Result of 1 1 happened in what venue? ### Accurate SQL ###
SELECT "Venue" FROM table_6584 WHERE "Opponent" = 'kilmarnock' AND "Result" = '1–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_1682026_3 (rank INTEGER, company VARCHAR) ### Question ### What is the ranking of BNP Paribas? ### Accurate SQL ###
SELECT MIN(rank) FROM table_1682026_3 WHERE company = "BNP Paribas"
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 intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime 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 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 ) ### Question ### has patient 002-16314 undergone a vitamin b12 test until 11/2100? ### Accurate SQL ###
SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-16314')) AND lab.labname = 'vitamin b12' AND STRFTIME('%y-%m', lab.labresulttime) <= '2100-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_40515 ( "Date" real, "Doubles, I Class" real, "Doubles, II Class" real, "Greater Doubles" real, "Doubles" real, "Semidoubles" real, "Total" real ) ### Question ### What is the lowest Semidoubles, when Doubles, II Class is 18, and when Total is less than 164? ### Accurate SQL ###
SELECT MIN("Semidoubles") FROM table_40515 WHERE "Doubles, II Class" = '18' AND "Total" < '164'
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_13619053_8 (high_points VARCHAR, record VARCHAR) ### Question ### Who scored the most points in the game where the Raptors became 13-49? ### Accurate SQL ###
SELECT high_points FROM table_13619053_8 WHERE record = "13-49"
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 intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime 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 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 ) ### Question ### how many times does patient 027-82318 have a urine output a day before? ### Accurate SQL ###
SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-82318')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'urine' AND DATETIME(intakeoutput.intakeoutputtime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day')
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_70 (gold INTEGER, total VARCHAR, bronze VARCHAR, rank VARCHAR) ### Question ### Name the most gold when bronze is more than 0 and rank is more than 5 with total more than 2 ### Accurate SQL ###
SELECT MAX(gold) FROM table_name_70 WHERE bronze > 0 AND rank > 5 AND total > 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_42090 ( "Office" text, "Democratic ticket" text, "Republican ticket" text, "American Labor ticket" text, "Socialist ticket" text ) ### Question ### Which Socialist candidate ran against American Labor candidate Caroline O'Day? ### Accurate SQL ###
SELECT "Socialist ticket" FROM table_42090 WHERE "American Labor ticket" = 'caroline o''day'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_67078 ( "Competition" text, "1993\u2013 94" text, "1994\u2013 95" text, "1995\u2013 96" text, "1996\u2013 97" text, "1997\u2013 98" text, "1998\u2013 99" text, "1999\u2013 2000" text, "2000\u2013 01" text, "2001\u2013 02" text, "2002\u2013 03" text, "2003\u2013 04" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text, "2013" text, "2014" text ) ### Question ### Name the 2012 which has 2000-01 of 1st ### Accurate SQL ###
SELECT "2012" FROM table_67078 WHERE "2000\u2013 01" = '1st'
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_74254 ( "Date/Location" text, "Mens singles" text, "Womens Singles" text, "U21 Mens" text, "U21 Womens" text, "Mixed Restricted" text, "Mixed Veteran" text ) ### Question ### When Matt Ware won the mens singles, who won the mixed restricted? ### Accurate SQL ###
SELECT "Mixed Restricted" FROM table_74254 WHERE "Mens singles" = 'Matt Ware'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_31 (high_points VARCHAR, game INTEGER) ### Question ### What is the highest amount of points when the game is less than 2? ### Accurate SQL ###
SELECT high_points FROM table_name_31 WHERE game < 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 Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) TABLE: CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) ### Question ### For those products with a price between 60 and 120, return a bar chart about the distribution of name and code , I want to sort by the Y in desc. ### Accurate SQL ###
SELECT Name, Code FROM Products WHERE Price BETWEEN 60 AND 120 ORDER BY Code 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 injury_accident (player VARCHAR, number_of_matches VARCHAR, SOURCE VARCHAR, injury VARCHAR) ### Question ### What are the player name, number of matches, and information source for players who do not suffer from injury of 'Knee problem'? ### Accurate SQL ###
SELECT player, number_of_matches, SOURCE FROM injury_accident WHERE injury <> 'Knee problem'
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_45 ( goals_against INTEGER, losses VARCHAR, wins VARCHAR, goals_for VARCHAR ) ### Question ### Which Goals against has Wins of 13, and Goals for larger than 42, and more than 9 Losses? ### Accurate SQL ###
SELECT AVG(goals_against) FROM table_name_45 WHERE wins = 13 AND goals_for > 42 AND losses > 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 table_name_53 ( term_start VARCHAR, born_died VARCHAR ) ### Question ### What is Term Start, when Born-Died is Prime Ministers 1939 - 1943? ### Accurate SQL ###
SELECT term_start FROM table_name_53 WHERE born_died = "prime ministers 1939 - 1943"
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 ( Id VARCHAR ) ### Question ### What was 2002, when 2008 was, 'career statistics'? ### Accurate SQL ###
SELECT 2002 FROM table_name_6 WHERE 2008 = "career statistics"
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 Plays_games (Stuid VARCHAR, hours_played INTEGER) ### Question ### Show all student ids and the number of hours played. ### Accurate SQL ###
SELECT Stuid, SUM(hours_played) FROM Plays_games GROUP BY Stuid
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_25368177_1 ( net_run_rate VARCHAR, total_points VARCHAR ) ### Question ### How many different net run rates did the team with 19 total points have? ### Accurate SQL ###
SELECT COUNT(net_run_rate) FROM table_25368177_1 WHERE total_points = 19
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_1341604_26 ( first_elected INTEGER, incumbent VARCHAR ) ### Question ### What year was ike skelton first elected? ### Accurate SQL ###
SELECT MIN(first_elected) FROM table_1341604_26 WHERE incumbent = "Ike Skelton"
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_70484 ( "Season" text, "Chassis" text, "Engine" text, "Tyres" text, "Rounds" text, "Teams" text, "Drivers" text, "Champion (points)" text, "Second (points)" text, "Third (points)" text ) ### Question ### Name the engine with rounds of 11 and teams of 25 ### Accurate SQL ###
SELECT "Engine" FROM table_70484 WHERE "Rounds" = '11' AND "Teams" = '25'
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_68 (venue VARCHAR, score VARCHAR) ### Question ### What is the Venue, when the Score is 56-4? ### Accurate SQL ###
SELECT venue FROM table_name_68 WHERE score = "56-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 SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) TABLE: CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number ) TABLE: CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) TABLE: CREATE TABLE PostTags ( PostId number, TagId number ) TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text ) TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) TABLE: CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) TABLE: CREATE TABLE VoteTypes ( Id number, Name text ) TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) TABLE: CREATE TABLE PostTypes ( Id number, Name text ) TABLE: CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) ### Question ### How many downvotes do I have for each tag?. ### Accurate SQL ###
SELECT TagName, COUNT(*) AS DownVotes FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId INNER JOIN Votes ON Votes.PostId = Posts.Id AND VoteTypeId = 3 WHERE Posts.OwnerUserId = '##UserId##' GROUP BY TagName ORDER BY DownVotes 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_40 (constructor VARCHAR, grid VARCHAR) ### Question ### Who built the grid 2 car? ### Accurate SQL ###
SELECT constructor FROM table_name_40 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_name_89 ( season VARCHAR, goals VARCHAR, apps VARCHAR ) ### Question ### How many seasons have 1 goals and more than 11 apps? ### Accurate SQL ###
SELECT COUNT(season) FROM table_name_89 WHERE goals = 1 AND apps > 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_73 ( assist_pass VARCHAR, result VARCHAR ) ### Question ### Which Assist/pass has a Result of 6-2? ### Accurate SQL ###
SELECT assist_pass FROM table_name_73 WHERE result = "6-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_752 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text ) ### Question ### What district has Albert Rains as their representative? ### Accurate SQL ###
SELECT "District" FROM table_752 WHERE "Incumbent" = 'Albert Rains'
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_43834 ( "Date" text, "Opponent" text, "Site" text, "Result" text, "Attendance" text ) ### Question ### Who was the opponent when the attendance was 31,002? ### Accurate SQL ###
SELECT "Opponent" FROM table_43834 WHERE "Attendance" = '31,002'
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 Apartments (apt_type_code VARCHAR) ### Question ### Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order. ### Accurate SQL ###
SELECT apt_type_code, COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*)
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 (home_team VARCHAR, away_team VARCHAR) ### Question ### What is the home team with scarborough as the away team? ### Accurate SQL ###
SELECT home_team FROM table_name_50 WHERE away_team = "scarborough"
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_301 ( id number, "nationality" text, "name" text, "term as a deputy judge" text, "reason for termination" text ) ### Question ### who was the last deputy judge with finland nationality ? ### Accurate SQL ###
SELECT "name" FROM table_204_301 WHERE "nationality" = 'finland' ORDER BY "term as a deputy judge" 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_21994729_3 ( written_by VARCHAR, directed_by VARCHAR ) ### Question ### reginald hudlin directed how many written by. ### Accurate SQL ###
SELECT written_by FROM table_21994729_3 WHERE directed_by = "Reginald Hudlin"
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE procedures ( 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 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 ### how many patients have been prescribed the drug with the drug code d12.5w250i? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "D12.5W250I"
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_69289 ( "D 41" text, "D 42" text, "D 43" text, "D 44" text, "D 45" text, "D 46" text, "D 47" text, "D 48" text ) ### Question ### What is the D44 when D41 is D 16? ### Accurate SQL ###
SELECT "D 44" FROM table_69289 WHERE "D 41" = 'd 16'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_44 (game INTEGER, record VARCHAR) ### Question ### What is the smallest game number with a record of 16-7-2? ### Accurate SQL ###
SELECT MIN(game) FROM table_name_44 WHERE record = "16-7-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_2679061_1 (college_junior_club_team VARCHAR, player VARCHAR) ### Question ### what is the college/junior/club team for the player alfie turcotte? ### Accurate SQL ###
SELECT college_junior_club_team FROM table_2679061_1 WHERE player = "Alfie Turcotte"
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 countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) TABLE: CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) TABLE: CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(4,0) ) TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) ### Question ### For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, show me about the distribution of hire_date and the average of salary bin hire_date by time in a bar chart. ### Accurate SQL ###
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
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_25920798_2 ( finish VARCHAR, vote VARCHAR ) ### Question ### Name the finish for 4-4 ### Accurate SQL ###
SELECT finish FROM table_25920798_2 WHERE vote = "4-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_name_56 ( home VARCHAR, record VARCHAR ) ### Question ### Who was the home team when the record was 21 45 8 5? ### Accurate SQL ###
SELECT home FROM table_name_56 WHERE record = "21–45–8–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 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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### what is admission time and diagnoses long title of subject id 813? ### Accurate SQL ###
SELECT demographic.admittime, diagnoses.long_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "813"
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_61 (team VARCHAR, score VARCHAR) ### Question ### Which team scored l 87–115 (ot)? ### Accurate SQL ###
SELECT team FROM table_name_61 WHERE score = "l 87–115 (ot)"
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_46534 ( "Round" real, "Pick" real, "Overall" real, "Name" text, "Position" text, "College" text ) ### Question ### WHAT IS THE SUM OF PICK WITH AN OVERALL LARGER THAN 250, AND FOR FLORIDA COLLEGE? ### Accurate SQL ###
SELECT SUM("Pick") FROM table_46534 WHERE "Overall" > '250' AND "College" = 'florida'
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 Subjects ( subject_id INTEGER, subject_name VARCHAR(120) ) TABLE: CREATE TABLE Students ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), family_name VARCHAR(40) ) TABLE: CREATE TABLE Course_Authors_and_Tutors ( author_id INTEGER, author_tutor_ATB VARCHAR(3), login_name VARCHAR(40), password VARCHAR(40), personal_name VARCHAR(80), middle_name VARCHAR(80), family_name VARCHAR(80), gender_mf VARCHAR(1), address_line_1 VARCHAR(80) ) TABLE: CREATE TABLE Student_Tests_Taken ( registration_id INTEGER, date_test_taken DATETIME, test_result VARCHAR(255) ) TABLE: CREATE TABLE Courses ( course_id INTEGER, author_id INTEGER, subject_id INTEGER, course_name VARCHAR(120), course_description VARCHAR(255) ) TABLE: CREATE TABLE Student_Course_Enrolment ( registration_id INTEGER, student_id INTEGER, course_id INTEGER, date_of_enrolment DATETIME, date_of_completion DATETIME ) ### Question ### A bar chart for what are the number of the completion dates of all the tests that have result 'Fail'?, display Y from high to low order. ### Accurate SQL ###
SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" ORDER BY COUNT(date_of_completion) 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 departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) TABLE: CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(4,0) ) TABLE: CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) ### Question ### For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, find job_id and the sum of manager_id , and group by attribute job_id, and visualize them by a bar chart. ### Accurate SQL ###
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID
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_64777 ( "Channel" real, "Video" text, "Aspect" text, "PSIP Short Name" text, "Network" text ) ### Question ### Which network has more than 31.4 channels with a 4:3 aspect? ### Accurate SQL ###
SELECT "Network" FROM table_64777 WHERE "Aspect" = '4:3' AND "Channel" > '31.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_name_84 ( year VARCHAR, nominee VARCHAR ) ### Question ### How many years does simon baker appear as a nominee? ### Accurate SQL ###
SELECT COUNT(year) FROM table_name_84 WHERE nominee = "simon baker"
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 (MAX VARCHAR, surface VARCHAR, winner VARCHAR) ### Question ### Which Event has a Surface of semifinal, and a Winner of hard (i)? ### Accurate SQL ###
SELECT NOT MAX AS event FROM table_name_23 WHERE surface = "semifinal" AND winner = "hard (i)"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) TABLE: CREATE TABLE 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 ### count the number of patients whose year of death is less than or equal to 2111 and lab test fluid is ascites? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2111.0" AND lab.fluid = "Ascites"