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_43547 ( "Game" real, "December" real, "Opponent" text, "Score" text, "Decision" text, "Record" text )
### Question ###
What game has valiquette as the decision, with @ los angeles kings as the opponent?
### Accurate SQL ###
| SELECT "Game" FROM table_43547 WHERE "Decision" = 'valiquette' AND "Opponent" = '@ los angeles kings' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
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 )
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 )
### Question ###
Find meter_200 and the average of meter_100 , and group by attribute meter_200, and visualize them by a bar chart, I want to list mean meter 100 from low to high order.
### Accurate SQL ###
| SELECT meter_200, AVG(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY AVG(meter_100) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 ( sample_size VARCHAR, republican VARCHAR )
### Question ###
What was the sample size for the poll featuring Republican Ron Paul?
### Accurate SQL ###
| SELECT sample_size FROM table_name_80 WHERE republican = "ron paul" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_78 (weight INTEGER, height VARCHAR, spike VARCHAR, block VARCHAR)
### Question ###
What is the smallest Weight, when Spike is less than 330, when Block is 315, and when Height is greater than 187?
### Accurate SQL ###
| SELECT MIN(weight) FROM table_name_78 WHERE spike < 330 AND block = 315 AND height > 187 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_66483 ( "Rank" real, "Athlete" text, "Country" text, "Time" text, "Notes" text )
### Question ###
What time was the race for the country of france?
### Accurate SQL ###
| SELECT "Time" FROM table_66483 WHERE "Country" = 'france' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 ( loss VARCHAR, opponent VARCHAR, save VARCHAR )
### Question ###
What is the loss for the game against @ expos, with a save of parrett (2)?
### Accurate SQL ###
| SELECT loss FROM table_name_28 WHERE opponent = "@ expos" AND save = "parrett (2)" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
give the number of patients diagnosed with streptococcal septicemia and had lab test for blood gas .
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Streptococcal septicemia" AND lab."CATEGORY" = "Blood Gas" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_22921 ( "Self-identification" text, "Moldovan census" real, "% Core Moldova" text, "Transnistrian census" real, "% Transnistria + Bender" text, "Total" real, "%" text )
### Question ###
Name the % for total being 57613
### Accurate SQL ###
| SELECT "%" FROM table_22921 WHERE "Total" = '57613' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_28031 ( "Player" text, "Position" text, "Starter" text, "Touchdowns" real, "Extra points" real, "Field goals" real, "Points" real )
### Question ###
How many maximum points did Curtis scored?
### Accurate SQL ###
| SELECT MAX("Points") FROM table_28031 WHERE "Player" = 'Curtis' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_40 ( time VARCHAR, laps VARCHAR, rider VARCHAR )
### Question ###
Which Time has Laps smaller than 28, and a Rider of nicky hayden?
### Accurate SQL ###
| SELECT time FROM table_name_40 WHERE laps < 28 AND rider = "nicky hayden" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_12 (date VARCHAR, score VARCHAR, tie_no VARCHAR)
### Question ###
When has a Score of 0–1, and a Tie no of 3?
### Accurate SQL ###
| SELECT date FROM table_name_12 WHERE score = "0–1" AND tie_no = "3" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar )
TABLE: CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text )
TABLE: CREATE TABLE month ( month_number int, month_name text )
TABLE: CREATE TABLE days ( days_code varchar, day_name varchar )
TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar )
TABLE: CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar )
TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int )
TABLE: CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar )
TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_time 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 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 airline ( airline_code varchar, airline_name text, note text )
TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text )
TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id int )
TABLE: CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code 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 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 flight_leg ( flight_id int, leg_number int, leg_flight int )
TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int )
TABLE: CREATE TABLE state ( state_code text, state_name text, country_name 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 code_description ( code varchar, description 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 ground_service ( city_code text, airport_code text, transport_type text, ground_fare int )
### Question ###
DALLAS ground transportation
### Accurate SQL ###
| SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'DALLAS' AND ground_service.city_code = city.city_code |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE Parts ( part_id INTEGER, part_name VARCHAR(255), chargeable_yn VARCHAR(1), chargeable_amount VARCHAR(20), other_part_details VARCHAR(255) )
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 Third_Party_Companies ( company_id INTEGER, company_type VARCHAR(5), company_name VARCHAR(255), company_address VARCHAR(255), other_company_details VARCHAR(255) )
TABLE: CREATE TABLE Staff ( staff_id INTEGER, staff_name VARCHAR(255), gender VARCHAR(1), other_staff_details VARCHAR(255) )
TABLE: CREATE TABLE Skills ( skill_id INTEGER, skill_code VARCHAR(20), skill_description VARCHAR(255) )
TABLE: CREATE TABLE Skills_Required_To_Fix ( part_fault_id INTEGER, skill_id INTEGER )
TABLE: CREATE TABLE Engineer_Skills ( engineer_id INTEGER, skill_id INTEGER )
TABLE: CREATE TABLE Asset_Parts ( asset_id INTEGER, part_id INTEGER )
TABLE: CREATE TABLE Fault_Log_Parts ( fault_log_entry_id INTEGER, part_fault_id INTEGER, fault_status VARCHAR(10) )
TABLE: CREATE TABLE 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 Maintenance_Engineers ( engineer_id INTEGER, company_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), other_details VARCHAR(255) )
TABLE: CREATE TABLE Part_Faults ( part_fault_id INTEGER, part_id INTEGER, fault_short_name VARCHAR(20), fault_description VARCHAR(255), other_fault_details VARCHAR(255) )
TABLE: CREATE TABLE Maintenance_Contracts ( maintenance_contract_id INTEGER, maintenance_contract_company_id INTEGER, contract_start_date DATETIME, contract_end_date DATETIME, other_contract_details VARCHAR(255) )
TABLE: CREATE TABLE 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) )
### Question ###
Draw a bar chart of asset make versus the number of asset make, and rank by the how many asset make from high to low.
### Accurate SQL ###
| SELECT asset_make, COUNT(asset_make) FROM Assets GROUP BY asset_make ORDER BY COUNT(asset_make) DESC |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_40 (rounds VARCHAR, driver VARCHAR)
### Question ###
Which rounds was Hap Sharp a driver in?
### Accurate SQL ###
| SELECT rounds FROM table_name_40 WHERE driver = "hap sharp" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_55983 ( "Name" text, "Current version" text, "System" text, "Platform" text, "License" text )
### Question ###
What is the License when the Platform is windows and the Name is Altirra?
### Accurate SQL ###
| SELECT "License" FROM table_55983 WHERE "Platform" = 'windows' AND "Name" = 'altirra' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_25572068_1 (location VARCHAR, winning_driver VARCHAR)
### Question ###
What was the location when the winning driver was Nathanaël Berthon?
### Accurate SQL ###
| SELECT location FROM table_25572068_1 WHERE winning_driver = "Nathanaël Berthon" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE 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 intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
### Question ###
during the current hospital visit how many times did patient 016-9636 get a ptt test?
### Accurate SQL ###
| SELECT COUNT(*) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-9636' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'ptt' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (ofsted INTEGER, school VARCHAR, capacity VARCHAR)
### Question ###
Which Ofsted has a School of marple hall school, and a Capacity larger than 1711?
### Accurate SQL ###
| SELECT MIN(ofsted) FROM table_name_63 WHERE school = "marple hall school" AND capacity > 1711 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE 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 ###
get the number of patients who were hospitalized for more than 27 days and had aortic valve insufficiency/aortic valve replacement/sda primary disease.
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" AND demographic.days_stay > "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_61802 ( "Province, Community" text, "Contestant" text, "Height" text, "Hometown" text, "Geographical Regions" text )
### Question ###
Which province has the contestant elixandra tobias carasco?
### Accurate SQL ###
| SELECT "Province, Community" FROM table_61802 WHERE "Contestant" = 'elixandra tobias carasco' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_166 ( "id" int, "hemoglobin_a1c_hba1c" float, "diabetic" string, "body_mass_index_bmi" float, "NOUSE" float )
### Question ###
hemoglobin a1c values < 6.5 % or > 10.5 %
### Accurate SQL ###
| SELECT * FROM table_train_166 WHERE hemoglobin_a1c_hba1c < 6.5 OR hemoglobin_a1c_hba1c > 10.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_83 (time VARCHAR, event VARCHAR)
### Question ###
What was the time of the NJKF Titans Neo X event?
### Accurate SQL ###
| SELECT time FROM table_name_83 WHERE event = "njkf titans neo x" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_65243 ( "Year" real, "Game" text, "Genre" text, "Platform(s)" text, "Developer(s)" text )
### Question ###
What is total number of years that has genre of first-person shooter?
### Accurate SQL ###
| SELECT SUM("Year") FROM table_65243 WHERE "Genre" = 'first-person shooter' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_98 ( _number_of_bids VARCHAR, conference VARCHAR )
### Question ###
How many bids does Atlantic 10 have?
### Accurate SQL ###
| SELECT _number_of_bids FROM table_name_98 WHERE conference = "atlantic 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_28253870_1 ( affiliation VARCHAR, enrollment VARCHAR )
### Question ###
Name the affiliation for 27209 enrollment
### Accurate SQL ###
| SELECT affiliation FROM table_28253870_1 WHERE enrollment = 27209 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId 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 Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId 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 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 Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean )
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 FlagTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text )
TABLE: CREATE TABLE PostTypes ( Id number, Name text )
TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number )
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 Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number )
TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time )
TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text )
TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text )
TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number )
TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text )
TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number )
TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number )
TABLE: CREATE TABLE VoteTypes ( Id number, Name text )
TABLE: CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number )
TABLE: CREATE TABLE 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 PostTags ( PostId number, TagId number )
TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
### Question ###
Posts migrated here from site and with tag.
### Accurate SQL ###
| SELECT Comment, TagName FROM PostHistory, Tags WHERE PostHistoryTypeId = 36 AND Comment LIKE 'from http://' + '##site##' + '%' AND TagName LIKE '##tag##' GROUP BY Comment, TagName ORDER BY 2 DESC |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_5392 ( "Frequency" real, "Callsign" text, "Brand" text, "Format" text, "City of License" text, "Website" text, "Webcast" text )
### Question ###
Which webcast was in Spanish contemporary on xhnoe.com?
### Accurate SQL ###
| SELECT "Webcast" FROM table_5392 WHERE "Format" = 'spanish contemporary' AND "Website" = 'xhnoe.com' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_8 (attendance VARCHAR, result VARCHAR)
### Question ###
What was the attendance of the game that had a score of l 35–14?
### Accurate SQL ###
| SELECT attendance FROM table_name_8 WHERE result = "l 35–14" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_12912 ( "Elector" text, "Nationality" text, "Order" text, "Title" text, "Elevated" text, "Elevator" text )
### Question ###
Which Order has a Nationality of ese milan?
### Accurate SQL ###
| SELECT "Order" FROM table_12912 WHERE "Nationality" = 'ese milan' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_419 ( id number, "year" text, "tournament" text, "venue" text, "played" number, "won" number, "lost" number, "tied" number, "n/r" number, "result" text )
### Question ###
how many times has australia been runner up ?
### Accurate SQL ###
| SELECT COUNT(*) FROM table_204_419 WHERE "venue" = 'australia' AND "result" = 'runner-up' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_58 (etymology VARCHAR, rank VARCHAR)
### Question ###
What Etymology ranked 12?
### Accurate SQL ###
| SELECT etymology FROM table_name_58 WHERE rank = 12 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE 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 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 treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
### Question ###
what is the top three most frequent diagnoses among the patients in the 20s since 2102?
### 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 20 AND 29) AND STRFTIME('%y', diagnosis.diagnosistime) >= '2102' GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 3 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
### Question ###
what is the number of patients whose age is less than 77 and diagnoses icd9 code is 5570?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "77" AND diagnoses.icd9_code = "5570" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_14747043_1 ( class_aA VARCHAR, school_year VARCHAR )
### Question ###
How many class AA in the year 2002-03
### Accurate SQL ###
| SELECT COUNT(class_aA) FROM table_14747043_1 WHERE school_year = "2002-03" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number )
TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text )
TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number )
TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time )
TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title 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 microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text )
TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time )
TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text )
TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number )
TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number )
### Question ###
what was the last thing patient 20603 received for intake since 987 days ago?
### Accurate SQL ###
| SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT inputevents_cv.itemid FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20603)) AND DATETIME(inputevents_cv.charttime) >= DATETIME(CURRENT_TIME(), '-987 day') ORDER BY inputevents_cv.charttime DESC LIMIT 1) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_71 ( record VARCHAR, date VARCHAR )
### Question ###
Which Record has a Date of 3 march 2013?
### Accurate SQL ###
| SELECT record FROM table_name_71 WHERE date = "3 march 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_83 (decision VARCHAR, date VARCHAR)
### Question ###
Which team won the game on January 12?
### Accurate SQL ###
| SELECT decision FROM table_name_83 WHERE date = "january 12" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_12641 ( "South West DFL" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real )
### Question ###
What is the sum of Against, when Wins is greater than 8, and when Losses is greater than 6?
### Accurate SQL ###
| SELECT SUM("Against") FROM table_12641 WHERE "Wins" > '8' AND "Losses" > '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 state ( state_code text, state_name text, country_name text )
TABLE: CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar )
TABLE: CREATE TABLE flight ( 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 month ( month_number int, month_name text )
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 date_day ( month_number int, day_number int, year int, day_name varchar )
TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text )
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 days ( days_code varchar, day_name varchar )
TABLE: CREATE TABLE code_description ( code varchar, description text )
TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int )
TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int )
TABLE: CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar )
TABLE: CREATE TABLE 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 food_service ( meal_code text, meal_number int, compartment text, meal_description varchar )
TABLE: CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int )
TABLE: CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar )
TABLE: CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar )
TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_time int )
TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id int )
TABLE: CREATE TABLE airline ( airline_code varchar, airline_name text, note text )
TABLE: CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text )
TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int )
TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int )
TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar )
### Question ###
what are the flights from PITTSBURGH to DENVER and back
### 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 = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) OR (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' 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_29395291_2 ( subscribers__2006___thousands_ VARCHAR, provider VARCHAR )
### Question ###
How many 2006 subscribers are named Vodafone?
### Accurate SQL ###
| SELECT COUNT(subscribers__2006___thousands_) FROM table_29395291_2 WHERE provider = "Vodafone" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE settlements (settlement_amount INTEGER)
### Question ###
Find the total and average amount of settlements.
### Accurate SQL ###
| SELECT SUM(settlement_amount), AVG(settlement_amount) FROM settlements |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_13382 ( "Draw" real, "Language" text, "Artist" text, "Song" text, "English translation" text, "Place" real, "Points" real )
### Question ###
What is the draw for the artist Ketil Stokkan which has less than 44 points?
### Accurate SQL ###
| SELECT MIN("Draw") FROM table_13382 WHERE "Artist" = 'ketil stokkan' AND "Points" < '44' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_66806 ( "Year" real, "Tournament" text, "Venue" text, "Result" text, "Extra" text )
### Question ###
What is the lowest year that has athens, greece as the venue?
### Accurate SQL ###
| SELECT MIN("Year") FROM table_66806 WHERE "Venue" = 'athens, greece' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1473672_3 (position VARCHAR, nhl_team VARCHAR)
### Question ###
Which position did the player hold that played for the Philadelphia Flyers in NHL?
### Accurate SQL ###
| SELECT position FROM table_1473672_3 WHERE nhl_team = "Philadelphia Flyers" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_2187178_1 (crew_chief VARCHAR, driver_s_ VARCHAR)
### Question ###
Name the crew chief for ricky craven
### Accurate SQL ###
| SELECT crew_chief FROM table_2187178_1 WHERE driver_s_ = "Ricky Craven" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_74 ( natural_change VARCHAR, crude_death_rate__per_1000_ VARCHAR, live_births VARCHAR )
### Question ###
What is natural change with a crude death rate of 8.7 and less than 472 live births?
### Accurate SQL ###
| SELECT natural_change FROM table_name_74 WHERE crude_death_rate__per_1000_ = 8.7 AND live_births < 472 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_14429 ( "Estimate" text, "Name" text, "Nat." text, "Ship Type" text, "Principal victims" text, "Where sunk" text, "Date" text )
### Question ###
Who were the victims of the US ship that sank in the Mississippi River near Memphis?
### Accurate SQL ###
| SELECT "Principal victims" FROM table_14429 WHERE "Nat." = 'us' AND "Where sunk" = 'mississippi river near memphis' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
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 )
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 diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
### Question ###
what are the four most commonly prescribed medications during this year for patients who were previously diagnosed with respiratory arrest in the same month?
### Accurate SQL ###
| SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'respiratory arrest' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.drugstarttime AND DATETIME(t1.diagnosistime, 'start of month') = DATETIME(t2.drugstarttime, 'start of month') GROUP BY t2.drugname) AS t3 WHERE t3.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_37 ( population INTEGER, density__inhabitants_km_2__ VARCHAR, altitude__mslm_ VARCHAR, city VARCHAR )
### Question ###
What is the lowest population of alessandria where the altitude is less than 197 and density is less than 461.8?
### Accurate SQL ###
| SELECT MIN(population) FROM table_name_37 WHERE altitude__mslm_ < 197 AND city = "alessandria" AND density__inhabitants_km_2__ < 461.8 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_32 (catalog VARCHAR, label VARCHAR, date VARCHAR, format VARCHAR, region VARCHAR)
### Question ###
What is Catalog, when Format is CD, when Region is US, when Date is before 2004, and when Label is Taang! Records?
### Accurate SQL ###
| SELECT catalog FROM table_name_32 WHERE format = "cd" AND region = "us" AND date < 2004 AND label = "taang! records" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_31462 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
### Question ###
How many games are shown when the is location attendance is phog allen fieldhouse , lawrence, ks (16,300)?
### Accurate SQL ###
| SELECT COUNT("Game") FROM table_31462 WHERE "Location Attendance" = 'Phog Allen Fieldhouse , Lawrence, KS (16,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 table_name_34 (date VARCHAR, team VARCHAR, venue VARCHAR)
### Question ###
What day did Glentoran play at Windsor Park, Belfast?
### Accurate SQL ###
| SELECT date FROM table_name_34 WHERE team = "glentoran" AND venue = "windsor park, belfast" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_course_attendance ( student_id number, course_id number, date_of_attendance time )
TABLE: CREATE TABLE people ( person_id number, first_name text, middle_name text, last_name text, cell_mobile_number text, email_address text, login_name text, password text )
TABLE: CREATE TABLE candidate_assessments ( candidate_id number, qualification text, assessment_date time, asessment_outcome_code text )
TABLE: CREATE TABLE addresses ( address_id number, line_1 text, line_2 text, city text, zip_postcode text, state_province_county text, country text )
TABLE: CREATE TABLE students ( student_id number, student_details text )
TABLE: CREATE TABLE courses ( course_id text, course_name text, course_description text, other_details text )
TABLE: CREATE TABLE people_addresses ( person_address_id number, person_id number, address_id number, date_from time, date_to time )
TABLE: CREATE TABLE candidates ( candidate_id number, candidate_details text )
TABLE: CREATE TABLE student_course_registrations ( student_id number, course_id number, registration_date time )
### Question ###
What is the id of the candidate whose email is [email protected]?
### Accurate SQL ###
| SELECT T2.candidate_id FROM people AS T1 JOIN candidates AS T2 ON T1.person_id = T2.candidate_id WHERE T1.email_address = "[email protected]" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_65216 ( "Nat." text, "Name" text, "Type" text, "Transfer window" text, "Transfer fee" text )
### Question ###
What player had a transfer window of winter, and free as the transfer fee?
### Accurate SQL ###
| SELECT "Name" FROM table_65216 WHERE "Transfer window" = 'winter' AND "Transfer fee" = 'free' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_45 (death VARCHAR, birth VARCHAR)
### Question ###
when was the death when the birth was 8 december 1542?
### Accurate SQL ###
| SELECT death FROM table_name_45 WHERE birth = "8 december 1542" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_6905 ( "Year" text, "Playoff round" text, "Venue" text, "Winner" text, "Result" text, "Loser" text )
### Question ###
What is the Result when the memphis grizzlies ( 2) were the loser?
### Accurate SQL ###
| SELECT "Result" FROM table_6905 WHERE "Loser" = 'memphis grizzlies ( 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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
### Question ###
what is age and diagnoses icd9 code of subject id 42067?
### Accurate SQL ###
| SELECT demographic.age, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "42067" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE technician ( technician_id real, Name text, Team text, Starting_Year real, Age int )
TABLE: CREATE TABLE repair ( repair_ID int, name text, Launch_Date text, Notes text )
TABLE: CREATE TABLE repair_assignment ( technician_id int, repair_ID int, Machine_ID int )
TABLE: CREATE TABLE machine ( Machine_ID int, Making_Year int, Class text, Team text, Machine_series text, value_points real, quality_rank int )
### Question ###
Show names of technicians who are assigned to repair machines with value point more than 70, and count them by a pie chart
### Accurate SQL ###
| SELECT Name, COUNT(Name) FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.Machine_ID = T2.Machine_ID JOIN technician AS T3 ON T1.technician_id = T3.technician_id WHERE T2.value_points > 70 GROUP 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_1949994_8 (no INTEGER, local_title VARCHAR)
### Question ###
What series number had the local title of Fort Boyard?
### Accurate SQL ###
| SELECT MAX(no) FROM table_1949994_8 WHERE local_title = "Fort Boyard" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_23812628_1 ( team__number1 VARCHAR )
### Question ###
Name the 2nd leg for boca juniors
### Accurate SQL ###
| SELECT 2 AS nd_leg FROM table_23812628_1 WHERE team__number1 = "Boca Juniors" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_84 (points INTEGER, team VARCHAR, played VARCHAR)
### Question ###
What's the lowest Points for the Team of San Martín De Tucumán, and a Played that's smaller than 38?
### Accurate SQL ###
| SELECT MIN(points) FROM table_name_84 WHERE team = "san martín de tucumán" AND played < 38 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_2273 ( "-Butadiene" text, "10 4 k /min \u22121 (30 \u00b0C) (\u00b1 1-2%) absolute" text, "10 4 k /min \u22121 (30 \u00b0C) (\u00b1 1-2%) relative" text, "\u0394H \u2021 /kcal mol \u22121" text, "\u0394S \u2021 /cal mol \u22121 K \u22121" text )
### Question ###
Name the 10 4 k /min 1 (30 c) ( 1-2%) absolute for 1.00
### Accurate SQL ###
| SELECT "10 4 k /min \u22121 (30 \u00b0C) (\u00b1 1-2%) absolute" FROM table_2273 WHERE "10 4 k /min \u22121 (30 \u00b0C) (\u00b1 1-2%) relative" = '1.00' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) )
TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) )
TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) )
TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) )
TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) )
TABLE: CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) )
TABLE: CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(4,0) )
### Question ###
For all employees who have the letters D or S in their first name, give me the comparison about the amount of job_id over the job_id , and group by attribute job_id, and sort in asc by the the number of job id please.
### Accurate SQL ###
| SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY COUNT(JOB_ID) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_18759 ( "Frequency" text, "Call sign" text, "Name" text, "Format" text, "Owner" text, "Target city/ market" text, "City of license" text )
### Question ###
What is the target market of the station with call sign KFXS?
### Accurate SQL ###
| SELECT "Target city/ market" FROM table_18759 WHERE "Call sign" = 'KFXS' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1342292_42 (party VARCHAR, first_elected VARCHAR)
### Question ###
What was the party that was frist elected in 1919?
### Accurate SQL ###
| SELECT party FROM table_1342292_42 WHERE first_elected = 1919 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE People ( Name VARCHAR, Weight VARCHAR )
### Question ###
What are the names of people in ascending order of weight?
### Accurate SQL ###
| SELECT Name FROM People ORDER BY Weight |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar )
TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar )
TABLE: CREATE TABLE area ( course_id int, area varchar )
TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar )
TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar )
TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar )
TABLE: CREATE TABLE course_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 gsi ( course_offering_id int, student_id int )
TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int )
TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_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 ( program_id int, name varchar, college varchar, introduction 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 semester ( semester_id int, semester varchar, year int )
TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int )
TABLE: CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar )
TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar )
### Question ###
Who is this semester 's Evolution (UMBS) teacher ?
### Accurate SQL ###
| SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN course_offering ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN course ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.name LIKE '%Evolution (UMBS)%' AND semester.semester = 'WN' AND semester.year = 2016 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_46 (partner VARCHAR, opponents_in_the_final VARCHAR)
### Question ###
Name the partner for opponents of františek čermák michal mertiňák
### Accurate SQL ###
| SELECT partner FROM table_name_46 WHERE opponents_in_the_final = "františek čermák michal mertiňák" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE 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 ###
find the number of patients who had closed bronchial biopsy.
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.short_title = "Closed bronchial biopsy" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time )
TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number )
TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text )
TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time )
TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number )
TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text )
TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text )
TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number )
TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text )
TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number )
TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time )
### Question ###
what is patient 13536's last urine out foley output time on 05/03/this year?
### Accurate SQL ###
| SELECT outputevents.charttime FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13536)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urine out foley' AND d_items.linksto = 'outputevents') AND DATETIME(outputevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m-%d', outputevents.charttime) = '05-03' ORDER BY outputevents.charttime DESC LIMIT 1 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_45 ( nation VARCHAR, bronze VARCHAR, silver VARCHAR )
### Question ###
What nation has more than 1 bronze and less than 3 silver?
### Accurate SQL ###
| SELECT nation FROM table_name_45 WHERE bronze > 1 AND silver < 3 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE 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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
what is the number of patients whose gender is f and discharge location is long term care hospital?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.discharge_location = "LONG TERM CARE HOSPITAL" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_261 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
### Question ###
which nation has the most bronze medals ?
### Accurate SQL ###
| SELECT "nation" FROM table_204_261 ORDER BY "bronze" 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_40 (artist VARCHAR, year INTEGER)
### Question ###
Which artist created coins before 2010?
### Accurate SQL ###
| SELECT artist FROM table_name_40 WHERE year < 2010 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_46682 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text )
### Question ###
What is Partner, when Outcome is Winner, and when Date is 12 October 2003?
### Accurate SQL ###
| SELECT "Partner" FROM table_46682 WHERE "Outcome" = 'winner' AND "Date" = '12 october 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 table_5280 ( "Rider" text, "Bike" text, "Laps" real, "Time" text, "Grid" real )
### Question ###
Which suzuki gsx-r1000 k7 has the highest time of retirement?
### Accurate SQL ###
| SELECT MAX("Grid") FROM table_5280 WHERE "Time" = 'retirement' AND "Bike" = 'suzuki gsx-r1000 k7' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_57128 ( "Year" real, "Men's singles" text, "Women's singles" text, "Men's doubles" text, "Women's doubles" text, "Mixed doubles" text )
### Question ###
Which mixed doubles was featured in 2006?
### Accurate SQL ###
| SELECT "Mixed doubles" FROM table_57128 WHERE "Year" = '2006' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_38 ( draws VARCHAR, losses VARCHAR, wins VARCHAR )
### Question ###
How many draws occured with a record of 10 losses, and 6 wins?
### Accurate SQL ###
| SELECT COUNT(draws) FROM table_name_38 WHERE losses = 10 AND wins > 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_18328569_1 (clubs_remaining VARCHAR, winners_from_previous_round VARCHAR)
### Question ###
How many clubs are remaining when the winners from the previous round totals 4?
### Accurate SQL ###
| SELECT clubs_remaining FROM table_18328569_1 WHERE winners_from_previous_round = "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 Projects ( Code Char(4), Name Char(50), Hours int )
TABLE: CREATE TABLE AssignedTo ( Scientist int, Project char(4) )
TABLE: CREATE TABLE Scientists ( SSN int, Name Char(30) )
### Question ###
A pie chart for finding the number of the name of the project for which a scientist whose name contains Smith is assigned to.
### Accurate SQL ###
| SELECT T2.Name, COUNT(T2.Name) FROM AssignedTo AS T1 JOIN Projects AS T2 ON T1.Project = T2.Code JOIN Scientists AS T3 ON T1.Scientist = T3.SSN WHERE T3.Name LIKE '%Smith%' GROUP BY T2.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_76071 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
### Question ###
What is the smallest number of gold where the total is less than 3 and the silver count is 2?
### Accurate SQL ###
| SELECT MIN("Gold") FROM table_76071 WHERE "Silver" = '2' AND "Total" < '3' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
### Question ###
since 2101 what were the top three most common procedures that patients received during the same hospital encounter after getting a antiemetic - anticholinergic?
### Accurate SQL ###
| SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'antiemetic - anticholinergic' AND STRFTIME('%y', treatment.treatmenttime) >= '2101') AS t1 JOIN (SELECT patient.uniquepid, treatment.treatmentname, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE STRFTIME('%y', treatment.treatmenttime) >= '2101') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.treatmenttime < t2.treatmenttime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid GROUP BY t2.treatmentname) AS t3 WHERE t3.c1 <= 3 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE student_tests_taken ( registration_id number, date_test_taken time, test_result text )
TABLE: CREATE TABLE student_course_enrolment ( registration_id number, student_id number, course_id number, date_of_enrolment time, date_of_completion time )
TABLE: CREATE TABLE students ( student_id number, date_of_registration time, date_of_latest_logon time, login_name text, password text, personal_name text, middle_name text, family_name text )
TABLE: CREATE TABLE courses ( course_id number, author_id number, subject_id number, course_name text, course_description text )
TABLE: CREATE TABLE course_authors_and_tutors ( author_id number, author_tutor_atb text, login_name text, password text, personal_name text, middle_name text, family_name text, gender_mf text, address_line_1 text )
TABLE: CREATE TABLE subjects ( subject_id number, subject_name text )
### Question ###
What are the login names of the students with family name 'Ward'?
### Accurate SQL ###
| SELECT login_name FROM students WHERE family_name = "Ward" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_2147588_3 ( reason_for_change VARCHAR, date_of_successors_formal_installation VARCHAR )
### Question ###
What change caused a change of staff in March 9, 1865?
### Accurate SQL ###
| SELECT reason_for_change FROM table_2147588_3 WHERE date_of_successors_formal_installation = "March 9, 1865" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
### Question ###
what is admission time and diagnoses long title of subject name roxanna weaver?
### Accurate SQL ###
| SELECT demographic.admittime, diagnoses.long_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Roxanna Weaver" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar )
TABLE: CREATE TABLE month ( month_number int, month_name text )
TABLE: CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar )
TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar )
TABLE: CREATE TABLE state ( state_code text, state_name text, country_name text )
TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar )
TABLE: CREATE TABLE 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 airline ( airline_code varchar, airline_name text, note text )
TABLE: CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar )
TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id int )
TABLE: CREATE TABLE code_description ( code varchar, description text )
TABLE: CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int )
TABLE: CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text )
TABLE: CREATE TABLE days ( days_code varchar, day_name varchar )
TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_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 restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text )
TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int )
TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int )
TABLE: CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text )
TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int )
TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int )
TABLE: CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar )
TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_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 )
### Question ###
cheapest one way fare from INDIANAPOLIS to ORLANDO on 12 27
### Accurate SQL ###
| SELECT DISTINCT fare_id FROM fare WHERE ((fare_basis_code IN (SELECT FARE_BASISalias1.fare_basis_code FROM fare_basis AS FARE_BASISalias1 WHERE FARE_BASISalias1.basis_days IN (SELECT DAYSalias2.days_code FROM days AS DAYSalias2 WHERE DAYSalias2.day_name IN (SELECT DATE_DAYalias2.day_name FROM date_day AS DATE_DAYalias2 WHERE DATE_DAYalias2.day_number = 27 AND DATE_DAYalias2.month_number = 12 AND DATE_DAYalias2.year = 1991))) AND fare_id IN (SELECT FLIGHT_FAREalias1.fare_id FROM flight_fare AS FLIGHT_FAREalias1 WHERE FLIGHT_FAREalias1.flight_id IN (SELECT FLIGHTalias1.flight_id FROM flight AS FLIGHTalias1 WHERE ((FLIGHTalias1.flight_days IN (SELECT DAYSalias3.days_code FROM days AS DAYSalias3 WHERE DAYSalias3.day_name IN (SELECT DATE_DAYalias3.day_name FROM date_day AS DATE_DAYalias3 WHERE DATE_DAYalias3.day_number = 27 AND DATE_DAYalias3.month_number = 12 AND DATE_DAYalias3.year = 1991)) AND FLIGHTalias1.to_airport IN (SELECT AIRPORT_SERVICEalias3.airport_code FROM airport_service AS AIRPORT_SERVICEalias3 WHERE AIRPORT_SERVICEalias3.city_code IN (SELECT CITYalias3.city_code FROM city AS CITYalias3 WHERE CITYalias3.city_name = 'ORLANDO'))) AND FLIGHTalias1.from_airport IN (SELECT AIRPORT_SERVICEalias2.airport_code FROM airport_service AS AIRPORT_SERVICEalias2 WHERE AIRPORT_SERVICEalias2.city_code IN (SELECT CITYalias2.city_code FROM city AS CITYalias2 WHERE CITYalias2.city_name = 'INDIANAPOLIS')))))) AND one_direction_cost = (SELECT MIN(FAREalias1.one_direction_cost) FROM fare AS FAREalias1 WHERE (FAREalias1.fare_basis_code IN (SELECT FARE_BASISalias0.fare_basis_code FROM fare_basis AS FARE_BASISalias0 WHERE FARE_BASISalias0.basis_days IN (SELECT DAYSalias0.days_code FROM days AS DAYSalias0 WHERE DAYSalias0.day_name IN (SELECT DATE_DAYalias0.day_name FROM date_day AS DATE_DAYalias0 WHERE DATE_DAYalias0.day_number = 27 AND DATE_DAYalias0.month_number = 12 AND DATE_DAYalias0.year = 1991))) AND FAREalias1.fare_id IN (SELECT FLIGHT_FARE_ID FROM flight_fare AS FLIGHT_FARE WHERE FLIGHT_FLIGHT_ID IN (SELECT FLIGHTalias0.flight_id FROM flight AS FLIGHTalias0 WHERE ((FLIGHTalias0.flight_days IN (SELECT DAYSalias1.days_code FROM days AS DAYSalias1 WHERE DAYSalias1.day_name IN (SELECT DATE_DAYalias1.day_name FROM date_day AS DATE_DAYalias1 WHERE DATE_DAYalias1.day_number = 27 AND DATE_DAYalias1.month_number = 12 AND DATE_DAYalias1.year = 1991)) AND FLIGHTalias0.to_airport IN (SELECT AIRPORT_SERVICEalias1.airport_code FROM airport_service AS AIRPORT_SERVICEalias1 WHERE AIRPORT_SERVICEalias1.city_code IN (SELECT CITYalias1.city_code FROM city AS CITYalias1 WHERE CITYalias1.city_name = 'ORLANDO'))) AND FLIGHTalias0.from_airport IN (SELECT AIRPORT_SERVICEalias0.airport_code FROM airport_service AS AIRPORT_SERVICEalias0 WHERE AIRPORT_SERVICEalias0.city_code IN (SELECT CITYalias0.city_code FROM city AS CITYalias0 WHERE CITYalias0.city_name = 'INDIANAPOLIS')))))) AND FAREalias1.round_trip_required = 'NO') AND round_trip_required = 'NO') |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_24 (original_title VARCHAR, language VARCHAR)
### Question ###
What is the original title for the Korean language film?
### Accurate SQL ###
| SELECT original_title FROM table_name_24 WHERE language = "korean" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_36 ( date VARCHAR, series VARCHAR )
### Question ###
What is Date, when Series is Amscar Round 3?
### Accurate SQL ###
| SELECT date FROM table_name_36 WHERE series = "amscar round 3" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_54315 ( "PRR Class" text, "Builder\u2019s Model" text, "Build date" text, "Total produced" real, "Wheel arrangement" text, "Service" text, "Power output" text )
### Question ###
What is the build date of the model with PRR Class brs24?
### Accurate SQL ###
| SELECT "Build date" FROM table_54315 WHERE "PRR Class" = 'brs24' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_13001 ( "Played" real, "Drawn" real, "Lost" real, "Against" real, "% Won" real )
### Question ###
What Played has a Lost smaller than 3, and a Drawn smaller than 0?
### Accurate SQL ###
| SELECT AVG("Played") FROM table_13001 WHERE "Lost" < '3' AND "Drawn" < '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_203_570 ( id number, "#" number, "title" text, "tpb isbn" text, "tpb release date" text, "tpb page number" number, "collected material" text )
### Question ###
what was the name of the first title released ?
### Accurate SQL ###
| SELECT "title" FROM table_203_570 ORDER BY "tpb release date" 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_58861 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" text )
### Question ###
What is the Money ($) amount of the Player with a To par of e?
### Accurate SQL ###
| SELECT "Money ( $ )" FROM table_58861 WHERE "To par" = 'e' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 ( Party_ID int, Year real, Party text, Governor text, Lieutenant_Governor text, Comptroller text, Attorney_General text, US_Senate text )
TABLE: CREATE TABLE election ( Election_ID int, Counties_Represented text, District int, Delegate text, Party int, First_Elected real, Committee text )
TABLE: CREATE TABLE county ( County_Id int, County_name text, Population real, Zip_code text )
### Question ###
Find the number of the parties associated with the delegates from district 1 or 2 Who served as comptrollers of the parties?, could you order by the y axis from high to low?
### Accurate SQL ###
| SELECT Comptroller, COUNT(Comptroller) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2 GROUP BY Comptroller ORDER BY COUNT(Comptroller) 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 airports ( apid integer, name text, city text, country text, x real, y real, elevation bigint, iata character varchar(3), icao character varchar(4) )
TABLE: CREATE TABLE routes ( rid integer, dst_apid integer, dst_ap varchar(4), src_apid bigint, src_ap varchar(4), alid bigint, airline varchar(4), codeshare text )
TABLE: CREATE TABLE airlines ( alid integer, name text, iata varchar(2), icao varchar(3), callsign text, country text, active varchar(2) )
### Question ###
What is the altitude (or elevation) of the airports in the city of New York? Show me a bar chart.
### Accurate SQL ###
| SELECT name, elevation FROM airports WHERE city = 'New York' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_20 ( points_difference VARCHAR, points_against VARCHAR )
### Question ###
Which Points difference has Points against of 786?
### Accurate SQL ###
| SELECT points_difference FROM table_name_20 WHERE points_against = "786" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_30976 ( "Season no." real, "Series no." real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real, "U.S. viewers (millions)" text )
### Question ###
What are the episode numbers in season that were titled 'The Consoler'?
### Accurate SQL ###
| SELECT "Season no." FROM table_30976 WHERE "Title" = 'The Consoler' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_16120 ( "Year" real, "Division" real, "League" text, "Regular Season" text, "Playoffs" text, "Open Cup" text )
### Question ###
what is the maximum division
### Accurate SQL ###
| SELECT MAX("Division") FROM table_16120 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_8 (school VARCHAR, mascot VARCHAR)
### Question ###
What school has rebels as their mascot?
### Accurate SQL ###
| SELECT school FROM table_name_8 WHERE mascot = "rebels" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 ( date VARCHAR, home_team VARCHAR )
### Question ###
When was the game played where St Kilda was the home team?
### Accurate SQL ###
| SELECT date FROM table_name_4 WHERE home_team = "st kilda" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 ( record VARCHAR, attendance VARCHAR )
### Question ###
What was the Indians record during the game that had 19,823 fans attending?
### Accurate SQL ###
| SELECT record FROM table_name_75 WHERE attendance = "19,823" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.