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_57372 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text ) ### Question ### What date has attendance listed as 45,024? ### Accurate SQL ###
SELECT "Date" FROM table_57372 WHERE "Attendance" = '45,024'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE bank ( branch_ID int, bname varchar(20), no_of_customers int, city varchar(10), state varchar(20) ) TABLE: CREATE TABLE loan ( loan_ID varchar(3), loan_type varchar(15), cust_ID varchar(3), branch_ID varchar(3), amount int ) TABLE: CREATE TABLE customer ( cust_ID varchar(3), cust_name varchar(20), acc_type char(1), acc_bal int, no_of_loans int, credit_score int, branch_ID int, state varchar(20) ) ### Question ### For each account type, find the average account balance of customers with credit score lower than 50 Show bar chart, and display by the bars in desc please. ### Accurate SQL ###
SELECT acc_type, AVG(acc_bal) FROM customer WHERE credit_score < 50 GROUP BY acc_type ORDER BY acc_type 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_203_189 ( id number, "year" number, "competition" text, "venue" text, "position" text, "notes" text ) ### Question ### how many competitions did jifar participate in before joining the 10000m ? ### Accurate SQL ###
SELECT COUNT("competition") FROM table_203_189 WHERE "notes" <> 10000
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_64314 ( "Name" text, "Geographic code" text, "Type" text, "Households" real, "Population (2004)" real, "Foreign population" real, "Moroccan population" real ) ### Question ### Which Foreign population has a Population (2004) larger than 234733? ### Accurate SQL ###
SELECT AVG("Foreign population") FROM table_64314 WHERE "Population (2004)" > '234733'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Parts ( part_id INTEGER, part_name VARCHAR(255), chargeable_yn VARCHAR(1), chargeable_amount VARCHAR(20), other_part_details VARCHAR(255) ) TABLE: CREATE TABLE Engineer_Skills ( engineer_id INTEGER, skill_id INTEGER ) TABLE: CREATE TABLE Staff ( staff_id INTEGER, staff_name VARCHAR(255), gender VARCHAR(1), other_staff_details VARCHAR(255) ) TABLE: CREATE TABLE Third_Party_Companies ( company_id INTEGER, company_type VARCHAR(5), company_name VARCHAR(255), company_address VARCHAR(255), other_company_details VARCHAR(255) ) TABLE: CREATE TABLE Part_Faults ( part_fault_id INTEGER, part_id INTEGER, fault_short_name VARCHAR(20), fault_description VARCHAR(255), other_fault_details VARCHAR(255) ) TABLE: CREATE TABLE Maintenance_Contracts ( maintenance_contract_id INTEGER, maintenance_contract_company_id INTEGER, contract_start_date DATETIME, contract_end_date DATETIME, other_contract_details VARCHAR(255) ) TABLE: CREATE TABLE Asset_Parts ( asset_id INTEGER, part_id INTEGER ) TABLE: CREATE TABLE Fault_Log_Parts ( fault_log_entry_id INTEGER, part_fault_id INTEGER, fault_status VARCHAR(10) ) TABLE: CREATE TABLE Maintenance_Engineers ( engineer_id INTEGER, company_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), other_details VARCHAR(255) ) TABLE: CREATE TABLE Assets ( asset_id INTEGER, maintenance_contract_id INTEGER, supplier_company_id INTEGER, asset_details VARCHAR(255), asset_make VARCHAR(20), asset_model VARCHAR(20), asset_acquired_date DATETIME, asset_disposed_date DATETIME, other_asset_details VARCHAR(255) ) TABLE: CREATE TABLE Skills_Required_To_Fix ( part_fault_id INTEGER, skill_id INTEGER ) TABLE: CREATE TABLE Fault_Log ( fault_log_entry_id INTEGER, asset_id INTEGER, recorded_by_staff_id INTEGER, fault_log_entry_datetime DATETIME, fault_description VARCHAR(255), other_fault_details VARCHAR(255) ) TABLE: CREATE TABLE Engineer_Visits ( engineer_visit_id INTEGER, contact_staff_id INTEGER, engineer_id INTEGER, fault_log_entry_id INTEGER, fault_status VARCHAR(10), visit_start_datetime DATETIME, visit_end_datetime DATETIME, other_visit_details VARCHAR(255) ) TABLE: CREATE TABLE Skills ( skill_id INTEGER, skill_code VARCHAR(20), skill_description VARCHAR(255) ) ### Question ### A stacked bar about the number of faults for different fault description and fault status of all the faults recoreded in the logs. ### Accurate SQL ###
SELECT fault_status, COUNT(fault_status) FROM Fault_Log AS T1 JOIN Fault_Log_Parts AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY fault_description, fault_status
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_56628 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) ### Question ### Who constructed the car with a grid larger than 20 that got in an accident? ### Accurate SQL ###
SELECT "Constructor" FROM table_56628 WHERE "Grid" > '20' AND "Time/Retired" = 'accident'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_51484 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text ) ### Question ### Which week's game was attended by 33,057 people? ### Accurate SQL ###
SELECT "Week" FROM table_51484 WHERE "Attendance" = '33,057'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### how many of the patients had abdomen artery incision on urgent admission? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.short_title = "Abdomen artery incision"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE ship ( flag VARCHAR ) ### Question ### Which flag is most widely used among all ships? ### Accurate SQL ###
SELECT flag FROM ship GROUP BY flag ORDER BY COUNT(*) DESC LIMIT 1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip 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 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 ta ( campus_job_id int, student_id int, location varchar ) TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int ) TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int ) TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int ) TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) TABLE: CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar ) TABLE: CREATE TABLE area ( course_id int, area varchar ) ### Question ### The only person who teaches Mini Classical Civilization , is it Prof. Gone ? ### Accurate SQL ###
SELECT DISTINCT course.department, course.name, course.number, instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.name LIKE '%Mini Classical Civilization%' AND NOT instructor.name LIKE '%Gone%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_2781227_11 (pick INTEGER, nhl_team VARCHAR) ### Question ### What was the minimum pick by the Florida Panthers? ### Accurate SQL ###
SELECT MIN(pick) FROM table_2781227_11 WHERE nhl_team = "Florida Panthers"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_27756164_2 (date VARCHAR, high_points VARCHAR) ### Question ### When did the Roy Hibbert (27) did the high points? ### Accurate SQL ###
SELECT date FROM table_27756164_2 WHERE high_points = "Roy Hibbert (27)"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_47702 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) ### Question ### What date was the visitor the Boston Bruins, and the record was 4 0 1? ### Accurate SQL ###
SELECT "Date" FROM table_47702 WHERE "Visitor" = 'boston bruins' AND "Record" = '4–0–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_2 ( second VARCHAR, fourth VARCHAR, fifth VARCHAR, sixth VARCHAR ) ### Question ### What team placed second during the season where Western Australia placed fifth, South Australia placed sixth, and Tasmania placed fourth? ### Accurate SQL ###
SELECT second FROM table_name_2 WHERE fifth = "western australia" AND sixth = "south australia" AND fourth = "tasmania"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_3707 ( "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (million)" text ) ### Question ### Title is the total number where u.s. viewers (million) is 7.56. ### Accurate SQL ###
SELECT COUNT("Title") FROM table_3707 WHERE "U.S. viewers (million)" = '7.56'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_20236726_2 ( serial_no VARCHAR, wd_no VARCHAR ) ### Question ### Name the total number of serial number for 24 wd no ### Accurate SQL ###
SELECT COUNT(serial_no) FROM table_20236726_2 WHERE wd_no = 24
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_13721 ( "Name" text, "Years" text, "A-League" text, "Finals" text, "Total" text, "Games per goal" real ) ### Question ### What player had a finals score of 0 (10)? ### Accurate SQL ###
SELECT "Name" FROM table_13721 WHERE "Finals" = '0 (10)'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_36272 ( "Date" text, "Site" text, "Sport" text, "Winning team" text, "Series" text ) ### Question ### Which winning team has Iowa city as the site, and december 3, 2006 as the date? ### Accurate SQL ###
SELECT "Winning team" FROM table_36272 WHERE "Site" = 'iowa city' AND "Date" = 'december 3, 2006'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_16429 ( "Rnd" real, "Race Name" text, "Pole position" text, "Fastest lap" text, "Winning driver" text, "Winning team" text, "Report" text ) ### Question ### Who drove the fastest lap at the Tenneco Automotive Grand Prix of Detroit? ### Accurate SQL ###
SELECT "Fastest lap" FROM table_16429 WHERE "Race Name" = 'Tenneco Automotive Grand Prix of Detroit'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_40 ( high_assists VARCHAR, team VARCHAR ) ### Question ### What are the High assists for Team houston? ### Accurate SQL ###
SELECT high_assists FROM table_name_40 WHERE team = "houston"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_40 (format VARCHAR, date VARCHAR, label VARCHAR) ### Question ### Which Format has a Date of 14 october 2008, and a Label of eagle eye media? ### Accurate SQL ###
SELECT format FROM table_name_40 WHERE date = "14 october 2008" AND label = "eagle eye media"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE vocals ( songid VARCHAR ) TABLE: CREATE TABLE songs ( songid VARCHAR ) ### Question ### How many songs have a shared vocal? ### Accurate SQL ###
SELECT COUNT(DISTINCT title) FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE TYPE = "shared"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE shop (LOCATION VARCHAR) ### Question ### How many different store locations are there? ### Accurate SQL ###
SELECT COUNT(DISTINCT LOCATION) FROM shop
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE faculty ( campus number, year number, faculty number ) TABLE: CREATE TABLE campuses ( id number, campus text, location text, county text, year number ) TABLE: CREATE TABLE enrollments ( campus number, year number, totalenrollment_ay number, fte_ay number ) TABLE: CREATE TABLE discipline_enrollments ( campus number, discipline number, year number, undergraduate number, graduate number ) TABLE: CREATE TABLE degrees ( year number, campus number, degrees number ) TABLE: CREATE TABLE csu_fees ( campus number, year number, campusfee number ) ### Question ### How many undergraduates are there at San Jose State ### Accurate SQL ###
SELECT SUM(t1.undergraduate) FROM discipline_enrollments AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t1.year = 2004 AND t2.campus = "San Jose State University"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_31132 ( "Country" text, "Remittances 2008" text, "Remittances 2009" text, "Remittances 2010" text, "Remittances 2011" text ) ### Question ### how many countries have remittances in 2008 of 9.07? ### Accurate SQL ###
SELECT COUNT("Country") FROM table_31132 WHERE "Remittances 2008" = '9.07'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_52191 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) ### Question ### Who was the home team at Princes Park when the attendance was more than 30,848? ### Accurate SQL ###
SELECT "Home team" FROM table_52191 WHERE "Crowd" > '30,848' AND "Venue" = 'princes park'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_19149550_7 ( black_caribbean_population INTEGER, other_black_population VARCHAR ) ### Question ### What is the black caribbean population when the other black population is 2243? ### Accurate SQL ###
SELECT MAX(black_caribbean_population) FROM table_19149550_7 WHERE other_black_population = 2243
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE trip (id VARCHAR, duration VARCHAR) ### Question ### What is the id of the trip that has the shortest duration? ### Accurate SQL ###
SELECT id FROM trip ORDER BY duration 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_4 (role VARCHAR, program VARCHAR) ### Question ### What's the roles of the Bionic Woman? ### Accurate SQL ###
SELECT role FROM table_name_4 WHERE program = "the bionic woman"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_84 ( evening_gown INTEGER, interview VARCHAR, preliminaries VARCHAR ) ### Question ### What is the evening gown score where the interview score is 9.22 and the preliminaries are larger than 9.057? ### Accurate SQL ###
SELECT SUM(evening_gown) FROM table_name_84 WHERE interview = 9.22 AND preliminaries > 9.057
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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_88 (lner_1946_no VARCHAR, order_no VARCHAR) ### Question ### What is order S24's LNER 1946 number? ### Accurate SQL ###
SELECT lner_1946_no FROM table_name_88 WHERE order_no = "s24"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_9302 ( "Date" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real ) ### Question ### What is the average Attendance, when Venue is 'A', and when Date is '5 January 2005'? ### Accurate SQL ###
SELECT AVG("Attendance") FROM table_9302 WHERE "Venue" = 'a' AND "Date" = '5 january 2005'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_33 ( catalog VARCHAR, label VARCHAR ) ### Question ### What is the catalog number for the Grilled Cheese label? ### Accurate SQL ###
SELECT catalog FROM table_name_33 WHERE label = "grilled cheese"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE 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 who have stayed in the hospital for more than 23 days with phenylephrine hcl. ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "23" AND prescriptions.drug = "Phenylephrine HCl"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_38 (goals VARCHAR, name VARCHAR, since VARCHAR, nat VARCHAR, transfer_fee VARCHAR) ### Question ### How many goals was by Rix from Eng who started before 2005 in the youth system? ### Accurate SQL ###
SELECT COUNT(goals) FROM table_name_38 WHERE nat = "eng" AND transfer_fee = "youth system" AND since < 2005 AND name = "rix"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_47447 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" real ) ### Question ### Which Country has a Year(s) won of 1977? ### Accurate SQL ###
SELECT "Country" FROM table_47447 WHERE "Year(s) won" = '1977'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE 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 ) ### Question ### Get me the number of american indian or alaska native patients who have procedure icd9 code 5101. ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND procedures.icd9_code = "5101"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Staff ( staff_id INTEGER, gender VARCHAR(1), first_name VARCHAR(80), last_name VARCHAR(80), email_address VARCHAR(255), phone_number VARCHAR(80) ) TABLE: CREATE TABLE Customers ( customer_id INTEGER, customer_type_code VARCHAR(20), address_line_1 VARCHAR(80), address_line_2 VARCHAR(80), town_city VARCHAR(80), state VARCHAR(80), email_address VARCHAR(255), phone_number VARCHAR(80) ) TABLE: CREATE TABLE Complaints ( complaint_id INTEGER, product_id INTEGER, customer_id INTEGER, complaint_outcome_code VARCHAR(20), complaint_status_code VARCHAR(20), complaint_type_code VARCHAR(20), date_complaint_raised DATETIME, date_complaint_closed DATETIME, staff_id INTEGER ) TABLE: CREATE TABLE Products ( product_id INTEGER, parent_product_id INTEGER, product_category_code VARCHAR(20), date_product_first_available DATETIME, date_product_discontinued DATETIME, product_name VARCHAR(80), product_description VARCHAR(255), product_price DECIMAL(19,4) ) ### Question ### What is the average price of the products for each category, could you list by the bars in ascending? ### Accurate SQL ###
SELECT product_category_code, AVG(product_price) FROM Products GROUP BY product_category_code ORDER BY product_category_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_60 (goals_conceded INTEGER, lost VARCHAR, points VARCHAR) ### Question ### Name the sum of goals conceded when lost is more than 7 and points less than 26 ### Accurate SQL ###
SELECT SUM(goals_conceded) FROM table_name_60 WHERE lost > 7 AND points < 26
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_16168849_1 ( current_conference VARCHAR, left VARCHAR ) ### Question ### Name the current conference for 1974, 1989 ### Accurate SQL ###
SELECT current_conference FROM table_16168849_1 WHERE left = "1974, 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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ### Question ### How many patients of hispanic or latino ethnicity are procedured with ptca? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND procedures.short_title = "PTCA"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text ) TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) TABLE: CREATE TABLE 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 cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) TABLE: CREATE TABLE 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_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) 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 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 diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) ### Question ### when did patient 22897 have a urine out foley output for the first time on 03/08/last year? ### Accurate SQL ###
SELECT outputevents.charttime 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 = 22897)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urine out foley' AND d_items.linksto = 'outputevents') AND DATETIME(outputevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m-%d', outputevents.charttime) = '03-08' ORDER BY outputevents.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 table_58838 ( "7:00 am" text, "9:00 am" text, "10:00 am" text, "11:00 am" text, "noon" text, "12:30 pm" text, "1:00 pm" text, "1:30 pm" text, "2:00 pm" text, "2:30 pm" text, "3:30 pm" text, "4:30 pm" text, "5:00 pm" text, "6:30 pm" text ) ### Question ### What shows for 3:30 pm when 2:30 pm is local programs? ### Accurate SQL ###
SELECT "5:00 pm" FROM table_58838 WHERE "2:30 pm" = 'local programs'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_71420 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real ) ### Question ### After 1961, who as the Entrant when the engine was a Ferrari v8, and when the points were lower than 23? ### Accurate SQL ###
SELECT "Entrant" FROM table_71420 WHERE "Year" > '1961' AND "Engine" = 'ferrari v8' AND "Points" < '23'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE constructors ( constructorId INTEGER, constructorRef TEXT, name TEXT, nationality TEXT, url TEXT ) TABLE: CREATE TABLE pitStops ( raceId INTEGER, driverId INTEGER, stop INTEGER, lap INTEGER, time TEXT, duration TEXT, milliseconds INTEGER ) TABLE: CREATE TABLE seasons ( year INTEGER, url TEXT ) TABLE: CREATE TABLE constructorResults ( constructorResultsId INTEGER, raceId INTEGER, constructorId INTEGER, points REAL, status TEXT ) TABLE: CREATE TABLE drivers ( driverId INTEGER, driverRef TEXT, number TEXT, code TEXT, forename TEXT, surname TEXT, dob TEXT, nationality TEXT, url TEXT ) TABLE: CREATE TABLE lapTimes ( raceId INTEGER, driverId INTEGER, lap INTEGER, position INTEGER, time TEXT, milliseconds INTEGER ) TABLE: CREATE TABLE qualifying ( qualifyId INTEGER, raceId INTEGER, driverId INTEGER, constructorId INTEGER, number INTEGER, position INTEGER, q1 TEXT, q2 TEXT, q3 TEXT ) TABLE: CREATE TABLE status ( statusId INTEGER, status TEXT ) TABLE: CREATE TABLE circuits ( circuitId INTEGER, circuitRef TEXT, name TEXT, location TEXT, country TEXT, lat REAL, lng REAL, alt TEXT, url TEXT ) TABLE: CREATE TABLE driverStandings ( driverStandingsId INTEGER, raceId INTEGER, driverId INTEGER, points REAL, position INTEGER, positionText TEXT, wins INTEGER ) TABLE: CREATE TABLE races ( raceId INTEGER, year INTEGER, round INTEGER, circuitId INTEGER, name TEXT, date TEXT, time TEXT, url TEXT ) TABLE: CREATE TABLE constructorStandings ( constructorStandingsId INTEGER, raceId INTEGER, constructorId INTEGER, points REAL, position INTEGER, positionText TEXT, wins INTEGER ) TABLE: CREATE TABLE results ( resultId INTEGER, raceId INTEGER, driverId INTEGER, constructorId INTEGER, number INTEGER, grid INTEGER, position TEXT, positionText TEXT, positionOrder INTEGER, points REAL, laps TEXT, time TEXT, milliseconds TEXT, fastestLap TEXT, rank TEXT, fastestLapTime TEXT, fastestLapSpeed TEXT, statusId INTEGER ) ### Question ### How many races that had any driver whose forename is Lewis? Show me a line chart, and sort by the X in descending please. ### Accurate SQL ###
SELECT year, COUNT(year) FROM results AS T1 JOIN races AS T2 ON T1.raceId = T2.raceId JOIN drivers AS T3 ON T1.driverId = T3.driverId WHERE T3.forename = "Lewis" ORDER BY year 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 program_course ( program_id int, course_id int, workload int, category varchar ) TABLE: CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments int, respected int, participation int, heavy_reading int, tough_grader int, hilarious int, would_take_again int, good_lecture int, no_skip int ) TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) 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 ( program_id int, name varchar, college varchar, introduction varchar ) TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int ) TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int ) TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) TABLE: CREATE TABLE area ( course_id int, area varchar ) TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int ) TABLE: CREATE TABLE 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 offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) TABLE: CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar ) ### Question ### What ULCS courses are available during Winter ? ### Accurate SQL ###
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id WHERE program_course.category LIKE '%ULCS%' AND semester.semester = 'Winter' AND semester.year = 2017
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_72723 ( "Episode No." real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text ) ### Question ### What is the production code for the episode written by Drew Z. Greenberg? ### Accurate SQL ###
SELECT "Production code" FROM table_72723 WHERE "Written by" = 'Drew Z. Greenberg'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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 (monday VARCHAR, sunday VARCHAR, series VARCHAR) ### Question ### Who was the presenter on Monday of "Big Brother 13" in which Alice Levine Jamie East presented on Sunday? ### Accurate SQL ###
SELECT monday FROM table_name_45 WHERE sunday = "alice levine jamie east" AND series = "big brother 13"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE 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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) ### Question ### Get the list of patients with a lab test category of chemistry who have diagnoses icd9 code 2764. ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "2764" AND lab."CATEGORY" = "Chemistry"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_16741821_9 ( round VARCHAR, opponents VARCHAR ) ### Question ### What is the name of the round against the opponents jesse huta galung peter wessels? ### Accurate SQL ###
SELECT round FROM table_16741821_9 WHERE opponents = "Jesse Huta Galung Peter Wessels"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_72419 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text ) ### Question ### How many in total were elected first in lost renomination? ### Accurate SQL ###
SELECT COUNT("First elected") FROM table_72419 WHERE "Result" = 'Lost renomination'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_59797 ( "Season" text, "League" text, "Teams" text, "Home" text, "Away" text ) ### Question ### Which season had a home 2-3? ### Accurate SQL ###
SELECT "Season" FROM table_59797 WHERE "Home" = '2-3'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_28068063_3 (eliminated_from_competition VARCHAR, proceed_to_quarter_final VARCHAR) ### Question ### Who was eliminated from the competition when pau proceed to the quarter final? ### Accurate SQL ###
SELECT eliminated_from_competition FROM table_28068063_3 WHERE proceed_to_quarter_final = "Pau"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ### Question ### what is drug type of drug name sodium chloride 3% inhalation soln? ### Accurate SQL ###
SELECT prescriptions.drug_type FROM prescriptions WHERE prescriptions.drug = "Sodium Chloride 3% Inhalation Soln"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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 (athlete VARCHAR, country VARCHAR) ### Question ### Which athlete represented the country of egypt? ### Accurate SQL ###
SELECT athlete FROM table_name_35 WHERE country = "egypt"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_8 (club VARCHAR, lost VARCHAR, tries_for VARCHAR) ### Question ### What is the Club, when the value for Lost is 9, and when the value for Tries is 55? ### Accurate SQL ###
SELECT club FROM table_name_8 WHERE lost = "9" AND tries_for = "55"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE cinema ( Cinema_ID int, Name text, Openning_year int, Capacity int, Location text ) TABLE: CREATE TABLE film ( Film_ID int, Rank_in_series int, Number_in_season int, Title text, Directed_by text, Original_air_date text, Production_code text ) TABLE: CREATE TABLE schedule ( Cinema_ID int, Film_ID int, Date text, Show_times_per_day int, Price float ) ### Question ### Show how many cinemas open for each year in a line chart, show x-axis from low to high order. ### Accurate SQL ###
SELECT Openning_year, COUNT(Openning_year) FROM cinema ORDER BY Openning_year
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE 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 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 lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) ### Question ### when was the last time that was patient 007-15837 had the maximum -monos in the current hospital encounter? ### Accurate SQL ###
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-15837' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = '-monos' ORDER BY lab.labresult DESC, lab.labresulttime 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_61 ( bronze INTEGER, rank VARCHAR ) ### Question ### What is the largest number for bronze with a rank of 19? ### Accurate SQL ###
SELECT MAX(bronze) FROM table_name_61 WHERE rank = "19"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_38 (military_deaths VARCHAR, total_casualties VARCHAR) ### Question ### How many members of the military died in the conflict that had a total of 531 casualties? ### Accurate SQL ###
SELECT military_deaths FROM table_name_38 WHERE total_casualties = "531"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_66 (attendance VARCHAR, date VARCHAR) ### Question ### How many people were at the match on July 13/ ### Accurate SQL ###
SELECT attendance FROM table_name_66 WHERE date = "july 13"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE VOTING_RECORD (Election_Cycle VARCHAR) ### Question ### For each election cycle, report the number of voting records. ### Accurate SQL ###
SELECT Election_Cycle, COUNT(*) FROM VOTING_RECORD GROUP BY Election_Cycle
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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_81 (soap_opera VARCHAR, rank VARCHAR, character VARCHAR) ### Question ### What soap opera has a rank larger than 1, and a Character named Emily Bishop? ### Accurate SQL ###
SELECT soap_opera FROM table_name_81 WHERE rank > 1 AND character = "emily bishop"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_23 ( MAX VARCHAR, surface VARCHAR, winner VARCHAR ) ### Question ### Which Event has a Surface of semifinal, and a Winner of hard (i)? ### Accurate SQL ###
SELECT NOT MAX AS event FROM table_name_23 WHERE surface = "semifinal" AND winner = "hard (i)"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_26 (attendance INTEGER, week VARCHAR) ### Question ### How many people attended the game on week 3? ### Accurate SQL ###
SELECT AVG(attendance) FROM table_name_26 WHERE week = 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_2361911_2 (regular_season VARCHAR, playoffs VARCHAR) ### Question ### Name the regular season for final playoffs ### Accurate SQL ###
SELECT regular_season FROM table_2361911_2 WHERE playoffs = "Final"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_51 ( sales VARCHAR, position VARCHAR, artist VARCHAR ) ### Question ### What were the sales for Dj Casper when he was in a position lower than 13? ### Accurate SQL ###
SELECT sales FROM table_name_51 WHERE position < 13 AND artist = "dj casper"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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_692 ( id number, "publication" text, "score" text, "review" text ) ### Question ### what publication scored the least ? ### Accurate SQL ###
SELECT "publication" FROM table_204_692 ORDER BY "score" 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_62 (venue VARCHAR, race VARCHAR) ### Question ### What is the venue of teh carfax 250 race? ### Accurate SQL ###
SELECT venue FROM table_name_62 WHERE race = "carfax 250"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int ) TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int ) TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction 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 comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) TABLE: CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments int, respected int, participation int, heavy_reading int, tough_grader int, hilarious int, would_take_again int, good_lecture int, no_skip int ) TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int ) TABLE: CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar ) TABLE: CREATE TABLE area ( course_id int, area varchar ) TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) ### Question ### For 561 , which software courses are prerequisites ? ### Accurate SQL ###
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0 INNER JOIN course_prerequisite ON COURSE_0.course_id = course_prerequisite.pre_course_id INNER JOIN course AS COURSE_1 ON COURSE_1.course_id = course_prerequisite.course_id INNER JOIN area ON COURSE_0.course_id = area.course_id WHERE area.area LIKE '%software%' AND COURSE_1.department = 'department0' AND COURSE_1.number = 561
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) TABLE: CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER numeric, DEPT_CODE varchar(18), STU_PHONE varchar(4), PROF_NUM int ) TABLE: CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), EMP_HIREDATE datetime, EMP_DOB datetime ) TABLE: CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) TABLE: CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) TABLE: CREATE TABLE CLASS ( CLASS_CODE varchar(5), CRS_CODE varchar(10), CLASS_SECTION varchar(2), CLASS_TIME varchar(20), CLASS_ROOM varchar(8), PROF_NUM int ) TABLE: CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), DEPT_EXTENSION varchar(4) ) ### Question ### How many courses for each course description? Show me a bar chart, list names in ascending order. ### Accurate SQL ###
SELECT CRS_DESCRIPTION, COUNT(CRS_DESCRIPTION) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE GROUP BY CRS_DESCRIPTION ORDER BY CRS_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 Sportsinfo ( gamesplayed INTEGER, sportname VARCHAR, onscholarship VARCHAR ) ### Question ### How many games are played for all football games by students on scholarship? ### Accurate SQL ###
SELECT SUM(gamesplayed) FROM Sportsinfo WHERE sportname = "Football" AND onscholarship = 'Y'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_10654 ( "Concession" text, "Date" real, "Grantee" text, "Size" text, "County" text ) ### Question ### Tell me the Grantee for san ysidro ### Accurate SQL ###
SELECT "Grantee" FROM table_10654 WHERE "Concession" = 'san ysidro'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_203_516 ( id number, "year" text, "team" text, "games" number, "punt return attempts" number, "punt return yards" number, "punts returned for touchdown" number, "punts fair caught" number, "longest punt return" number, "kickoff attempts" number, "kickoff return yards" number, "kickoffs returned for touchdown" number, "kickoffs fair caught" number, "longest kickoff return" number ) ### Question ### in 2013 , professional football player eddie royal had zero kickoff attempts ; how many kickoff attempts did he have during the previous year ? ### Accurate SQL ###
SELECT "kickoff attempts" FROM table_203_516 WHERE "year" = 2013 - 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_69 ( final_year INTEGER, north_or_east_terminus VARCHAR ) ### Question ### What is the most minimal Final year that has a North or east end of covington? ### Accurate SQL ###
SELECT MIN(final_year) FROM table_name_69 WHERE north_or_east_terminus = "covington"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_53 ( mascot VARCHAR, ihsaa_class VARCHAR, location VARCHAR ) ### Question ### Which Mascot has an IHSAA Class of aaa, and a Location of russiaville? ### Accurate SQL ###
SELECT mascot FROM table_name_53 WHERE ihsaa_class = "aaa" AND location = "russiaville"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_62 ( date VARCHAR, time VARCHAR, location VARCHAR ) ### Question ### What was date when the time was 2:26 and the location was Riverfront Stadium? ### Accurate SQL ###
SELECT date FROM table_name_62 WHERE time = "2:26" AND location = "riverfront 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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### count the number of patients whose primary disease is hypoxia and year of death is less than or equal to 2155? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "HYPOXIA" AND demographic.dod_year <= "2155.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 PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) TABLE: CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) TABLE: CREATE TABLE PostTags ( PostId number, TagId number ) TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) TABLE: CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) TABLE: CREATE TABLE VoteTypes ( Id number, Name text ) TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text ) TABLE: CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) TABLE: CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) TABLE: CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number ) TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) TABLE: CREATE TABLE PostTypes ( Id number, Name text ) ### Question ### get all posts and users. ### Accurate SQL ###
SELECT * FROM Posts WHERE OwnerDisplayName = 'praba230890'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_15465 ( "Ride Name" text, "Type" text, "Opened in" real, "Themed Land" text, "Manufacture" text ) ### Question ### Who is the manufacturer of the mini jet red baron ride that opened before 2001? ### Accurate SQL ###
SELECT "Manufacture" FROM table_15465 WHERE "Opened in" < '2001' AND "Type" = 'mini jet red baron'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE 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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) ### Question ### what is the number of patients whose days of hospital stay is greater than 6 and procedure long title is procedure on single vessel? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "6" AND procedures.long_title = "Procedure on single vessel"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_67744 ( "Season" real, "Season Premiere Date" text, "Season Finale Date" text, "Winner" text, "1st Runner Up" text, "2nd Runner Up" text ) ### Question ### When was the season finale of a show with season premiere on 12 December 2010? ### Accurate SQL ###
SELECT "Season Finale Date" FROM table_67744 WHERE "Season Premiere Date" = '12 december 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_name_59 ( payout___us$__ VARCHAR, bowl_game VARCHAR ) ### Question ### What was the payout in US dollars at the Insight Bowl? ### Accurate SQL ###
SELECT payout___us$__ FROM table_name_59 WHERE bowl_game = "insight bowl"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_70 ( place INTEGER, time VARCHAR ) ### Question ### What is the highest rank of a rider whose time was 1:19.02.8? ### Accurate SQL ###
SELECT MAX(place) FROM table_name_70 WHERE time = "1:19.02.8"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_18018214_4 ( goals_conceded VARCHAR, points VARCHAR ) ### Question ### In the game with 31 points, how many goals were conceded? ### Accurate SQL ###
SELECT COUNT(goals_conceded) FROM table_18018214_4 WHERE points = 31
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE fires ( fire_year number, discovery_date number, discovery_doy number, discovery_time text, stat_cause_code number, stat_cause_descr text, cont_date text, cont_doy text, cont_time text, fire_size number, fire_size_class text, latitude number, longitude number, owner_code number, owner_descr text, state text, county text, fips_code text, fips_name text ) ### Question ### How many distinct cause of the fire descriptions are there in the database? ### Accurate SQL ###
SELECT COUNT(DISTINCT stat_cause_descr) FROM fires
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_30074 ( "Week" real, "Date" text, "Kickoff" text, "Opponent" text, "Final score" text, "Team record" text, "Game site" text, "Attendance" real ) ### Question ### what was the achievement for the rival at scottish claymores ### Accurate SQL ###
SELECT "Team record" FROM table_30074 WHERE "Opponent" = 'at Scottish Claymores'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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_81 ( period VARCHAR, _number_found VARCHAR ) ### Question ### What's the Period with # found of 5? ### Accurate SQL ###
SELECT period FROM table_name_81 WHERE _number_found = "5"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_69388 ( "Year" text, "Champion" text, "Runner-Up" text, "3rd Place" text, "Location" text ) ### Question ### Name the champion for christopher miles runner-up ### Accurate SQL ###
SELECT "Champion" FROM table_69388 WHERE "Runner-Up" = 'christopher miles'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_70984 ( "Sydney" text, "Gold Coast" text, "Adelaide" text, "Melbourne" text, "Perth" text ) ### Question ### Which Adelaide has Perth no, Gold Coast no, and Sydney yes? ### Accurate SQL ###
SELECT "Adelaide" FROM table_70984 WHERE "Perth" = 'no' AND "Gold Coast" = 'yes' AND "Sydney" = 'yes'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) TABLE: CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(4,0) ) TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) TABLE: CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) ### Question ### For all employees who have the letters D or S in their first name, give me the comparison about the sum of salary over the job_id , and group by attribute job_id, and could you list x-axis from low to high order? ### Accurate SQL ###
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY JOB_ID
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_53633 ( "Manufacturer" text, "Type" text, "Quantity" real, "PTRD Nos." text, "GWR Nos." text ) ### Question ### What is the highest Quantity for PTRD Nos. 3, 15? ### Accurate SQL ###
SELECT MAX("Quantity") FROM table_53633 WHERE "PTRD Nos." = '3, 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_18590048_1 ( rank INTEGER, title VARCHAR ) ### Question ### What rank is Super Mario Land 2: 6 Golden Coins? ### Accurate SQL ###
SELECT MIN(rank) FROM table_18590048_1 WHERE title = "Super Mario Land 2: 6 Golden Coins"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_203_125 ( id number, "club" text, "winners" number, "runner-ups" number, "winning years" text, "runner-up years" text ) ### Question ### what was the first year that grazer ak won a performance ? ### Accurate SQL ###
SELECT "winning years" FROM table_203_125 WHERE "club" = 'grazer ak' ORDER BY "winning years" 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_64 ( points INTEGER, performer VARCHAR ) ### Question ### What is the sum of Points, when the Performer is fe-mail? ### Accurate SQL ###
SELECT SUM(points) FROM table_name_64 WHERE performer = "fe-mail"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_19485888_1 (title__french_____english_ VARCHAR, b_b_ VARCHAR, _corresponds_to_tf1s_broadcast_schedule VARCHAR) ### Question ### what is the title of the episode where b b is 20/16 ### Accurate SQL ###
SELECT title__french_____english_ FROM table_19485888_1 WHERE b_b_ = _corresponds_to_tf1s_broadcast_schedule = 20 / 16
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) TABLE: CREATE TABLE 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 vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) ### Question ### how much does patient 006-43795 change in weight measured at 2103-12-18 05:43:00 compared to the value measured at 2103-08-01 17:39:00? ### Accurate SQL ###
SELECT (SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-43795') AND NOT patient.admissionweight IS NULL AND patient.unitadmittime = '2103-12-18 05:43:00') - (SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-43795') AND NOT patient.admissionweight IS NULL AND patient.unitadmittime = '2103-08-01 17:39:00')
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) ### Question ### provide the number of hispanic or latino patients who are diagnosed with short title gstr/ddnts nos w/o hmrhg. ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND diagnoses.short_title = "Gstr/ddnts NOS w/o hmrhg"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_53 ( stories VARCHAR, height__m_ VARCHAR, year_of_completion VARCHAR ) ### Question ### How many stories have a height less than 138 meters with a completion date in 1971? ### Accurate SQL ###
SELECT stories FROM table_name_53 WHERE height__m_ < 138 AND year_of_completion = 1971
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) TABLE: CREATE TABLE 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 city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) TABLE: CREATE TABLE 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 class_of_service ( booking_class varchar, rank int, class_description text ) TABLE: CREATE TABLE state ( state_code text, state_name text, country_name text ) TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) 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 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 month ( month_number int, month_name text ) TABLE: CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_time int ) TABLE: CREATE TABLE code_description ( code varchar, description 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 airline ( airline_code varchar, airline_name text, note text ) TABLE: CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) TABLE: CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) TABLE: CREATE TABLE 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 days ( days_code varchar, day_name varchar ) TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id int ) ### Question ### okay could you get me a round trip ticket from INDIANAPOLIS to KANSAS CITY ### 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, fare, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'KANSAS CITY' AND NOT fare.round_trip_cost IS NULL AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'INDIANAPOLIS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code