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_16044 ( "Year" real, "Broadcast date" text, "BBC One total viewing" real, "BBC One Rank" text, "BBC Two total viewing" text, "BBC Two Rank" text ) ### Question ### What year was the BBC two total viewing 7,530,000? ### Accurate SQL ###
SELECT MIN("Year") FROM table_16044 WHERE "BBC Two total viewing" = '7,530,000'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_64 ( pop__2010_ INTEGER, land___sqmi__ VARCHAR, latitude VARCHAR, longitude VARCHAR ) ### Question ### What is the sum of the 2010 population with a latitude greater than 47.710905, a longitude of -101.79876, and less than 35.695 sq mi of land? ### Accurate SQL ###
SELECT SUM(pop__2010_) FROM table_name_64 WHERE latitude > 47.710905 AND longitude = -101.79876 AND land___sqmi__ < 35.695
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE albums (title VARCHAR) ### Question ### List every album's title. ### Accurate SQL ###
SELECT title FROM albums
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_24234 ( "Name" text, "Municipal status" text, "Census division" text, "Population (2011)" real, "Population (2006)" real, "Change (%)" text, "Area (km\u00b2)" text, "Population density" text ) ### Question ### What is the census division for the name Stratford? ### Accurate SQL ###
SELECT "Census division" FROM table_24234 WHERE "Name" = 'Stratford'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_20 ( us_cash_box VARCHAR, year VARCHAR, us_billboard VARCHAR ) ### Question ### What is the US cash box before 1978 with a US billboard of 35? ### Accurate SQL ###
SELECT us_cash_box FROM table_name_20 WHERE year < 1978 AND us_billboard = 35
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_29499399_2 (money_list_rank VARCHAR, player VARCHAR) ### Question ### What is Jonathan Kaye's money list ranking? ### Accurate SQL ###
SELECT COUNT(money_list_rank) FROM table_29499399_2 WHERE player = "Jonathan Kaye"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_13805773_2 ( song_title VARCHAR, points VARCHAR ) ### Question ### What is the title of the song that received 259 points? ### Accurate SQL ###
SELECT song_title FROM table_13805773_2 WHERE points = 259
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_29189 ( "Rank" real, "Rider" text, "Sat 21 Aug" text, "Mon 23 Aug" text, "Tues 24 Aug" text, "Wed 25 Aug" text, "Thurs 26 Aug" text, "Fri 27 Aug" text, "Sat 29 Aug" text ) ### Question ### When 20' 58.50 107.929mph is Friday August 27th What is Tuesday 24th August? ### Accurate SQL ###
SELECT "Tues 24 Aug" FROM table_29189 WHERE "Fri 27 Aug" = '20'' 58.50 107.929mph'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 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 departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_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 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 regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) ### Question ### For those employees who do not work in departments with managers that have ids between 100 and 200, return a scatter chart about the correlation between manager_id and department_id . ### Accurate SQL ###
SELECT MANAGER_ID, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_55352 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) ### Question ### When the driver mike hailwood has a grid greater than 12 and a Time/Retired of + 2 laps, what is the average number of laps? ### Accurate SQL ###
SELECT AVG("Laps") FROM table_55352 WHERE "Time/Retired" = '+ 2 laps' AND "Driver" = 'mike hailwood' AND "Grid" > '12'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_29474407_11 (year_of_intro VARCHAR, name__designation VARCHAR) ### Question ### How many years of introduction does the Neal Submachine Gun have? ### Accurate SQL ###
SELECT COUNT(year_of_intro) FROM table_29474407_11 WHERE name__designation = "Neal submachine gun"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_11222744_3 (catalog_number VARCHAR, title VARCHAR) ### Question ### What is the catalog number named callanetics: 10 years younger in 10 hours ### Accurate SQL ###
SELECT catalog_number FROM table_11222744_3 WHERE title = "Callanetics: 10 years Younger In 10 Hours"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 (airport VARCHAR, iata VARCHAR) ### Question ### Which airport has an IATA of hgh? ### Accurate SQL ###
SELECT airport FROM table_name_29 WHERE iata = "hgh"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_14981 ( "Stage" text, "Time" text, "Name" text, "Length" text, "Winner" text, "Rally leader" text ) ### Question ### What was the Time in the Mina Clavero 2 Stage? ### Accurate SQL ###
SELECT "Time" FROM table_14981 WHERE "Name" = 'mina clavero 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_64 (score VARCHAR, team VARCHAR) ### Question ### What is the score of team chicago? ### Accurate SQL ###
SELECT score FROM table_name_64 WHERE team = "chicago"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_92 (position VARCHAR, school_country VARCHAR) ### Question ### What position was for Arizona State? ### Accurate SQL ###
SELECT position FROM table_name_92 WHERE school_country = "arizona state"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 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 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 ### how many patients have been admitted in the hospital for 5 days with abdominal pain? ### Accurate SQL ###
SELECT MIN(demographic.age) FROM demographic WHERE demographic.diagnosis = "ABDOMINAL PAIN" AND demographic.days_stay = "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 journal_committee (journal_ID VARCHAR, work_type VARCHAR) TABLE: CREATE TABLE journal (sales INTEGER, journal_ID VARCHAR) ### Question ### What is the average sales of the journals that have an editor whose work type is 'Photo'? ### Accurate SQL ###
SELECT AVG(T1.sales) FROM journal AS T1 JOIN journal_committee AS T2 ON T1.journal_ID = T2.journal_ID WHERE T2.work_type = 'Photo'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Detention ( detention_id INTEGER, detention_type_code VARCHAR(10), teacher_id INTEGER, datetime_detention_start DATETIME, datetime_detention_end DATETIME, detention_summary VARCHAR(255), other_details VARCHAR(255) ) TABLE: CREATE TABLE Teachers ( teacher_id INTEGER, address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(80), last_name VARCHAR(80), gender VARCHAR(1), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), other_details VARCHAR(255) ) TABLE: CREATE TABLE Students ( student_id INTEGER, address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(40), last_name VARCHAR(40), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), date_first_rental DATETIME, date_left_university DATETIME, other_student_details VARCHAR(255) ) TABLE: CREATE TABLE Assessment_Notes ( notes_id INTEGER, student_id INTEGER, teacher_id INTEGER, date_of_notes DATETIME, text_of_notes VARCHAR(255), other_details VARCHAR(255) ) TABLE: CREATE TABLE Ref_Detention_Type ( detention_type_code VARCHAR(10), detention_type_description VARCHAR(80) ) TABLE: CREATE TABLE Addresses ( address_id INTEGER, line_1 VARCHAR(120), line_2 VARCHAR(120), line_3 VARCHAR(120), city VARCHAR(80), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), other_address_details VARCHAR(255) ) TABLE: CREATE TABLE Ref_Incident_Type ( incident_type_code VARCHAR(10), incident_type_description VARCHAR(80) ) TABLE: CREATE TABLE Behavior_Incident ( incident_id INTEGER, incident_type_code VARCHAR(10), student_id INTEGER, date_incident_start DATETIME, date_incident_end DATETIME, incident_summary VARCHAR(255), recommendations VARCHAR(255), other_details VARCHAR(255) ) TABLE: CREATE TABLE Students_in_Detention ( student_id INTEGER, detention_id INTEGER, incident_id INTEGER ) TABLE: CREATE TABLE Ref_Address_Types ( address_type_code VARCHAR(15), address_type_description VARCHAR(80) ) TABLE: CREATE TABLE Student_Addresses ( student_id INTEGER, address_id INTEGER, date_address_from DATETIME, date_address_to DATETIME, monthly_rental DECIMAL(19,4), other_details VARCHAR(255) ) ### Question ### Show me about the distribution of other_details and the average of monthly_rental , and group by attribute other_details in a bar chart. ### Accurate SQL ###
SELECT other_details, AVG(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental 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_85 ( distance VARCHAR, time VARCHAR ) ### Question ### What is the distance with a 1:46.32 time? ### Accurate SQL ###
SELECT distance FROM table_name_85 WHERE time = "1:46.32"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_34 ( score VARCHAR, decision VARCHAR, home VARCHAR ) ### Question ### What was the score for Boston's Home game that had Gerber as the decision? ### Accurate SQL ###
SELECT score FROM table_name_34 WHERE decision = "gerber" AND home = "boston"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text ) TABLE: CREATE TABLE 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 patients ( row_id number, subject_id number, gender text, dob time, dod time ) TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) ### Question ### what is the name of the diagnostic that patient 21977 first was received until 2104? ### Accurate SQL ###
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT diagnoses_icd.icd9_code FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 21977) AND STRFTIME('%y', diagnoses_icd.charttime) <= '2104' ORDER BY diagnoses_icd.charttime 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 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 ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### Specify the code of the drug Doxazosin ### Accurate SQL ###
SELECT prescriptions.formulary_drug_cd FROM prescriptions WHERE prescriptions.drug = "Doxazosin"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_2144389_8 (rōmaji VARCHAR, japanese_translation VARCHAR) ### Question ### Name the romaji by your side ~hikari's theme~ (popup.version) ### Accurate SQL ###
SELECT rōmaji FROM table_2144389_8 WHERE japanese_translation = "By Your Side ~Hikari's Theme~ (PopUp.Version)"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 (goals INTEGER, matches INTEGER) ### Question ### What average goals have matches less than 228? ### Accurate SQL ###
SELECT AVG(goals) FROM table_name_68 WHERE matches < 228
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE college ( college_id text, name_full text, city text, state text, country text ) TABLE: CREATE TABLE player_college ( player_id text, college_id text, year number ) TABLE: CREATE TABLE home_game ( year number, league_id text, team_id text, park_id text, span_first text, span_last text, games number, openings number, attendance number ) TABLE: CREATE TABLE pitching ( player_id text, year number, stint number, team_id text, league_id text, w number, l number, g number, gs number, cg number, sho number, sv number, ipouts number, h number, er number, hr number, bb number, so number, baopp number, era number, ibb number, wp number, hbp number, bk number, bfp number, gf number, r number, sh number, sf number, g_idp number ) TABLE: CREATE TABLE manager_half ( player_id text, year number, team_id text, league_id text, inseason number, half number, g number, w number, l number, rank number ) TABLE: CREATE TABLE pitching_postseason ( player_id text, year number, round text, team_id text, league_id text, w number, l number, g number, gs number, cg number, sho number, sv number, ipouts number, h number, er number, hr number, bb number, so number, baopp text, era number, ibb number, wp number, hbp number, bk number, bfp number, gf number, r number, sh number, sf number, g_idp number ) TABLE: CREATE TABLE manager_award ( player_id text, award_id text, year number, league_id text, tie text, notes number ) TABLE: CREATE TABLE all_star ( player_id text, year number, game_num number, game_id text, team_id text, league_id text, gp number, starting_pos number ) TABLE: CREATE TABLE salary ( year number, team_id text, league_id text, player_id text, salary number ) TABLE: CREATE TABLE fielding ( player_id text, year number, stint number, team_id text, league_id text, pos text, g number, gs number, inn_outs number, po number, a number, e number, dp number, pb number, wp number, sb number, cs number, zr number ) TABLE: CREATE TABLE appearances ( year number, team_id text, league_id text, player_id text, g_all number, gs number, g_batting number, g_defense number, g_p number, g_c number, g_1b number, g_2b number, g_3b number, g_ss number, g_lf number, g_cf number, g_rf number, g_of number, g_dh number, g_ph number, g_pr number ) TABLE: CREATE TABLE player_award ( player_id text, award_id text, year number, league_id text, tie text, notes text ) TABLE: CREATE TABLE team_half ( year number, league_id text, team_id text, half number, div_id text, div_win text, rank number, g number, w number, l number ) TABLE: CREATE TABLE park ( park_id text, park_name text, park_alias text, city text, state text, country text ) TABLE: CREATE TABLE fielding_postseason ( player_id text, year number, team_id text, league_id text, round text, pos text, g number, gs number, inn_outs number, po number, a number, e number, dp number, tp number, pb number, sb number, cs number ) TABLE: CREATE TABLE batting ( player_id text, year number, stint number, team_id text, league_id text, g number, ab number, r number, h number, double number, triple number, hr number, rbi number, sb number, cs number, bb number, so number, ibb number, hbp number, sh number, sf number, g_idp number ) TABLE: CREATE TABLE postseason ( year number, round text, team_id_winner text, league_id_winner text, team_id_loser text, league_id_loser text, wins number, losses number, ties number ) TABLE: CREATE TABLE manager ( player_id text, year number, team_id text, league_id text, inseason number, g number, w number, l number, rank number, plyr_mgr text ) TABLE: CREATE TABLE team ( year number, league_id text, team_id text, franchise_id text, div_id text, rank number, g number, ghome number, w number, l number, div_win text, wc_win text, lg_win text, ws_win text, r number, ab number, h number, double number, triple number, hr number, bb number, so number, sb number, cs number, hbp number, sf number, ra number, er number, era number, cg number, sho number, sv number, ipouts number, ha number, hra number, bba number, soa number, e number, dp number, fp number, name text, park text, attendance number, bpf number, ppf number, team_id_br text, team_id_lahman45 text, team_id_retro text ) TABLE: CREATE TABLE manager_award_vote ( award_id text, year number, league_id text, player_id text, points_won number, points_max number, votes_first number ) TABLE: CREATE TABLE player_award_vote ( award_id text, year number, league_id text, player_id text, points_won number, points_max number, votes_first number ) TABLE: CREATE TABLE fielding_outfield ( player_id text, year number, stint number, glf number, gcf number, grf number ) TABLE: CREATE TABLE player ( player_id text, birth_year number, birth_month number, birth_day number, birth_country text, birth_state text, birth_city text, death_year number, death_month number, death_day number, death_country text, death_state text, death_city text, name_first text, name_last text, name_given text, weight number, height number, bats text, throws text, debut text, final_game text, retro_id text, bbref_id text ) TABLE: CREATE TABLE team_franchise ( franchise_id text, franchise_name text, active text, na_assoc text ) TABLE: CREATE TABLE hall_of_fame ( player_id text, yearid number, votedby text, ballots number, needed number, votes number, inducted text, category text, needed_note text ) TABLE: CREATE TABLE batting_postseason ( year number, round text, player_id text, team_id text, league_id text, g number, ab number, r number, h number, double number, triple number, hr number, rbi number, sb number, cs number, bb number, so number, ibb number, hbp number, sh number, sf number, g_idp number ) ### Question ### List three countries which are the origins of the least players. ### Accurate SQL ###
SELECT birth_country FROM player GROUP BY birth_country ORDER BY COUNT(*) LIMIT 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_12407 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text ) ### Question ### Who is the player with a 70-68-74=212 score? ### Accurate SQL ###
SELECT "Player" FROM table_12407 WHERE "Score" = '70-68-74=212'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_83 (surface VARCHAR, partner VARCHAR) ### Question ### Which surface had Yew-Ming Si as a partner? ### Accurate SQL ###
SELECT surface FROM table_name_83 WHERE partner = "yew-ming si"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_16527640_2 ( location VARCHAR, player VARCHAR ) ### Question ### What locations did sid o'neill play football? ### Accurate SQL ###
SELECT location FROM table_16527640_2 WHERE player = "Sid O'Neill"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction 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 requirement ( requirement_id int, requirement varchar, college varchar ) TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) TABLE: CREATE TABLE 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 area ( course_id int, area varchar ) TABLE: CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar ) TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int ) TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) TABLE: CREATE TABLE course ( 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 ) ### Question ### What courses are not in the lab ? ### Accurate SQL ###
SELECT DISTINCT name, number FROM course WHERE department = 'EECS' AND has_lab = 'N'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 did last patient 021-155303 get admitted to the hospital? ### Accurate SQL ###
SELECT patient.hospitaladmitsource FROM patient WHERE patient.uniquepid = '021-155303' ORDER BY patient.hospitaladmittime 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_36290 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text ) ### Question ### Which Score has aN Outcome of winner on 4 november 1990? ### Accurate SQL ###
SELECT "Score" FROM table_36290 WHERE "Outcome" = 'winner' AND "Date" = '4 november 1990'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE 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 vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) ### Question ### count the number of patients who received a oxygen therapy (40% to 60%) - face mask procedure two or more times until 2 years ago? ### Accurate SQL ###
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, COUNT(*) AS c1 FROM patient WHERE patient.patientunitstayid = (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'oxygen therapy (40% to 60%) - face mask' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-2 year')) GROUP BY patient.uniquepid) AS t1 WHERE t1.c1 >= 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_77852 ( "Building" text, "Height" text, "Floors" real, "Year" real, "Status" text ) ### Question ### What are the number of floors for the building of td building redevelopment (office)? ### Accurate SQL ###
SELECT AVG("Floors") FROM table_77852 WHERE "Building" = 'td building redevelopment (office)'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_15 ( overall INTEGER, name VARCHAR ) ### Question ### Name the least overall for tony baker ### Accurate SQL ###
SELECT MIN(overall) FROM table_name_15 WHERE name = "tony 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 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 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 ) ### Question ### what is minimum age of patients whose days of hospital stay is 29 and admission year is greater than or equal to 2107? ### Accurate SQL ###
SELECT MIN(demographic.age) FROM demographic WHERE demographic.days_stay = "29" AND demographic.admityear >= "2107"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Apartment_Bookings ( apt_booking_id INTEGER, apt_id INTEGER, guest_id INTEGER, booking_status_code CHAR(15), booking_start_date DATETIME, booking_end_date DATETIME ) TABLE: CREATE TABLE Guests ( guest_id INTEGER, gender_code CHAR(1), guest_first_name VARCHAR(80), guest_last_name VARCHAR(80), date_of_birth DATETIME ) TABLE: CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) TABLE: CREATE TABLE Apartment_Facilities ( apt_id INTEGER, facility_code CHAR(15) ) TABLE: CREATE TABLE Apartments ( apt_id INTEGER, building_id INTEGER, apt_type_code CHAR(15), apt_number CHAR(10), bathroom_count INTEGER, bedroom_count INTEGER, room_count CHAR(5) ) TABLE: CREATE TABLE View_Unit_Status ( apt_id INTEGER, apt_booking_id INTEGER, status_date DATETIME, available_yn BIT ) ### Question ### Sort the gender codes in descending order of their corresponding number of guests. Return both the gender codes and counts. Visualize by pie chart. ### Accurate SQL ###
SELECT gender_code, COUNT(*) FROM Guests GROUP BY gender_code 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_70717 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" text ) ### Question ### What was Olin Dutra's score? ### Accurate SQL ###
SELECT "Score" FROM table_70717 WHERE "Player" = 'olin dutra'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_24425976_2 ( original_air_date VARCHAR, production_code VARCHAR ) ### Question ### What date did the episode with code 110 originally air? ### Accurate SQL ###
SELECT original_air_date FROM table_24425976_2 WHERE production_code = "110"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_43 (producer_s_ VARCHAR, songwriter_s_ VARCHAR) ### Question ### Who is sezen aksu's producer? ### Accurate SQL ###
SELECT producer_s_ FROM table_name_43 WHERE songwriter_s_ = "sezen aksu"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title 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 patients ( row_id number, subject_id number, gender text, dob time, dod 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 outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value 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 diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text ) TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title 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 labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) ### Question ### tell me the average sao2 of patient 7742 on the first intensive care unit visit? ### Accurate SQL ###
SELECT AVG(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 7742) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sao2' AND d_items.linksto = 'chartevents')
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_43 ( date VARCHAR, pole_position VARCHAR, circuit VARCHAR ) ### Question ### What is the date of the race when Jack Brabham is in the pole position and the circuit is Spa-Francorchamps? ### Accurate SQL ###
SELECT date FROM table_name_43 WHERE pole_position = "jack brabham" AND circuit = "spa-francorchamps"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_58 ( first_leg VARCHAR, opposition VARCHAR ) ### Question ### What was the first leg score in the match against Twente? ### Accurate SQL ###
SELECT first_leg FROM table_name_58 WHERE opposition = "twente"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_9993 ( "Round" real, "Pick" real, "Player" text, "Nationality" text, "College" text ) ### Question ### What is the sum of Round, when College is 'Norfolk State'? ### Accurate SQL ###
SELECT SUM("Round") FROM table_9993 WHERE "College" = 'norfolk state'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 ( source VARCHAR, date VARCHAR ) ### Question ### What is the source on 6 September? ### Accurate SQL ###
SELECT source FROM table_name_27 WHERE date = "6 september"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_33455 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) ### Question ### What was the away team's score at western oval? ### Accurate SQL ###
SELECT "Away team score" FROM table_33455 WHERE "Venue" = 'western oval'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_65 ( city___state VARCHAR, team VARCHAR ) ### Question ### What's the location of the team Peter Stuyvesant International Racing? ### Accurate SQL ###
SELECT city___state FROM table_name_65 WHERE team = "peter stuyvesant international racing"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_48 ( score_in_the_final VARCHAR, partner VARCHAR ) ### Question ### What is Partner Tomas Behrend's Score in the final? ### Accurate SQL ###
SELECT score_in_the_final FROM table_name_48 WHERE partner = "tomas behrend"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_35 ( date VARCHAR, opponents VARCHAR, venue VARCHAR ) ### Question ### Opponents of police, and a Venue of selayang municipal council stadium had what date? ### Accurate SQL ###
SELECT date FROM table_name_35 WHERE opponents = "police" AND venue = "selayang municipal council stadium"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_33476 ( "Player" text, "Position" text, "Round" real, "Overall" real, "College" text ) ### Question ### What is the highest overall pick from the College of Southern Mississippi that was selected before round 6? ### Accurate SQL ###
SELECT MAX("Overall") FROM table_33476 WHERE "College" = 'southern mississippi' AND "Round" < '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_60 ( lane INTEGER, nationality VARCHAR, rank VARCHAR ) ### Question ### What's Russia's lane when they were ranked before 1? ### Accurate SQL ###
SELECT MAX(lane) FROM table_name_60 WHERE nationality = "russia" AND rank < 1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE hall_of_fame ( player_id text, yearid number, votedby text, ballots text, needed text, votes text, inducted text, category text, needed_note text ) TABLE: CREATE TABLE player_award ( player_id text, award_id text, year number, league_id text, tie text, notes text ) TABLE: CREATE TABLE salary ( year number, team_id text, league_id text, player_id text, salary number ) TABLE: CREATE TABLE player ( player_id text, birth_year text, birth_month text, birth_day text, birth_country text, birth_state text, birth_city text, death_year text, death_month text, death_day text, death_country text, death_state text, death_city text, name_first text, name_last text, name_given text, weight text ) TABLE: CREATE TABLE player_award_vote ( award_id text, year number, league_id text, player_id text, points_won number, points_max number, votes_first text ) ### Question ### What is the top league that pays the most to their players? ### Accurate SQL ###
SELECT league_id FROM salary GROUP BY league_id ORDER BY SUM(salary) 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 days ( days_code varchar, day_name varchar ) TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) TABLE: CREATE TABLE code_description ( code varchar, description text ) TABLE: CREATE TABLE state ( state_code text, state_name text, country_name text ) TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name 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 month ( month_number int, month_name text ) 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 time_interval ( period text, begin_time int, end_time int ) TABLE: CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) 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 flight_fare ( flight_id int, fare_id int ) TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) TABLE: CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) TABLE: CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) TABLE: CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) 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 time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt 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_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 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 restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) ### Question ### DENVER to SAN FRANCISCO wednesday ### Accurate SQL ###
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND flight.from_airport = AIRPORT_SERVICE_0.airport_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_name_74 ( winning_team VARCHAR, winning_driver VARCHAR, pole_position VARCHAR ) ### Question ### Who did Teo Fabi drive for when he won and had pole position? ### Accurate SQL ###
SELECT winning_team FROM table_name_74 WHERE winning_driver = "teo fabi" AND pole_position = "teo fabi"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 ( team__b_ VARCHAR, match_date VARCHAR, s_no VARCHAR, margin VARCHAR ) ### Question ### What is Team (B), when S No is less than 18, when Margin is 8 Wickets, and when Match Date is Oct 30, 1989? ### Accurate SQL ###
SELECT team__b_ FROM table_name_31 WHERE s_no < 18 AND margin = "8 wickets" AND match_date = "oct 30, 1989"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ### Question ### count the number of patients whose year of death is less than or equal to 2174 and procedure icd9 code is 3532? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2174.0" AND procedures.icd9_code = "3532"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_9075 ( "Country or territory" text, "Area (km\u00b2)" real, "Population" real, "Population density (per km\u00b2)" real, "Capital" text ) ### Question ### What's the average area in canada with a population density (per km ) larger than 3.4? ### Accurate SQL ###
SELECT AVG("Area (km\u00b2)") FROM table_9075 WHERE "Country or territory" = 'canada' AND "Population density (per km\u00b2)" > '3.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_73783 ( "Song" text, "Singer" text, "Co-Singers" text, "Music Director" text, "Lyricist" text, "Co-Stars" text, "Movie/Album" text, "Year" real, "Additional Info" text ) ### Question ### What movie did Bela Bose co-star in? ### Accurate SQL ###
SELECT "Movie/Album" FROM table_73783 WHERE "Co-Stars" = 'Bela Bose'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE 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 ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title 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 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 diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text ) TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) 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 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 chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) ### Question ### count the number of patients who were prescribed lactulose during the same month after receiving the venous cath nec procedure in the previous year. ### Accurate SQL ###
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'venous cath nec') AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t1 JOIN (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'lactulose' AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.startdate AND DATETIME(t1.charttime, 'start of month') = DATETIME(t2.startdate, 'start of month')
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_11 ( season VARCHAR ) ### Question ### Which 20-29 had a season of 1997? ### Accurate SQL ###
SELECT 20 AS _29 FROM table_name_11 WHERE season = "1997"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_743 ( id number, "pos" text, "no" number, "driver" text, "constructor" text, "laps" number, "time/retired" text, "grid" number, "points" number ) ### Question ### how many laps in total is the race ? ### Accurate SQL ###
SELECT MAX("laps") FROM table_204_743
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_8324 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Replaced by" text, "Date of appointment" text ) ### Question ### Who was the outgoing manager that was replaced by Tony Mowbray? ### Accurate SQL ###
SELECT "Outgoing manager" FROM table_8324 WHERE "Replaced by" = 'tony mowbray'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_2508633_4 (pick__number VARCHAR, player VARCHAR) ### Question ### What number pick was Danny Walters in the 1983 NFL draft? ### Accurate SQL ###
SELECT COUNT(pick__number) FROM table_2508633_4 WHERE player = "Danny Walters"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) TABLE: CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) ### Question ### Show me a bar chart for what are the different affiliations, and what is the total enrollment of schools founded after 1850 for each enrollment type? ### Accurate SQL ###
SELECT Affiliation, SUM(Enrollment) FROM university WHERE Founded > 1850 GROUP BY Affiliation
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 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 ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### give me the number of patients whose ethnicity is white and primary disease is hypertension;rule out coronary artery disease\cardiac cath? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "WHITE" AND demographic.diagnosis = "HYPERTENSION;RULE OUT CORONARY ARTERY DISEASE\CARDIAC CATH"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_71575 ( "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text ) ### Question ### Who played on clay on 3 march 2012? ### Accurate SQL ###
SELECT "Opponent" FROM table_71575 WHERE "Surface" = 'clay' AND "Date" = '3 march 2012'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE airport_aircraft ( ID int, Airport_ID int, Aircraft_ID int ) TABLE: CREATE TABLE match ( Round real, Location text, Country text, Date text, Fastest_Qualifying text, Winning_Pilot text, Winning_Aircraft text ) TABLE: CREATE TABLE airport ( Airport_ID int, Airport_Name text, Total_Passengers real, %_Change_2007 text, International_Passengers real, Domestic_Passengers real, Transit_Passengers real, Aircraft_Movements real, Freight_Metric_Tonnes real ) TABLE: CREATE TABLE pilot ( Pilot_Id int(11), Name varchar(50), Age int(11) ) TABLE: CREATE TABLE aircraft ( Aircraft_ID int(11), Aircraft varchar(50), Description varchar(50), Max_Gross_Weight varchar(50), Total_disk_area varchar(50), Max_disk_Loading varchar(50) ) ### Question ### A bar chart for what are the number of the descriptions for the aircrafts? ### Accurate SQL ###
SELECT Description, COUNT(Description) FROM aircraft GROUP BY Description
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_time 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 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 food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) TABLE: CREATE TABLE code_description ( code varchar, description text ) TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare 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 flight_leg ( flight_id int, leg_number int, leg_flight int ) TABLE: CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) 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 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 state ( state_code text, state_name text, country_name text ) TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant 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 dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) TABLE: CREATE TABLE days ( days_code varchar, day_name varchar ) TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) 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 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 flight_fare ( flight_id int, fare_id int ) TABLE: CREATE TABLE month ( month_number int, month_name text ) TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) ### Question ### what does US mean ### Accurate SQL ###
SELECT DISTINCT airline_code FROM airline WHERE airline_code = 'US'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE student ( stu_num number, stu_lname text, stu_fname text, stu_init text, stu_dob time, stu_hrs number, stu_class text, stu_gpa number, stu_transfer number, dept_code text, stu_phone text, prof_num number ) TABLE: CREATE TABLE employee ( emp_num number, emp_lname text, emp_fname text, emp_initial text, emp_jobcode text, emp_hiredate time, emp_dob time ) TABLE: CREATE TABLE department ( dept_code text, dept_name text, school_code text, emp_num number, dept_address text, dept_extension text ) TABLE: CREATE TABLE class ( class_code text, crs_code text, class_section text, class_time text, class_room text, prof_num number ) TABLE: CREATE TABLE course ( crs_code text, dept_code text, crs_description text, crs_credit number ) TABLE: CREATE TABLE professor ( emp_num number, dept_code text, prof_office text, prof_extension text, prof_high_degree text ) TABLE: CREATE TABLE enroll ( class_code text, stu_num number, enroll_grade text ) ### Question ### What is the total number of professors with a Ph.D. ? ### Accurate SQL ###
SELECT COUNT(*) FROM professor WHERE prof_high_degree = 'Ph.D.'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_9924 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) ### Question ### Who was the home team on November 22? ### Accurate SQL ###
SELECT "Home" FROM table_9924 WHERE "Date" = 'november 22'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 ( rank INTEGER, floors__stories_ INTEGER ) ### Question ### Which is the highest ranked building with more than 15 floors? ### Accurate SQL ###
SELECT MAX(rank) FROM table_name_45 WHERE floors__stories_ > 15
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_74280 ( "Pick #" real, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text ) ### Question ### What daft pick number is the player coming from Regina Pats (WHL)? ### Accurate SQL ###
SELECT "Pick #" FROM table_74280 WHERE "College/junior/club team" = 'Regina Pats (WHL)'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE allergy_type ( allergy text, allergytype text ) TABLE: CREATE TABLE has_allergy ( stuid number, allergy text ) TABLE: CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) ### Question ### What are the distinct first names and cities of the students who have allergy either to milk or to cat? ### Accurate SQL ###
SELECT DISTINCT T1.fname, T1.city_code FROM student AS T1 JOIN has_allergy AS T2 ON T1.stuid = T2.stuid WHERE T2.allergy = "Milk" OR T2.allergy = "Cat"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_24 ( manufacturer VARCHAR, year_withdrawn INTEGER ) ### Question ### Who manufactured the vehicle withdrawn after 1932? ### Accurate SQL ###
SELECT manufacturer FROM table_name_24 WHERE year_withdrawn > 1932
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_67572 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text ) ### Question ### Who has the par score of 70-76-68-214? ### Accurate SQL ###
SELECT "To par" FROM table_67572 WHERE "Score" = '70-76-68-214'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_67 (director_s_ VARCHAR, title VARCHAR) ### Question ### What director(s) have the intouchables as the title? ### Accurate SQL ###
SELECT director_s_ FROM table_name_67 WHERE title = "the intouchables"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) 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 ( 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 dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) 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 compartment_class ( compartment varchar, class_type varchar ) TABLE: CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) TABLE: CREATE TABLE days ( days_code varchar, day_name varchar ) TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) TABLE: CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) 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 state ( state_code text, state_name text, country_name text ) TABLE: CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id int ) TABLE: CREATE TABLE month ( month_number int, month_name text ) TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_time int ) TABLE: CREATE TABLE code_description ( code varchar, description text ) TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant 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 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 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 ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) ### Question ### show me ground transportation for BOSTON ### Accurate SQL ###
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'BOSTON' AND ground_service.city_code = city.city_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_12517 ( "Rank" real, "Name" text, "Team" text, "Goals" real, "Appearances" real, "Minutes played" text ) ### Question ### What Rank has a Team of roma? ### Accurate SQL ###
SELECT "Rank" FROM table_12517 WHERE "Team" = 'roma'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 ( cover_model VARCHAR, date VARCHAR ) ### Question ### Who was the Cover model on 11-03? ### Accurate SQL ###
SELECT cover_model FROM table_name_96 WHERE date = "11-03"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_24982 ( "Year" text, "Chairman" text, "Artistic Director" text, "Performance Liaison" text, "Secretary" text, "Business manager" text, "Production Stagemanager" text, "Dramaturge" text, "Public Relations" text, "First/Second Year Rep." text, "Male Rep." text ) ### Question ### How many production stage managers worked with secretary Rachel Hartmann? ### Accurate SQL ###
SELECT COUNT("Production Stagemanager") FROM table_24982 WHERE "Secretary" = 'Rachel Hartmann'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_71 (crowd INTEGER, away_team VARCHAR) ### Question ### What is the highest crowd number of the game where the away team was south melbourne? ### Accurate SQL ###
SELECT MAX(crowd) FROM table_name_71 WHERE away_team = "south melbourne"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_17355408_5 ( high_points VARCHAR, date VARCHAR ) ### Question ### Name the highh points for december 29 ### Accurate SQL ###
SELECT high_points FROM table_17355408_5 WHERE date = "December 29"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_dew_point_f INTEGER, max_humidity INTEGER, mean_humidity INTEGER, min_humidity INTEGER, max_sea_level_pressure_inches NUMERIC, mean_sea_level_pressure_inches NUMERIC, min_sea_level_pressure_inches NUMERIC, max_visibility_miles INTEGER, mean_visibility_miles INTEGER, min_visibility_miles INTEGER, max_wind_Speed_mph INTEGER, mean_wind_speed_mph INTEGER, max_gust_speed_mph INTEGER, precipitation_inches INTEGER, cloud_cover INTEGER, events TEXT, wind_dir_degrees INTEGER, zip_code INTEGER ) TABLE: CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT ) TABLE: CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT ) TABLE: CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER ) ### Question ### What are the different ids and names of the stations that have had more than 12 bikes available Plot them as bar chart, I want to rank from low to high by the y-axis. ### Accurate SQL ###
SELECT name, id FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available > 12 ORDER BY 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_20310 ( "Week #" text, "Theme" text, "Song choice" text, "Original artist" text, "Order #" text, "Result" text ) ### Question ### Who was the original artist when the theme was 1980s? ### Accurate SQL ###
SELECT "Original artist" FROM table_20310 WHERE "Theme" = '1980s'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_59 ( attendance INTEGER, result VARCHAR ) ### Question ### What is the lowest attendance of a game that has the result of 2-0? ### Accurate SQL ###
SELECT MIN(attendance) FROM table_name_59 WHERE result = "2-0"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_68068 ( "Name" text, "Circuit" text, "Date" text, "Winning driver" text, "Winning constructor" text, "Report" text ) ### Question ### On what date did Aymo Maggi win the Rome Grand Prix ? ### Accurate SQL ###
SELECT "Date" FROM table_68068 WHERE "Winning driver" = 'aymo maggi' AND "Name" = 'rome grand prix'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) TABLE: CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text ) TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) 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 microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE 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 ) ### Question ### tell me the last output of patient 28253 until 773 days ago? ### Accurate SQL ###
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT outputevents.itemid 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 = 28253)) AND DATETIME(outputevents.charttime) <= DATETIME(CURRENT_TIME(), '-773 day') ORDER BY outputevents.charttime DESC LIMIT 1)
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_57 ( team VARCHAR, qual_1 VARCHAR ) ### Question ### What is Team when Qual 1 is 1:20.139? ### Accurate SQL ###
SELECT team FROM table_name_57 WHERE qual_1 = "1:20.139"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_98 ( loss VARCHAR, record VARCHAR ) ### Question ### What was the loss of the Mariners game when they had a record of 21-34? ### Accurate SQL ###
SELECT loss FROM table_name_98 WHERE record = "21-34"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 (level INTEGER, example_name VARCHAR, number_of_hus__approximate_ VARCHAR) ### Question ### What is the mean level number when the example name is lower snake and the approximate number is hus is less than 370? ### Accurate SQL ###
SELECT AVG(level) FROM table_name_42 WHERE example_name = "lower snake" AND number_of_hus__approximate_ < 370
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime 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 intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) ### Question ### for the last time until 07/2103, when was patient 025-33728 prescribed narcan and miralax at the same time? ### Accurate SQL ###
SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'narcan' AND patient.uniquepid = '025-33728' AND STRFTIME('%y-%m', medication.drugstarttime) <= '2103-07') AS t1 JOIN (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'miralax' AND patient.uniquepid = '025-33728' AND STRFTIME('%y-%m', medication.drugstarttime) <= '2103-07') AS t2 ON t1.uniquepid = t2.uniquepid WHERE DATETIME(t1.drugstarttime) = DATETIME(t2.drugstarttime) ORDER BY t1.drugstarttime DESC LIMIT 1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_22948559_1 (production_code VARCHAR, written_by VARCHAR) ### Question ### Name the production code by paul lieberstein ### Accurate SQL ###
SELECT production_code FROM table_22948559_1 WHERE written_by = "Paul Lieberstein"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_38930 ( "Player" text, "Touchdowns" real, "Extra points" real, "Field goals" real, "Points" real ) ### Question ### How many Touchdowns have Field goals larger than 0? ### Accurate SQL ###
SELECT COUNT("Touchdowns") FROM table_38930 WHERE "Field goals" > '0'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Reviewer ( rID VARCHAR, name VARCHAR ) ### Question ### What is the id of the reviewer whose name has substring Mike ? ### Accurate SQL ###
SELECT rID FROM Reviewer WHERE name LIKE "%Mike%"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE captain ( Captain_ID int, Name text, Ship_ID int, age text, Class text, Rank text ) TABLE: CREATE TABLE Ship ( Ship_ID int, Name text, Type text, Built_Year real, Class text, Flag text ) ### Question ### What is the total number of flags of ships that do not have a captain with the rank of Midshipman? Show the result using a bar chart, and rank by the X-axis in descending. ### Accurate SQL ###
SELECT Flag, COUNT(Flag) FROM Ship WHERE NOT Ship_ID IN (SELECT Ship_ID FROM captain WHERE Rank = 'Midshipman') GROUP BY Flag ORDER BY Flag 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_61 ( position VARCHAR, pick__number VARCHAR, player VARCHAR ) ### Question ### Which Position has a Pick # smaller than 26 and a Player of jack campbell? ### Accurate SQL ###
SELECT position FROM table_name_61 WHERE pick__number < 26 AND player = "jack campbell"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE SECTION (course_id VARCHAR, semester VARCHAR, YEAR VARCHAR) ### Question ### Find courses that ran in Fall 2009 or in Spring 2010. ### Accurate SQL ###
SELECT course_id FROM SECTION WHERE semester = 'Fall' AND YEAR = 2009 UNION SELECT course_id FROM SECTION WHERE semester = 'Spring' AND YEAR = 2010
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_33105 ( "Position" real, "Club" text, "Played" real, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Points" real, "Goal Difference" real ) ### Question ### What is the average goal difference using slavia sofia club? ### Accurate SQL ###
SELECT AVG("Goal Difference") FROM table_33105 WHERE "Club" = 'slavia sofia'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Reservations ( Code INTEGER, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate REAL, LastName TEXT, FirstName TEXT, Adults INTEGER, Kids INTEGER ) TABLE: CREATE TABLE Rooms ( RoomId TEXT, roomName TEXT, beds INTEGER, bedType TEXT, maxOccupancy INTEGER, basePrice INTEGER, decor TEXT ) ### Question ### Draw a bar chart for what is the average base price of rooms, for each bed type?, display x axis in asc order. ### Accurate SQL ###
SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType ORDER BY bedType
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_22 (entrant VARCHAR, rank VARCHAR) ### Question ### Which entrant has 25th as the rank? ### Accurate SQL ###
SELECT entrant FROM table_name_22 WHERE rank = "25th"