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_30487 ( "No." real, "#" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (million)" text )
### Question ###
Name the least number for xle02007
### Accurate SQL ###
| SELECT MIN("No.") FROM table_30487 WHERE "Production code" = 'XLE02007' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
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 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 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 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 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 Asset_Parts ( asset_id INTEGER, part_id INTEGER )
TABLE: CREATE TABLE Skills_Required_To_Fix ( part_fault_id INTEGER, skill_id INTEGER )
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 Skills ( skill_id INTEGER, skill_code VARCHAR(20), skill_description VARCHAR(255) )
TABLE: CREATE TABLE Fault_Log_Parts ( fault_log_entry_id INTEGER, part_fault_id INTEGER, fault_status VARCHAR(10) )
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 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) )
### Question ###
List the number of enginners and group by first name in a bar chart, and could you sort by the total number in ascending?
### Accurate SQL ###
| SELECT first_name, COUNT(first_name) FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id GROUP BY first_name ORDER BY COUNT(first_name) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_64759 ( "Game" text, "Date" text, "Opponent" text, "Score" text, "Location Attendance" text, "Record" text )
### Question ###
What is the location/attendance with a 26-11 record?
### Accurate SQL ###
| SELECT "Location Attendance" FROM table_64759 WHERE "Record" = '26-11' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_90 (chemical_class VARCHAR, example VARCHAR)
### Question ###
Which chemical class uses the example Chloroethane (ethyl chloride)?
### Accurate SQL ###
| SELECT chemical_class FROM table_name_90 WHERE example = "chloroethane (ethyl chloride)" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_36960 ( "Team" text, "Location" text, "Venue" text, "Capacity" real, "Position in 2004" text )
### Question ###
What's the highest capacity for a position of 5 in 2004?
### Accurate SQL ###
| SELECT MAX("Capacity") FROM table_36960 WHERE "Position in 2004" = '5' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_53 ( player VARCHAR, place VARCHAR )
### Question ###
Who is the player with a t8 place?
### Accurate SQL ###
| SELECT player FROM table_name_53 WHERE place = "t8" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_17102076_10 ( record VARCHAR, date VARCHAR )
### Question ###
Name the record for april 1
### Accurate SQL ###
| SELECT record FROM table_17102076_10 WHERE date = "April 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_203_204 ( id number, "year" number, "film" text, "language" text, "actors" text, "music" text, "banner" text, "note" text )
### Question ###
which film was the first to be directed by sridhar ?
### Accurate SQL ###
| SELECT "film" FROM table_203_204 ORDER BY "year" 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_29839 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
### Question ###
Name the record for w 101 93 (ot)
### Accurate SQL ###
| SELECT "Record" FROM table_29839 WHERE "Score" = 'W 101–93 (OT)' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_19 ( nfl_team VARCHAR, position VARCHAR )
### Question ###
Which NFL team picked a player for the Wide Receiver position?
### Accurate SQL ###
| SELECT nfl_team FROM table_name_19 WHERE position = "wide receiver" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_26578 ( "Processor" text, "Brand name" text, "Model (list)" text, "Cores" real, "L2 Cache" text, "Socket" text, "TDP" text )
### Question ###
What's the l2 cache of the model with TDP of 5.5-10 w?
### Accurate SQL ###
| SELECT "L2 Cache" FROM table_26578 WHERE "TDP" = '5.5-10 W' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE FLIGHTS (FlightNo VARCHAR, SourceAirport VARCHAR)
TABLE: CREATE TABLE AIRPORTS (AirportCode VARCHAR, City VARCHAR)
### Question ###
What are flight numbers of flights departing from City "Aberdeen "?
### Accurate SQL ###
| SELECT T1.FlightNo FROM FLIGHTS AS T1 JOIN AIRPORTS AS T2 ON T1.SourceAirport = T2.AirportCode WHERE T2.City = "Aberdeen" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar )
TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int )
TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar )
TABLE: CREATE TABLE 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 student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar )
TABLE: CREATE TABLE course_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 )
TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int )
TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int )
TABLE: CREATE TABLE 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 offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int )
TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar )
TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar )
TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar )
TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar )
TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar )
TABLE: CREATE TABLE course ( 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 )
### Question ###
COMP 416 requires me to take what classes before I can take it ?
### Accurate SQL ###
| SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT_RECORDalias0.student_id = 1) AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.department = 'COMP' AND COURSE_1.number = 416 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_80 ( events INTEGER, top_10 VARCHAR, top_5 VARCHAR )
### Question ###
What is the sum of Events, when Top-10 is 7, and when Top-5 is greater than 4?
### Accurate SQL ###
| SELECT SUM(events) FROM table_name_80 WHERE top_10 = 7 AND top_5 > 4 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_73 (result VARCHAR, opponent VARCHAR)
### Question ###
What is the result against everton?
### Accurate SQL ###
| SELECT result FROM table_name_73 WHERE opponent = "everton" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_34 (driver_s_ VARCHAR, crew_chief VARCHAR)
### Question ###
Who was the driver for crew chief Nick Carlson?
### Accurate SQL ###
| SELECT driver_s_ FROM table_name_34 WHERE crew_chief = "nick carlson" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_27268238_5 (matches VARCHAR, wickets VARCHAR)
### Question ###
How many matches were wickets 16?
### Accurate SQL ###
| SELECT COUNT(matches) FROM table_27268238_5 WHERE wickets = 16 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_203_763 ( id number, "year" number, "competition" text, "venue" text, "position" text, "notes" text )
### Question ###
before 1990 , how many second places were obtained ?
### Accurate SQL ###
| SELECT COUNT(*) FROM table_203_763 WHERE "year" < 1990 AND "position" = 2 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_54154 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
### Question ###
What is the number of the crowd when the away team score was 10.18 (78)?
### Accurate SQL ###
| SELECT COUNT("Crowd") FROM table_54154 WHERE "Away team score" = '10.18 (78)' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1529793_1 (primary_sponsor_s_ VARCHAR, driver_s_ VARCHAR)
### Question ###
Who is Jason Leffler's primary sponsor?
### Accurate SQL ###
| SELECT primary_sponsor_s_ FROM table_1529793_1 WHERE driver_s_ = "Jason Leffler" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_56 (attendance INTEGER, home VARCHAR)
### Question ###
What was the highest attendance for the Hispano team?
### Accurate SQL ###
| SELECT MAX(attendance) FROM table_name_56 WHERE home = "hispano" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_6 ( position VARCHAR, team VARCHAR )
### Question ###
What is the position of the player for the Baltimore Orioles?
### Accurate SQL ###
| SELECT position FROM table_name_6 WHERE team = "baltimore orioles" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text )
TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text )
TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text )
TABLE: CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time )
TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number )
TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text )
TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time )
TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number )
TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom 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 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 labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
### Question ###
when was the first time that patient 10431 until 2103 had received a insert endotracheal tube?
### Accurate SQL ###
| SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'insert endotracheal tube') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10431) AND STRFTIME('%y', procedures_icd.charttime) <= '2103' ORDER BY procedures_icd.charttime LIMIT 1 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_18 ( width INTEGER, frame_size VARCHAR, height VARCHAR )
### Question ###
What is the smallest width for a frame size of 5k and a height shorter than 2700?
### Accurate SQL ###
| SELECT MIN(width) FROM table_name_18 WHERE frame_size = "5k" AND height < 2700 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_95 ( studio VARCHAR, director_s_ VARCHAR )
### Question ###
What studio has directors John Lasseter and Andrew Stanton?
### Accurate SQL ###
| SELECT studio FROM table_name_95 WHERE director_s_ = "john lasseter and andrew stanton" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE party_forms ( party_id number, form_id number, date_completion_started time, form_status_code text, date_fully_completed time )
TABLE: CREATE TABLE party_addresses ( party_id number, address_id number, date_address_from time, address_type_code text, date_address_to time )
TABLE: CREATE TABLE party_services ( booking_id number, customer_id number, service_id number, service_datetime time, booking_made_date time )
TABLE: CREATE TABLE individuals ( individual_id number, individual_first_name text, individual_middle_name text, inidividual_phone text, individual_email text, individual_address text, individual_last_name text )
TABLE: CREATE TABLE forms ( form_id number, form_type_code text, service_id number, form_number text, form_name text, form_description text )
TABLE: CREATE TABLE organization_contact_individuals ( individual_id number, organization_id number, date_contact_from time, date_contact_to time )
TABLE: CREATE TABLE services ( service_id number, service_type_code text, service_name text, service_descriptio text )
TABLE: CREATE TABLE addresses ( address_id number, line_1_number_building text, town_city text, zip_postcode text, state_province_county text, country text )
TABLE: CREATE TABLE organizations ( organization_id number, date_formed time, organization_name text, uk_vat_number text )
TABLE: CREATE TABLE parties ( party_id number, payment_method_code text, party_phone text, party_email text )
### Question ###
What are the names of organizations that contain the word 'Party'?
### Accurate SQL ###
| SELECT organization_name FROM organizations WHERE organization_name LIKE "%Party%" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_13336122_7 (original_air_date VARCHAR, us_viewers__million_ VARCHAR)
### Question ###
How many episodes were seen by 0.67 million US viewers on their original air dates?
### Accurate SQL ###
| SELECT COUNT(original_air_date) FROM table_13336122_7 WHERE us_viewers__million_ = "0.67" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_67 (year VARCHAR, drivers VARCHAR, flaps VARCHAR)
### Question ###
How many years have Drivers of ben hanley, and Flaps smaller than 0?
### Accurate SQL ###
| SELECT COUNT(year) FROM table_name_67 WHERE drivers = "ben hanley" AND flaps < 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 student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text )
TABLE: CREATE TABLE sportsinfo ( stuid number, sportname text, hoursperweek number, gamesplayed number, onscholarship text )
TABLE: CREATE TABLE video_games ( gameid number, gname text, gtype text )
TABLE: CREATE TABLE plays_games ( stuid number, gameid number, hours_played number )
### Question ###
How many students play sports?
### Accurate SQL ###
| SELECT COUNT(DISTINCT stuid) FROM sportsinfo |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_694 ( id number, "year" text, "name" text, "date" text, "stages" number, "distance" text, "winner" text, "time" text )
### Question ###
what was the total number of winners before the tour was canceled ?
### Accurate SQL ###
| SELECT COUNT("winner") FROM table_204_694 WHERE "date" <> 'cancelled' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_94 ( college_junior_club_team VARCHAR, position VARCHAR, nationality VARCHAR )
### Question ###
What college/junior/club team is a left wing from Canada?
### Accurate SQL ###
| SELECT college_junior_club_team FROM table_name_94 WHERE position = "left wing" AND nationality = "canada" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
how many patients whose age is less than 27 and drug name is meropenem?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "27" AND prescriptions.drug = "Meropenem" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_8344 ( "Date" text, "Round" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real )
### Question ###
What was the result on 27 august 2003?
### Accurate SQL ###
| SELECT "Result" FROM table_8344 WHERE "Date" = '27 august 2003' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE station_company ( Station_ID int, Company_ID int, Rank_of_the_Year int )
TABLE: CREATE TABLE company ( Company_ID int, Rank int, Company text, Headquarters text, Main_Industry text, Sales_billion real, Profits_billion real, Assets_billion real, Market_Value real )
TABLE: CREATE TABLE gas_station ( Station_ID int, Open_Year int, Location text, Manager_Name text, Vice_Manager_Name text, Representative_Name text )
### Question ###
For each company id, what are the companies and how many gas stations does each one operate Plot them as bar chart, and order bars in descending order.
### Accurate SQL ###
| SELECT Company, COUNT(*) FROM station_company AS T1 JOIN company AS T2 ON T1.Company_ID = T2.Company_ID GROUP BY T1.Company_ID ORDER BY Company 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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
### Question ###
how many patients whose primary disease is acute subdural hematoma and year of death is less than or equal to 2183?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ACUTE SUBDURAL HEMATOMA" AND demographic.dod_year <= "2183.0" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_75 (away_team VARCHAR, home_team VARCHAR)
### Question ###
What was the score of the team North Melbourne played at Arden Street Oval?
### Accurate SQL ###
| SELECT away_team AS score FROM table_name_75 WHERE home_team = "north melbourne" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_26 (weight VARCHAR, block VARCHAR)
### Question ###
What is the total number of Weight(s), when Block is 300?
### Accurate SQL ###
| SELECT COUNT(weight) FROM table_name_26 WHERE block = 300 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 ( 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 days ( days_code varchar, day_name varchar )
TABLE: CREATE TABLE state ( state_code text, state_name text, country_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 flight_fare ( flight_id int, fare_id int )
TABLE: CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int )
TABLE: CREATE TABLE 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 time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int )
TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_time int )
TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int )
TABLE: CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text )
TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text )
TABLE: CREATE TABLE airline ( airline_code varchar, airline_name text, note text )
TABLE: CREATE TABLE month ( month_number int, month_name text )
TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar )
TABLE: CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar )
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 city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar )
TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar )
TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int )
TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int )
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 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 equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar )
### Question ###
list the flights from ST. PETERSBURG to TORONTO
### 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, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ST. PETERSBURG' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'TORONTO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_4 (away_team VARCHAR, venue VARCHAR)
### Question ###
What team was the away team for the venue punt road oval?
### Accurate SQL ###
| SELECT away_team FROM table_name_4 WHERE venue = "punt road oval" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_80085 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real )
### Question ###
Who was in 1963?
### Accurate SQL ###
| SELECT "Entrant" FROM table_80085 WHERE "Year" = '1963' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_27723228_12 ( record VARCHAR, score VARCHAR )
### Question ###
Name the record for w 101 93 (ot)
### Accurate SQL ###
| SELECT record FROM table_27723228_12 WHERE score = "W 101–93 (OT)" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_78112 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
### Question ###
What is the average grid for jack brabham going over 32 laps?
### Accurate SQL ###
| SELECT AVG("Grid") FROM table_78112 WHERE "Driver" = 'jack brabham' AND "Laps" > '32' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_204_583 ( id number, "capacitor type" text, "capacity" text, "volts" text, "temp." text, "energy-to-weight ratio" text, "power-to-weight ratio" text )
### Question ###
what comes after 2.7 volts
### Accurate SQL ###
| SELECT "volts" FROM table_204_583 WHERE id > (SELECT id FROM table_204_583 WHERE "volts" = 2.7 ORDER BY id DESC LIMIT 1) ORDER BY id LIMIT 1 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_7739 ( "Tournament" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text, "2013" text )
### Question ###
What is the tournament with a 2006 value of A and a 2011 value of 3r?
### Accurate SQL ###
| SELECT "Tournament" FROM table_7739 WHERE "2006" = 'a' AND "2011" = '3r' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_11 (number_of_mobile_phones VARCHAR, last_updated_date VARCHAR)
### Question ###
How many mobile phones were there as of April 2013?
### Accurate SQL ###
| SELECT number_of_mobile_phones FROM table_name_11 WHERE last_updated_date = "april 2013" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_97 ( team_1 VARCHAR )
### Question ###
What is 2nd Leg, when Team 1 is 'H'?
### Accurate SQL ###
| SELECT 2 AS nd_leg FROM table_name_97 WHERE team_1 = "h" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 aged below 54 years had the discharge location rehab/distinct part hospital?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "REHAB/DISTINCT PART HOSP" AND demographic.age < "54" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_63 (competition VARCHAR, goal VARCHAR)
### Question ###
What competition has 41 goals?
### Accurate SQL ###
| SELECT competition FROM table_name_63 WHERE goal = 41 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_15362 ( "D 48" text, "D 47" text, "D 46" text, "D 45" text, "D 44" text, "D 43" text, "D 42" text, "D 41" text )
### Question ###
Name the D 43 when it has D 45 of d 25
### Accurate SQL ###
| SELECT "D 43" FROM table_15362 WHERE "D 45" = 'd 25' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_204_57 ( id number, "year" number, "film" text, "role" text, "language" text, "notes" text )
### Question ###
what film was her last film in hindi ?
### Accurate SQL ###
| SELECT "film" FROM table_204_57 WHERE "language" = 'hindi' ORDER BY "year" DESC LIMIT 1 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_29363 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Replaced by" text, "Date of appointment" text, "Position in table" text )
### Question ###
Name the outgoing manager for mutual consent and position 16th
### Accurate SQL ###
| SELECT "Outgoing manager" FROM table_29363 WHERE "Manner of departure" = 'Mutual consent' AND "Position in table" = '16th' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_22834834_3 ( outcome VARCHAR, score_in_the_final VARCHAR )
### Question ###
Which outcomes have a final score of 6 3, 6 2?
### Accurate SQL ###
| SELECT outcome FROM table_22834834_3 WHERE score_in_the_final = "6–3, 6–2" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text )
TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId 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 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 ReviewTaskStates ( Id number, Name text, Description text )
TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number )
TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number )
TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId 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 PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time )
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 PostTypes ( Id number, Name text )
TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text )
TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId 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 PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text )
TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number )
TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean )
TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostTags ( PostId number, TagId number )
TABLE: CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number )
TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text )
TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId 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 VoteTypes ( Id number, Name text )
### Question ###
How many posts have the exact same number of answers?.
### Accurate SQL ###
| SELECT PostTypeId, COUNT(AnswerCount) AS Numberofanswers FROM Posts GROUP BY PostTypeId |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_12976038_1 (director VARCHAR, viewers__in_millions_ VARCHAR)
### Question ###
Who directed the episode that had 6.04 million viewers?
### Accurate SQL ###
| SELECT director FROM table_12976038_1 WHERE viewers__in_millions_ = "6.04" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_18 (rnd VARCHAR, college VARCHAR)
### Question ###
What is Northern Colorado's Rnd.?
### Accurate SQL ###
| SELECT rnd FROM table_name_18 WHERE college = "northern colorado" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 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 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 ###
how many patients were treated with additive therapy on urgent admission?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "URGENT" AND prescriptions.drug_type = "ADDITIVE" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_743 ( id number, "version" text, "date" text, "development cycle" text, "size (in kb)" number, "download" text, "notes" text )
### Question ###
what is the last version of the 16 bit cello to be released in the beta cycle ?
### Accurate SQL ###
| SELECT "version" FROM table_203_743 WHERE "development cycle" = 'beta' ORDER BY id 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_64 ( Id VARCHAR )
### Question ###
What is the total number of 1876(s), when 1872 is less than 1921, and when 1891 is less than 354?
### Accurate SQL ###
| SELECT COUNT(1876) FROM table_name_64 WHERE 1872 < 1921 AND 1891 < 354 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 ( site VARCHAR, sport VARCHAR )
### Question ###
Which Site has a Sport of w swimming?
### Accurate SQL ###
| SELECT site FROM table_name_38 WHERE sport = "w swimming" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_751 ( id number, "year" number, "title" text, "peak chart positions\nus\nair" number, "peak chart positions\nus\nmain" number, "peak chart positions\nus\nmod" number, "album" text )
### Question ###
how many singles were released as part of an album ?
### Accurate SQL ###
| SELECT COUNT("title") FROM table_203_751 WHERE "album" <> 'non-album single' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_75 ( team VARCHAR, best VARCHAR )
### Question ###
what is the team with the best of 1:43.134?
### Accurate SQL ###
| SELECT team FROM table_name_75 WHERE best = "1:43.134" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE station ( Station_ID int, Name text, Annual_entry_exit real, Annual_interchanges real, Total_Passengers real, Location text, Main_Services text, Number_of_Platforms int )
TABLE: CREATE TABLE train ( Train_ID int, Name text, Time text, Service text )
TABLE: CREATE TABLE train_station ( Train_ID int, Station_ID int )
### Question ###
Show the name of all trains, count the name and show them with a bar chart, could you rank in asc by the X please?
### Accurate SQL ###
| SELECT Name, COUNT(Name) FROM train GROUP BY Name ORDER BY Name |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_28 ( score VARCHAR, to_par VARCHAR, country VARCHAR )
### Question ###
WHich Score has a To par of 3, and a Country of united states?
### Accurate SQL ###
| SELECT score FROM table_name_28 WHERE to_par = "–3" AND country = "united states" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_17925 ( "Position" real, "Club" text, "Played" real, "Won" real, "Drawn" real, "Lost" real, "Pts For" real, "Pts Agst" real, "B.P." real, "Points" real )
### Question ###
How many games did whitehaven win?
### Accurate SQL ###
| SELECT MIN("Won") FROM table_17925 WHERE "Club" = 'Whitehaven' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_388 ( id number, "#" number, "date" text, "visitor" text, "score" text, "home" text, "record" text, "pts" number )
### Question ###
what was the total amount of points scored on november 4th ?
### Accurate SQL ###
| SELECT "score" + "score" FROM table_204_388 WHERE "date" = 'november 4' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE Statements ( Statement_ID INTEGER, Statement_Details VARCHAR(255) )
TABLE: CREATE TABLE Ref_Budget_Codes ( Budget_Type_Code CHAR(15), Budget_Type_Description VARCHAR(255) )
TABLE: CREATE TABLE Documents ( Document_ID INTEGER, Document_Type_Code CHAR(15), Project_ID INTEGER, Document_Date DATETIME, Document_Name VARCHAR(255), Document_Description VARCHAR(255), Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Projects ( Project_ID INTEGER, Project_Details VARCHAR(255) )
TABLE: CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15), Document_Type_Name VARCHAR(255), Document_Type_Description VARCHAR(255) )
TABLE: CREATE TABLE Documents_with_Expenses ( Document_ID INTEGER, Budget_Type_Code CHAR(15), Document_Details VARCHAR(255) )
TABLE: CREATE TABLE Accounts ( Account_ID INTEGER, Statement_ID INTEGER, Account_Details VARCHAR(255) )
### Question ###
Return a bar chart to show how many documents for different budget type code, I want to list from high to low by the bars.
### Accurate SQL ###
| SELECT T1.Budget_Type_Code, COUNT(T1.Budget_Type_Code) FROM Documents_with_Expenses AS T1 JOIN Ref_Budget_Codes AS T2 ON T1.Budget_Type_Code = T2.Budget_Type_Code GROUP BY T1.Budget_Type_Code ORDER BY T1.Budget_Type_Code DESC |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
### Question ###
among the patients 40s the previous year, what were the four most common diagnoses?
### Accurate SQL ###
| SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 40 AND 49) AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 4 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_95 ( location VARCHAR, rank VARCHAR )
### Question ###
Which location has a rank of 147?
### Accurate SQL ###
| SELECT location FROM table_name_95 WHERE rank = 147 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_52881 ( "Nationality" text, "Metric" text, "Imperial" text, "Name" text, "Lifespan" text )
### Question ###
what is the lifespan when the imperial height is 7ft 8 in and the nationality is fiji?
### Accurate SQL ###
| SELECT "Lifespan" FROM table_52881 WHERE "Imperial" = '7ft 8 in' AND "Nationality" = 'fiji' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_631 ( id number, "#" number, "title" text, "english translation" text, "original album" text, "length" text )
### Question ###
how many albums did not have a time length ?
### Accurate SQL ###
| SELECT COUNT("title") FROM table_204_631 WHERE "length" IS NULL |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_83 ( country VARCHAR, hanja VARCHAR )
### Question ###
Which country has a city with a Hanja of ?
### Accurate SQL ###
| SELECT country FROM table_name_83 WHERE hanja = "平安北道" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
### Question ###
what was the first height of patient 021-25705 in the last month.
### Accurate SQL ###
| SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-25705') AND NOT patient.admissionheight IS NULL AND DATETIME(patient.unitadmittime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY patient.unitadmittime 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_8977 ( "Game" real, "December" real, "Opponent" text, "Score" text, "Record" text )
### Question ###
Who was the opponent in Game 27?
### Accurate SQL ###
| SELECT "Opponent" FROM table_8977 WHERE "Game" = '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_name_28 (team VARCHAR, manager VARCHAR)
### Question ###
Which team does David O'leary manage?
### Accurate SQL ###
| SELECT team FROM table_name_28 WHERE manager = "david o'leary" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime 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 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 ###
during this month has patient 012-4131 received a potassium test?
### Accurate SQL ###
| SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-4131')) AND lab.labname = 'potassium' AND DATETIME(lab.labresulttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_18835 ( "Club" text, "Played" text, "Won" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Tries for" text, "Tries against" text, "Try bonus" text, "Losing bonus" text, "Points" text )
### Question ###
what is the total amount of tries where the points were 325?
### Accurate SQL ###
| SELECT COUNT("Tries against") FROM table_18835 WHERE "Points for" = '325' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_72302 ( "Election" real, "# of candidates nominated" real, "# of seats won" real, "# of total votes" real, "% of popular vote" text )
### Question ###
What year was the election when the # of seats won was 65?
### Accurate SQL ###
| SELECT "Election" FROM table_72302 WHERE "# of seats won" = '65' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 ( score VARCHAR, date VARCHAR, away_team VARCHAR )
### Question ###
what is the score on 14 december 1974 and the away team is crystal palace?
### Accurate SQL ###
| SELECT score FROM table_name_69 WHERE date = "14 december 1974" AND away_team = "crystal palace" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_17655 ( "Series #" real, "Season #" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Total viewers (in millions)" text )
### Question ###
What is the total number of titles written by Casey Johnson?
### Accurate SQL ###
| SELECT COUNT("Title") FROM table_17655 WHERE "Written by" = 'Casey Johnson' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
provide the number of patients whose insurance is medicare and year of birth is less than 2182?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Medicare" AND demographic.dob_year < "2182" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_14 ( second_member VARCHAR, first_member VARCHAR )
### Question ###
Who is the second member when RT Hon. Edward Stanley is the first member?
### Accurate SQL ###
| SELECT second_member FROM table_name_14 WHERE first_member = "rt hon. edward stanley" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE area ( course_id int, area varchar )
TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int )
TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int )
TABLE: CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar )
TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar )
TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar )
TABLE: CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar )
TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int )
TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar )
TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar )
TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int )
TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int )
TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int )
TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar )
TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college 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 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 )
### Question ###
For the Winter or Fall 2011 term what computational science courses are offered ?
### Accurate SQL ###
| SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE area.area LIKE '%computational science%' AND semester.semester IN ('WN', 'FA') AND semester.year = 2011 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
count the number of patients whose lab test name is rbc, pleural?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "RBC, Pleural" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_train_130 ( "id" int, "gender" string, "systolic_blood_pressure_sbp" int, "right_bundle_branch_block" bool, "space_occupying_cerebral_lesion" bool, "huntington_disease" bool, "psychiatric_disease" bool, "mental_illness" bool, "treatment_regimen" bool, "psychotic_disorder" bool, "diastolic_blood_pressure_dbp" int, "bipolar_disorder" bool, "serum_creatinine" float, "seizure_disorder" bool, "vascular_dementia" bool, "parkinson_disease" bool, "normal_pressure_hydrocephalus" bool, "significant_neurological_disease" bool, "ad" bool, "ninds_airen_criteria" bool, "hypertension" bool, "bilirubin" float, "major_depression" bool, "NOUSE" float )
### Question ###
major mental illness including psychotic disorders, bipolar disorder, or major depressive episode that is not in remission for less than 12 months
### Accurate SQL ###
| SELECT * FROM table_train_130 WHERE mental_illness = 1 OR psychotic_disorder = 1 OR bipolar_disorder = 1 OR major_depression = 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_12962773_10 ( position VARCHAR, current_club VARCHAR )
### Question ###
How many players currently play for Barons Riga?
### Accurate SQL ###
| SELECT COUNT(position) FROM table_12962773_10 WHERE current_club = "Barons Riga" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_76 (attendance VARCHAR, result VARCHAR)
### Question ###
How many were in attendance with a Result of l 17–10?
### Accurate SQL ###
| SELECT attendance FROM table_name_76 WHERE result = "l 17–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_51690 ( "Player" text, "No.(s)" text, "Height in Ft." text, "Position" text, "Years for Rockets" text, "School/Club Team/Country" text )
### Question ###
Which years did the Rockets number 6 play?
### Accurate SQL ###
| SELECT "Years for Rockets" FROM table_51690 WHERE "No.(s)" = '6' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_7 (entrant VARCHAR, chassis VARCHAR, year VARCHAR)
### Question ###
Can you tell me the Entrant that has the Chassis of march 742, and the Year larger than 1974?
### Accurate SQL ###
| SELECT entrant FROM table_name_7 WHERE chassis = "march 742" AND year > 1974 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (away_team VARCHAR, home_team VARCHAR)
### Question ###
Who was the opponent when Footscray played as the home team?
### Accurate SQL ###
| SELECT away_team AS score FROM table_name_62 WHERE home_team = "footscray" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_613 ( id number, "title" text, "year" number, "peak chart positions\nus" number, "peak chart positions\nus\nr&b" number, "peak chart positions\nus\nrap" number, "album" text )
### Question ###
tell me the only song to get on the us rap chart .
### Accurate SQL ###
| SELECT "title" FROM table_204_613 WHERE NOT "peak chart positions\nus\nrap" IS NULL |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_10975034_4 (player VARCHAR, pick__number VARCHAR)
### Question ###
Which players have a pick number of 27?
### Accurate SQL ###
| SELECT player FROM table_10975034_4 WHERE pick__number = 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 Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean )
TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description 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 FlagTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostTags ( PostId number, TagId number )
TABLE: CREATE TABLE VoteTypes ( Id number, Name text )
TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text )
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 TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time )
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 ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text )
TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text )
TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text )
TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number )
TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number )
TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number )
TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
TABLE: CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text )
TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time )
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 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 ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number )
TABLE: CREATE TABLE ReviewTaskStates ( 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 PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number )
TABLE: CREATE TABLE PostTypes ( Id number, Name text )
TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number )
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 )
### Question ###
Votes in a tag per day. Show a daily breakdown of the number of upvotes (+) and downvotes (-) on questions (Q) and answers (+) in a given tag. The data is based on the question tags at the time the query is run, not on the tags at the time of the vote. The total column includes all types of votes (not just up/down but also favorite, close/reopen, etc.).
### Accurate SQL ###
| SELECT v.CreationDate AS "date", COUNT(CASE WHEN v.VoteTypeId = 2 AND p.PostTypeId = 1 THEN 1 ELSE NULL END) AS "q+", COUNT(CASE WHEN v.VoteTypeId = 3 AND p.PostTypeId = 1 THEN 1 ELSE NULL END) AS "q-", COUNT(CASE WHEN v.VoteTypeId = 2 AND p.PostTypeId = 2 THEN 1 ELSE NULL END) AS "a+", COUNT(CASE WHEN v.VoteTypeId = 3 AND p.PostTypeId = 2 THEN 1 ELSE NULL END) AS "a-", COUNT(*) AS "total" FROM Votes AS v INNER JOIN Posts AS p ON p.Id = v.PostId INNER JOIN Posts AS q ON q.Id = p.Id OR q.Id = p.ParentId WHERE q.PostTypeId = 1 AND (q.Tags LIKE '%<##Tag##>%' OR q.Tags LIKE '% ##Tag## %') GROUP BY v.CreationDate ORDER BY Date |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE 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 ###
Look for the diagnoses short title and long title of icd9 code 42823.
### Accurate SQL ###
| SELECT diagnoses.short_title, diagnoses.long_title FROM diagnoses WHERE diagnoses.icd9_code = "42823" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_86 ( score VARCHAR, player VARCHAR )
### Question ###
Name The Score of Player of seve ballesteros?
### Accurate SQL ###
| SELECT score FROM table_name_86 WHERE player = "seve ballesteros" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_27539272_7 ( january INTEGER, record VARCHAR )
### Question ###
On what day of January was the record 10-29-2?
### Accurate SQL ###
| SELECT MAX(january) FROM table_27539272_7 WHERE record = "10-29-2" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_15700367_6 (er VARCHAR, runs_conceded VARCHAR)
### Question ###
What was the ER average for the player that conceded 368 runs?
### Accurate SQL ###
| SELECT er FROM table_15700367_6 WHERE runs_conceded = 368 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text )
TABLE: CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text )
TABLE: CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int )
TABLE: CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int )
### Question ###
Give me the comparison about ID over the meter_300 .
### Accurate SQL ###
| SELECT meter_300, ID FROM swimmer |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_39325 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text )
### Question ###
What is the Outcome of the Doubles played on Carpet?
### Accurate SQL ###
| SELECT "Outcome" FROM table_39325 WHERE "Surface" = 'carpet' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_9 (player VARCHAR, country VARCHAR)
### Question ###
Who is the player from Japan?
### Accurate SQL ###
| SELECT player FROM table_name_9 WHERE country = "japan" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_99 ( name VARCHAR, proposed VARCHAR )
### Question ###
What is the name of the superfund that was proposed on 06/24/1988?
### Accurate SQL ###
| SELECT name FROM table_name_99 WHERE proposed = "06/24/1988" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.