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_name_70 ( games INTEGER, team VARCHAR, points VARCHAR )
### Question ###
What is the lowest game number with Aris Thessaloniki with points smaller than 120?
### Accurate SQL ###
| SELECT MIN(games) FROM table_name_70 WHERE team = "aris thessaloniki" AND points < 120 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_76544 ( "Year" real, "Date" text, "Race name" text, "Winner" text, "Engine" text )
### Question ###
What date did Ted Horn win Lakewood Race 2?
### Accurate SQL ###
| SELECT "Date" FROM table_76544 WHERE "Winner" = 'ted horn' AND "Race name" = 'lakewood race 2' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_8 (traffic_direction VARCHAR, street VARCHAR, west VARCHAR, _number_of_lanes VARCHAR)
### Question ###
What is the traffic direction of 64th street with 2nd avenue to the west and 1 lane?
### Accurate SQL ###
| SELECT traffic_direction FROM table_name_8 WHERE west = "2nd avenue" AND _number_of_lanes = "1" AND street = "64th street" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
### Question ###
which patients have prescription for maalox/diphenhydramine/lidocaine?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Maalox/Diphenhydramine/Lidocaine" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_27708484_3 ( matches_played VARCHAR, average_goals_scored_per_match VARCHAR )
### Question ###
how many matches were played that average goals scored 1.25?
### Accurate SQL ###
| SELECT COUNT(matches_played) FROM table_27708484_3 WHERE average_goals_scored_per_match = "1.25" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int )
TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int )
TABLE: CREATE TABLE airline ( airline_code varchar, airline_name text, note 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 city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar )
TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int )
TABLE: CREATE TABLE days ( days_code varchar, day_name varchar )
TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_time int )
TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text )
TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar )
TABLE: CREATE TABLE 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 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_fare ( flight_id int, fare_id int )
TABLE: CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar )
TABLE: CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar )
TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int )
TABLE: CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar )
TABLE: CREATE TABLE code_description ( code varchar, description 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 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 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 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 )
### Question ###
can you give me information on transportation from the airport in PHILADELPHIA to downtown PHILADELPHIA
### Accurate SQL ###
| SELECT DISTINCT ground_service.transport_type FROM airport, airport_service, city, ground_service WHERE airport.airport_code = airport_service.airport_code AND city.city_code = airport_service.city_code AND city.city_name = 'PHILADELPHIA' AND ground_service.airport_code = airport.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_74634 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text )
### Question ###
What is the competition that occured on 27 July 2004?
### Accurate SQL ###
| SELECT "Competition" FROM table_74634 WHERE "Date" = '27 july 2004' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_72 (fumb_td INTEGER, int_td VARCHAR, fumb_f VARCHAR)
### Question ###
Which Fumb TD has an Int TD of 1, and a Fumb F. smaller than 1?
### Accurate SQL ###
| SELECT MIN(fumb_td) FROM table_name_72 WHERE int_td = 1 AND fumb_f < 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 ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number )
TABLE: CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text )
TABLE: CREATE TABLE 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 PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text )
TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean )
TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostTags ( PostId number, TagId number )
TABLE: CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number )
TABLE: CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number )
TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text )
TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time )
TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostTypes ( Id number, Name text )
TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number )
TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount 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 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 Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number )
TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text )
TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number )
TABLE: CREATE TABLE VoteTypes ( Id number, Name text )
TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time )
TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number )
TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number )
TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text )
### Question ###
Top 100 users with most gold badges for a Country.
### Accurate SQL ###
| SELECT u.Location, u.Id, u.DisplayName, bd.NumTagBadges FROM (SELECT UserId, COUNT(*) AS NumTagBadges FROM Badges WHERE Name IN (SELECT TagName FROM Tags WHERE COALESCE(TagName, '') != '') GROUP BY UserId LIMIT 100) AS bd JOIN Users AS u ON u.Id = bd.UserId WHERE u.Location LIKE ('%##CountryName##%') |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 ###
find the female patients who have procedure icd9 code 3727.
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.gender = "F" AND procedures.icd9_code = "3727" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
provide the number of patients whose diagnoses icd9 code is 4659 and drug type is additive?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "4659" AND prescriptions.drug_type = "ADDITIVE" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_48 (country VARCHAR, city VARCHAR)
### Question ###
Which country is Wellington located in?
### Accurate SQL ###
| SELECT country FROM table_name_48 WHERE city = "wellington" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_56 (city VARCHAR, prize VARCHAR)
### Question ###
The prize of £1,000,000 was given by an event in what city?
### Accurate SQL ###
| SELECT city FROM table_name_56 WHERE prize = "£1,000,000" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_40833 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner(s)-up" text )
### Question ###
What tournament was played on Feb 3, 1991?
### Accurate SQL ###
| SELECT "Tournament" FROM table_40833 WHERE "Date" = 'feb 3, 1991' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_22570439_1 (written_by VARCHAR, directed_by VARCHAR)
### Question ###
How many written by have wendey stanzler as the director?
### Accurate SQL ###
| SELECT COUNT(written_by) FROM table_22570439_1 WHERE directed_by = "Wendey Stanzler" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 ( total INTEGER, nation VARCHAR, e_score VARCHAR )
### Question ###
What is the average total score of Belarus, which had an E score less than 8.2?
### Accurate SQL ###
| SELECT AVG(total) FROM table_name_71 WHERE nation = "belarus" AND e_score < 8.2 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_52829 ( "Name" text, "Species" text, "Overview" text, "Introduced" text, "Feral" text, "Threat level" text )
### Question ###
Which Species has a medium Threat Level?
### Accurate SQL ###
| SELECT "Species" FROM table_52829 WHERE "Threat level" = 'medium' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_48 ( race VARCHAR, course VARCHAR, jockey VARCHAR, margin VARCHAR )
### Question ###
what is the race when the jockey is frankie dettori, the margin is more than 3 and the course is yarmouth?
### Accurate SQL ###
| SELECT race FROM table_name_48 WHERE jockey = "frankie dettori" AND margin > 3 AND course = "yarmouth" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE Appointment ( AppointmentID INTEGER, Patient INTEGER, PrepNurse INTEGER, Physician INTEGER, Start DATETIME, End DATETIME, ExaminationRoom TEXT )
TABLE: CREATE TABLE Affiliated_With ( Physician INTEGER, Department INTEGER, PrimaryAffiliation BOOLEAN )
TABLE: CREATE TABLE Physician ( EmployeeID INTEGER, Name VARCHAR(30), Position VARCHAR(30), SSN INTEGER )
TABLE: CREATE TABLE Undergoes ( Patient INTEGER, Procedures INTEGER, Stay INTEGER, DateUndergoes DATETIME, Physician INTEGER, AssistingNurse INTEGER )
TABLE: CREATE TABLE Prescribes ( Physician INTEGER, Patient INTEGER, Medication INTEGER, Date DATETIME, Appointment INTEGER, Dose VARCHAR(30) )
TABLE: CREATE TABLE Stay ( StayID INTEGER, Patient INTEGER, Room INTEGER, StayStart DATETIME, StayEnd DATETIME )
TABLE: CREATE TABLE Nurse ( EmployeeID INTEGER, Name VARCHAR(30), Position VARCHAR(30), Registered BOOLEAN, SSN INTEGER )
TABLE: CREATE TABLE On_Call ( Nurse INTEGER, BlockFloor INTEGER, BlockCode INTEGER, OnCallStart DATETIME, OnCallEnd DATETIME )
TABLE: CREATE TABLE Room ( RoomNumber INTEGER, RoomType VARCHAR(30), BlockFloor INTEGER, BlockCode INTEGER, Unavailable BOOLEAN )
TABLE: CREATE TABLE Block ( BlockFloor INTEGER, BlockCode INTEGER )
TABLE: CREATE TABLE Procedures ( Code INTEGER, Name VARCHAR(30), Cost REAL )
TABLE: CREATE TABLE Patient ( SSN INTEGER, Name VARCHAR(30), Address VARCHAR(30), Phone VARCHAR(30), InsuranceID INTEGER, PCP INTEGER )
TABLE: CREATE TABLE Trained_In ( Physician INTEGER, Treatment INTEGER, CertificationDate DATETIME, CertificationExpires DATETIME )
TABLE: CREATE TABLE Department ( DepartmentID INTEGER, Name VARCHAR(30), Head INTEGER )
TABLE: CREATE TABLE Medication ( Code INTEGER, Name VARCHAR(30), Brand VARCHAR(30), Description VARCHAR(30) )
### Question ###
How many patients do each physician take care of? List their names and number of patients they take care of. Show bar chart.
### Accurate SQL ###
| SELECT T1.Name, COUNT(*) FROM Physician AS T1 JOIN Patient AS T2 ON T1.EmployeeID = T2.PCP GROUP BY T1.EmployeeID |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_16726 ( "Rnd" real, "Race" text, "Date" text, "Location" text, "Pole Position" text, "Fastest Lap" text, "Race Winner" text, "Constructor" text, "Report" text )
### Question ###
What is the constructor for 9 May?
### Accurate SQL ###
| SELECT "Constructor" FROM table_16726 WHERE "Date" = '9 May' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_21699 ( "Winner" text, "Country" text, "Winter Olympics" text, "FIS Nordic World Ski Championships" text, "Holmenkollen" text )
### Question ###
What year is Winter Olympics when Holmenkollen is 1957, 1960?
### Accurate SQL ###
| SELECT "Winter Olympics" FROM table_21699 WHERE "Holmenkollen" = '1957, 1960' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_12547903_2 ( station_type VARCHAR, location__transmitter_site_ VARCHAR )
### Question ###
What is the station type of calbayog
### Accurate SQL ###
| SELECT station_type FROM table_12547903_2 WHERE location__transmitter_site_ = "Calbayog" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 ( opponent VARCHAR, attendance VARCHAR )
### Question ###
Tell me the opponent for attendance of 68,264
### Accurate SQL ###
| SELECT opponent FROM table_name_74 WHERE attendance = "68,264" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (total INTEGER, tournament VARCHAR)
### Question ###
What is the total on average for teams with 3 tournaments?
### Accurate SQL ###
| SELECT AVG(total) FROM table_name_8 WHERE tournament = 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_60554 ( "Election" text, "1st Member" text, "1st Party" text, "2nd Member" text, "2nd Party" text )
### Question ###
What 2nd Member has a 2nd Party of conservative, and an Election of 1853 by-election?
### Accurate SQL ###
| SELECT "2nd Member" FROM table_60554 WHERE "2nd Party" = 'conservative' AND "Election" = '1853 by-election' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_263 ( id number, "pick" number, "player" text, "country of origin" text, "pba team" text, "college" text )
### Question ###
where there more or less than 5 players picked from the united states ?
### Accurate SQL ###
| SELECT (SELECT COUNT("player") FROM table_204_263 WHERE "country of origin" = 'united states') > 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_56142 ( "Episode" text, "1st edition" text, "2nd edition" text, "3rd edition" text, "4th edition" text )
### Question ###
What is the 1st Edition for Episode 11?
### Accurate SQL ###
| SELECT "1st edition" FROM table_56142 WHERE "Episode" = '11' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_23249053_11 (team VARCHAR, high_points VARCHAR)
### Question ###
When rashard lewis (24) has the highest amount of points who is the team?
### Accurate SQL ###
| SELECT team FROM table_23249053_11 WHERE high_points = "Rashard Lewis (24)" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_43701 ( "Poll Source" text, "Dates administered" text, "Democrat: Mark Begich" text, "Republican: Ted Stevens" text, "Lead Maragin" real )
### Question ###
What was the poll source for october 6, 2008?
### Accurate SQL ###
| SELECT "Poll Source" FROM table_43701 WHERE "Dates administered" = 'october 6, 2008' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE Products ( Product_ID VARCHAR(100), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Product_Description VARCHAR(255), Other_Product_Service_Details VARCHAR(255) )
TABLE: CREATE TABLE Drama_Workshop_Groups ( Workshop_Group_ID INTEGER, Address_ID INTEGER, Currency_Code CHAR(15), Marketing_Region_Code CHAR(15), Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Invoice_Items ( Invoice_Item_ID INTEGER, Invoice_ID INTEGER, Order_ID INTEGER, Order_Item_ID INTEGER, Product_ID INTEGER, Order_Quantity INTEGER, Other_Item_Details VARCHAR(255) )
TABLE: CREATE TABLE Services ( Service_ID INTEGER, Service_Type_Code CHAR(15), Workshop_Group_ID INTEGER, Product_Description VARCHAR(255), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Other_Product_Service_Details VARCHAR(255) )
TABLE: CREATE TABLE Clients ( Client_ID INTEGER, Address_ID INTEGER, Customer_Email_Address VARCHAR(255), Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Customer_Orders ( Order_ID INTEGER, Customer_ID INTEGER, Store_ID INTEGER, Order_Date DATETIME, Planned_Delivery_Date DATETIME, Actual_Delivery_Date DATETIME, Other_Order_Details VARCHAR(255) )
TABLE: CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10), payment_method_description VARCHAR(80) )
TABLE: CREATE TABLE Invoices ( Invoice_ID INTEGER, Order_ID INTEGER, payment_method_code CHAR(15), Product_ID INTEGER, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), Order_Item_ID INTEGER )
TABLE: CREATE TABLE Order_Items ( Order_Item_ID INTEGER, Order_ID INTEGER, Product_ID INTEGER, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255) )
TABLE: CREATE TABLE Customers ( Customer_ID VARCHAR(100), Address_ID INTEGER, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Performers_in_Bookings ( Order_ID INTEGER, Performer_ID INTEGER )
TABLE: CREATE TABLE Ref_Service_Types ( Service_Type_Code CHAR(15), Parent_Service_Type_Code CHAR(15), Service_Type_Description VARCHAR(255) )
TABLE: CREATE TABLE Bookings_Services ( Order_ID INTEGER, Product_ID INTEGER )
TABLE: CREATE TABLE Bookings ( Booking_ID INTEGER, Customer_ID INTEGER, Workshop_Group_ID VARCHAR(100), Status_Code CHAR(15), Store_ID INTEGER, Order_Date DATETIME, Planned_Delivery_Date DATETIME, Actual_Delivery_Date DATETIME, Other_Order_Details VARCHAR(255) )
TABLE: CREATE TABLE Addresses ( Address_ID VARCHAR(100), Line_1 VARCHAR(255), Line_2 VARCHAR(255), City_Town VARCHAR(255), State_County VARCHAR(255), Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Marketing_Regions ( Marketing_Region_Code CHAR(15), Marketing_Region_Name VARCHAR(255), Marketing_Region_Descriptrion VARCHAR(255), Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Performers ( Performer_ID INTEGER, Address_ID INTEGER, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Stores ( Store_ID VARCHAR(100), Address_ID INTEGER, Marketing_Region_Code CHAR(15), Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255) )
### Question ###
Visualize the general trend of the number of planned delivery date over the planned delivery date, and rank by the X-axis in descending.
### Accurate SQL ###
| SELECT Planned_Delivery_Date, COUNT(Planned_Delivery_Date) FROM Bookings ORDER BY Planned_Delivery_Date 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_75 (goals_for INTEGER, games_played INTEGER)
### Question ###
What is the average number of goals for games played that total more than 8?
### Accurate SQL ###
| SELECT AVG(goals_for) FROM table_name_75 WHERE games_played > 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_53 ( team VARCHAR, first_round VARCHAR )
### Question ###
What Team had the first round of 1:00?
### Accurate SQL ###
| SELECT team FROM table_name_53 WHERE first_round = "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 course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar )
TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int )
TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar )
TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar )
TABLE: CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments int, respected int, participation int, heavy_reading int, tough_grader int, hilarious int, would_take_again int, good_lecture int, no_skip int )
TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar )
TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar )
TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int )
TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar )
TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int )
TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int )
TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int )
TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar )
TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar )
TABLE: CREATE TABLE 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 semester ( semester_id int, semester varchar, year int )
TABLE: CREATE TABLE area ( course_id int, area varchar )
TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar )
### Question ###
Of all the courses , which are worth 14 credits ?
### Accurate SQL ###
| SELECT DISTINCT name, number FROM course WHERE credits = 14 AND department = 'EECS' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_2679061_9 ( position VARCHAR, nhl_team VARCHAR )
### Question ###
What was the position of the player who played for New York Islanders NHL Team?
### Accurate SQL ###
| SELECT position FROM table_2679061_9 WHERE nhl_team = "New York Islanders" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 ( tournament VARCHAR )
### Question ###
For the Australian Open, in 2007 the result was A, but what was the result in 2012?
### Accurate SQL ###
| SELECT 2012 FROM table_name_4 WHERE 2007 = "a" AND tournament = "australian open" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_37 (home_team VARCHAR, away_team VARCHAR)
### Question ###
When richmond was the Away team what was the score of the home team?
### Accurate SQL ###
| SELECT home_team AS score FROM table_name_37 WHERE away_team = "richmond" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_53617 ( "Subframe #" real, "Page #" text, "Name" text, "Word #" real, "Bits" text, "Scale" text, "Signed" text )
### Question ###
What is the scale of sv_health with a word number smaller than 4?
### Accurate SQL ###
| SELECT "Scale" FROM table_53617 WHERE "Word #" < '4' AND "Name" = 'sv_health' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text )
TABLE: CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text )
TABLE: CREATE TABLE code_description ( code varchar, description text )
TABLE: CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar )
TABLE: CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar )
TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id 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_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 month ( month_number int, month_name text )
TABLE: CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar )
TABLE: CREATE TABLE airline ( airline_code varchar, airline_name text, note text )
TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_time int )
TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int )
TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name 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 airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int )
TABLE: CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar )
TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int )
TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text )
TABLE: CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar )
TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar )
TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int )
TABLE: CREATE TABLE days ( days_code varchar, day_name varchar )
TABLE: CREATE TABLE state ( state_code text, state_name text, country_name text )
TABLE: CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar )
### Question ###
cheapest flight from MEMPHIS to MIAMI
### Accurate SQL ###
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'MEMPHIS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MIAMI' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND fare.one_direction_cost = (SELECT MIN(FAREalias1.one_direction_cost) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, fare AS FAREalias1, flight AS FLIGHTalias1, flight_fare AS FLIGHT_FAREalias1 WHERE CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'MEMPHIS' AND CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'MIAMI' AND FLIGHT_FAREalias1.fare_id = FAREalias1.fare_id AND FLIGHTalias1.flight_id = FLIGHT_FAREalias1.flight_id AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code) AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_36592 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text, "Attendance" real )
### Question ###
On October 31 what team played at home?
### Accurate SQL ###
| SELECT "Home" FROM table_36592 WHERE "Date" = 'october 31' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_90 ( us_modern_rock VARCHAR, code VARCHAR )
### Question ###
What is the US modern rock rank of code bad 0003?
### Accurate SQL ###
| SELECT us_modern_rock FROM table_name_90 WHERE code = "bad 0003" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
### Question ###
how many patients whose gender is m and diagnoses short title is malig neo tongue nec?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.short_title = "Malig neo tongue NEC" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (opponents VARCHAR, partner VARCHAR)
### Question ###
Who were the Opponents in the Match with Partner Rushmi Chakravarthi?
### Accurate SQL ###
| SELECT opponents FROM table_name_80 WHERE partner = "rushmi chakravarthi" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text )
TABLE: CREATE TABLE 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 )
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 city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar )
TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int )
TABLE: CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int )
TABLE: CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar )
TABLE: CREATE TABLE days ( days_code varchar, day_name varchar )
TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int )
TABLE: CREATE TABLE 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 time_interval ( period text, begin_time int, end_time int )
TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar )
TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int )
TABLE: CREATE TABLE month ( month_number int, month_name text )
TABLE: CREATE TABLE state ( state_code text, state_name text, country_name text )
TABLE: CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar )
TABLE: CREATE TABLE 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 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 class_of_service ( booking_class varchar, rank int, class_description text )
TABLE: CREATE TABLE code_description ( code varchar, description text )
TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar )
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 restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text )
### Question ###
what airlines fly into DENVER
### Accurate SQL ###
| SELECT DISTINCT airline_code FROM airline WHERE airline_code IN (SELECT FLIGHTalias0.airline_code FROM flight AS FLIGHTalias0 WHERE FLIGHTalias0.to_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 = 'DENVER'))) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) )
TABLE: CREATE TABLE 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 regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) )
TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) )
TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) )
TABLE: CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(4,0) )
TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) )
### Question ###
For those employees who was hired before 2002-06-21, find hire_date and the sum of manager_id bin hire_date by time, and visualize them by a bar chart, and I want to show by the total number of manager id from high to low.
### Accurate SQL ###
| SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY SUM(MANAGER_ID) 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 patients ( row_id number, subject_id number, gender text, dob time, dod 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 outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number )
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 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 d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text )
TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time )
TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE 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 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 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 chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text )
### Question ###
did patient 17237 have any microbiological test result in 05/last year?
### Accurate SQL ###
| SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 17237) AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', microbiologyevents.charttime) = '05' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1353096_1 (channel_tv___dt__ VARCHAR, city_of_license__market VARCHAR)
### Question ###
How many channel tv (dt)s are in austin, texas?
### Accurate SQL ###
| SELECT COUNT(channel_tv___dt__) FROM table_1353096_1 WHERE city_of_license__market = "Austin, Texas" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_5513 ( "RBIs" real, "Player" text, "Team" text, "Date" text, "Opponent" text )
### Question ###
When the team is the Boston Red Sox and the is date July 27, 1946, what are the average RBIs?
### Accurate SQL ###
| SELECT AVG("RBIs") FROM table_5513 WHERE "Team" = 'boston red sox' AND "Date" = 'july 27, 1946' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_22457674_1 (master_recording VARCHAR, artist VARCHAR)
### Question ###
Name the master recording for europe
### Accurate SQL ###
| SELECT master_recording FROM table_22457674_1 WHERE artist = "Europe" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_60687 ( "Golden Rivers" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real )
### Question ###
What is the highest number of wins for Quambatook when Against is less than 1129?
### Accurate SQL ###
| SELECT MAX("Wins") FROM table_60687 WHERE "Golden Rivers" = 'quambatook' AND "Against" < '1129' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_85 ( time VARCHAR, country VARCHAR )
### Question ###
What time does Belgium have?
### Accurate SQL ###
| SELECT time FROM table_name_85 WHERE country = "belgium" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_56948 ( "Street" text, "West" text, "East" text, "# of lanes" text, "Traffic direction" text )
### Question ###
What is the # of lanes on 20th street?
### Accurate SQL ###
| SELECT "# of lanes" FROM table_56948 WHERE "Street" = '20th street' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number )
TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number )
TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number )
TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostTypes ( Id number, Name text )
TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time )
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 SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number )
TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text )
TABLE: CREATE TABLE VoteTypes ( Id number, Name text )
TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text )
TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount 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 Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text )
TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number )
TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean )
TABLE: CREATE TABLE PostTags ( PostId number, TagId 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 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 PostHistoryTypes ( Id number, Name 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 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 PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number )
TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number )
TABLE: CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number )
### Question ###
Zero Score Questions Vs Non-Zero Score questions.
### Accurate SQL ###
| SELECT (SELECT COUNT(*) FROM Posts WHERE Score = 0 AND PostTypeId = 1) AS Zero_Votes, (SELECT COUNT(*) FROM Posts WHERE Score != 0 AND PostTypeId = 1) AS NonZero_Votes |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
### Question ###
provide the number of patients whose admission location is clinic referral/premature and item id is 50976?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND lab.itemid = "50976" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 ( team__number1 VARCHAR, round VARCHAR )
### Question ###
What is team 1 in group h?
### Accurate SQL ###
| SELECT team__number1 FROM table_name_45 WHERE round = "group h" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_48 ( set_1 VARCHAR, set_2 VARCHAR )
### Question ###
What is Set 1, when Set 2 is '21:18'?
### Accurate SQL ###
| SELECT set_1 FROM table_name_48 WHERE set_2 = "21:18" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_26000 ( "Province" text, "Mahmoud Ahmadinejad" real, "Mehdi Karroubi" real, "Mir-Hossein Mousavi" real, "Mohsen Rezaee" real, "Spoiled ballots" real, "Total votes" real )
### Question ###
What was the highest score of candidate mir-hossein mousavi in the location known as azarbaijan, west?
### Accurate SQL ###
| SELECT MAX("Mir-Hossein Mousavi") FROM table_26000 WHERE "Province" = 'Azarbaijan, West' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_57 (name VARCHAR, goals VARCHAR, nationality VARCHAR)
### Question ###
Who was from Morocco and scored 6 goals?
### Accurate SQL ###
| SELECT name FROM table_name_57 WHERE goals = 6 AND nationality = "morocco" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_17670 ( "Season" text, "Winner" text, "Score" text, "Runner-up" text, "lost to eventual winner" text, "lost to eventual runner-up" text )
### Question ###
In which season was Jeanne d'Arc (Bamako) the runner-up?
### Accurate SQL ###
| SELECT "Season" FROM table_17670 WHERE "Runner-up" = 'Jeanne d''Arc (Bamako)' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_76494 ( "Game" real, "Date" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" text )
### Question ###
What is the lowest game number on 20 July 2008?
### Accurate SQL ###
| SELECT MIN("Game") FROM table_76494 WHERE "Date" = '20 july 2008' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_27615520_1 ( form_factor VARCHAR, bandwidth__gb_s_ VARCHAR )
### Question ###
What is the shape distortion for the range frequency of 10?
### Accurate SQL ###
| SELECT form_factor FROM table_27615520_1 WHERE bandwidth__gb_s_ = "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 STUDENT ( Age INTEGER )
### Question ###
Find the maximum age of all the students.
### Accurate SQL ###
| SELECT MAX(Age) FROM STUDENT |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text )
TABLE: CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text )
### Question ###
Visualize a bar chart about the distribution of All_Games and ACC_Percent , could you order bar from high to low order?
### Accurate SQL ###
| SELECT All_Games, ACC_Percent FROM basketball_match ORDER BY All_Games 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_70 ( byes VARCHAR, against VARCHAR, draws VARCHAR )
### Question ###
What is the total number of byes for teams with against of 2139 and more than 0 draws?
### Accurate SQL ###
| SELECT COUNT(byes) FROM table_name_70 WHERE against = 2139 AND draws > 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 Rooms ( RoomId TEXT, roomName TEXT, beds INTEGER, bedType TEXT, maxOccupancy INTEGER, basePrice INTEGER, decor TEXT )
TABLE: CREATE TABLE Reservations ( Code INTEGER, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate REAL, LastName TEXT, FirstName TEXT, Adults INTEGER, Kids INTEGER )
### Question ###
Find the number of rooms with king bed for each decor type. Plot them as pie chart.
### Accurate SQL ###
| SELECT decor, COUNT(*) FROM Rooms WHERE bedType = "King" GROUP BY decor |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_76 ( initial_syllable_open_semi_open_unstressed_vowels VARCHAR )
### Question ###
What is 17th c., when Initial-Syllable Open/Semi-Open Unstressed Vowels is 'o / /'?
### Accurate SQL ###
| SELECT 17 AS th_c FROM table_name_76 WHERE initial_syllable_open_semi_open_unstressed_vowels = "o /ɵ/" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_49921 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
### Question ###
What is Tie No., when Away Team is 'Manchester United'?
### Accurate SQL ###
| SELECT "Tie no" FROM table_49921 WHERE "Away team" = 'manchester united' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_591 ( id number, "high school" text, "join\nyear" text, "from" text, "left" text, "league left to" text )
### Question ###
which school left before bendle ?
### Accurate SQL ###
| SELECT "high school" FROM table_203_591 WHERE id = (SELECT id FROM table_203_591 WHERE "high school" = 'bendle') - 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 patients ( row_id number, subject_id number, gender text, dob time, dod time )
TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE 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 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_items ( row_id number, itemid number, label text, linksto text )
TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title 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 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 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 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 admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number )
TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
### Question ###
when last patient 96404 was discharged from the hospital?
### Accurate SQL ###
| SELECT admissions.dischtime FROM admissions WHERE admissions.subject_id = 96404 ORDER BY admissions.dischtime 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 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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
### Question ###
how many patients of black/african american ethnicity are admitted before the year 2178?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND demographic.admityear < "2178" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
count the number of patients whose procedure short title is 1 int mam-cor art bypass?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.short_title = "1 int mam-cor art bypass" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_24446718_3 ( awardee_s_ VARCHAR, name_of_award VARCHAR )
### Question ###
Name the awardees for best special effects
### Accurate SQL ###
| SELECT awardee_s_ FROM table_24446718_3 WHERE name_of_award = "Best Special Effects" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_19744915_3 ( order VARCHAR, public_vote VARCHAR )
### Question ###
what is the order when public vote was 18.155%
### Accurate SQL ###
| SELECT order FROM table_19744915_3 WHERE public_vote = "18.155%" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT )
TABLE: CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT )
TABLE: CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_dew_point_f INTEGER, max_humidity INTEGER, mean_humidity INTEGER, min_humidity INTEGER, max_sea_level_pressure_inches NUMERIC, mean_sea_level_pressure_inches NUMERIC, min_sea_level_pressure_inches NUMERIC, max_visibility_miles INTEGER, mean_visibility_miles INTEGER, min_visibility_miles INTEGER, max_wind_Speed_mph INTEGER, mean_wind_speed_mph INTEGER, max_gust_speed_mph INTEGER, precipitation_inches INTEGER, cloud_cover INTEGER, events TEXT, wind_dir_degrees INTEGER, zip_code INTEGER )
TABLE: CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER )
### Question ###
What are the number of the dates with a maximum temperature higher than 85?, and sort by the the number of date in desc.
### Accurate SQL ###
| SELECT date, COUNT(date) FROM weather WHERE max_temperature_f > 85 ORDER BY COUNT(date) 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_57 (result VARCHAR, nominee_s_ VARCHAR)
### Question ###
What is the result when the nominee(s) of janine sherman?
### Accurate SQL ###
| SELECT result FROM table_name_57 WHERE nominee_s_ = "janine sherman" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_75636 ( "Year" text, "Name" text, "Political affiliation" text, "Deputy" text, "Deputy's affiliation" text )
### Question ###
What is the Deputy's affiliation in 1992 93?
### Accurate SQL ###
| SELECT "Deputy's affiliation" FROM table_75636 WHERE "Year" = '1992–93' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (home_team VARCHAR, away_team VARCHAR)
### Question ###
What home team has an Away team of richmond?
### Accurate SQL ###
| SELECT home_team FROM table_name_28 WHERE away_team = "richmond" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_14 ( video VARCHAR, aspect VARCHAR )
### Question ###
Which Video has an Aspect of 16:9?
### Accurate SQL ###
| SELECT video FROM table_name_14 WHERE aspect = "16:9" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1676073_12 (club VARCHAR, points_for VARCHAR)
### Question ###
What clubs recorded 748 points to the good?
### Accurate SQL ###
| SELECT club FROM table_1676073_12 WHERE points_for = "748" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int )
TABLE: CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments int, respected int, participation int, heavy_reading int, tough_grader int, hilarious int, would_take_again int, good_lecture int, no_skip int )
TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar )
TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar )
TABLE: CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar )
TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar )
TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int )
TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int )
TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int )
TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar )
TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar )
TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int )
TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar )
TABLE: CREATE TABLE area ( course_id int, area varchar )
TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar )
TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int )
TABLE: CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar )
TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar )
### Question ###
GTBOOKS 191 is taught by how many professors in Winter 2003 ?
### Accurate SQL ###
| SELECT COUNT(DISTINCT instructor.instructor_id) FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'GTBOOKS' AND course.number = 191 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id AND semester.semester = 'Winter' AND semester.semester_id = course_offering.semester AND semester.year = 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_name_92 ( score VARCHAR, home VARCHAR )
### Question ###
What was the score when the team played at the bobcats?
### Accurate SQL ###
| SELECT score FROM table_name_92 WHERE home = "bobcats" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_203_189 ( id number, "year" number, "competition" text, "venue" text, "position" text, "notes" text )
### Question ###
which position did habte jifar achieve in the all africa games in 1999 : 4th or 3rd ?
### Accurate SQL ###
| SELECT "position" FROM table_203_189 WHERE "competition" = 'all-africa games' AND "year" = 1999 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text )
TABLE: CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text )
### Question ###
Return a bar chart about the distribution of ACC_Road and the sum of Team_ID , and group by attribute ACC_Road, and display by the total number in asc.
### Accurate SQL ###
| SELECT ACC_Road, SUM(Team_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY SUM(Team_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_31178 ( "Athlete" text, "Event" text, "Elimination Poule" text, "Round of 16" text, "Quarterfinals" text, "Semifinals" text, "Final" text )
### Question ###
How many athletes were named federico muller?
### Accurate SQL ###
| SELECT COUNT("Quarterfinals") FROM table_31178 WHERE "Athlete" = 'Federico Muller' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_13 (label VARCHAR, catalog VARCHAR)
### Question ###
What Label has a Catalog of 486 136-2?
### Accurate SQL ###
| SELECT label FROM table_name_13 WHERE catalog = "486 136-2" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_28508 ( "Institution" text, "Nickname" text, "Location" text, "Founded" real, "Type" text, "Enrollment" text, "Current Conference" text )
### Question ###
Name the total number of founded for public and 780 enrollment
### Accurate SQL ###
| SELECT COUNT("Founded") FROM table_28508 WHERE "Type" = 'Public' AND "Enrollment" = '780' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_87 (opponent VARCHAR, date VARCHAR)
### Question ###
What team was the opponent for the game played on December 19, 1999?
### Accurate SQL ###
| SELECT opponent FROM table_name_87 WHERE date = "december 19, 1999" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_29692554_2 (eliminated VARCHAR, time VARCHAR)
### Question ###
What number was the person eliminated at 22:50?
### Accurate SQL ###
| SELECT eliminated FROM table_29692554_2 WHERE time = "22:50" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_13 ( Id VARCHAR )
### Question ###
What is the 1998 value if the 2007 value is 8?
### Accurate SQL ###
| SELECT 1998 FROM table_name_13 WHERE 2007 = "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_2 (label VARCHAR, region VARCHAR, date VARCHAR)
### Question ###
What is the Label of the release on April 24, 2009 in Germany?
### Accurate SQL ###
| SELECT label FROM table_name_2 WHERE region = "germany" AND date = "april 24, 2009" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_597 ( id number, "main author" text, "no. of patients" number, "duration of follow-up years" number, "linearized rate of infection" text, "actuarial freedom from infective endocarditis" text )
### Question ###
how many looked at more than 500 patients ?
### Accurate SQL ###
| SELECT COUNT(*) FROM table_204_597 WHERE "no. of patients" > 500 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_62050 ( "Date" text, "Opponent" text, "Venue" text, "Result" text, "Competition" text )
### Question ###
Which opponent has a result of 2-0 l?
### Accurate SQL ###
| SELECT "Opponent" FROM table_62050 WHERE "Result" = '2-0 l' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_26 (tie_no VARCHAR, home_team VARCHAR)
### Question ###
What is the tie no for the home team swansea city?
### Accurate SQL ###
| SELECT tie_no FROM table_name_26 WHERE home_team = "swansea city" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE 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 medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE 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 cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
### Question ###
how many patients have undergone vasodilator for pulmonary hypertension - treprostinil two or more times until 2104?
### Accurate SQL ###
| SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, COUNT(*) AS c1 FROM patient WHERE patient.patientunitstayid = (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'vasodilator for pulmonary hypertension - treprostinil' AND STRFTIME('%y', treatment.treatmenttime) <= '2104') GROUP BY patient.uniquepid) AS t1 WHERE t1.c1 >= 2 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_79 (name VARCHAR, built_by_hm_dockyard VARCHAR, laid_down VARCHAR)
### Question ###
What name has pembroke as the built by hm dockyard, and may 1825 as the laid down?
### Accurate SQL ###
| SELECT name FROM table_name_79 WHERE built_by_hm_dockyard = "pembroke" AND laid_down = "may 1825" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_28132970_5 ( length VARCHAR, propulsion VARCHAR )
### Question ###
What is the length when the propulsion is controllable pitch propeller?
### Accurate SQL ###
| SELECT length FROM table_28132970_5 WHERE propulsion = "Controllable pitch propeller" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE 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 lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
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 allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
### Question ###
when they visited the hospital last time, has patient 033-250 received any medication?
### Accurate SQL ###
| SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '033-250' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1)) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_70021 ( "Season" real, "Host" text, "Winners" text, "Score" text, "Runners-up" text, "Third place" text )
### Question ###
What is the season where Vasco da gama is the score?
### Accurate SQL ###
| SELECT "Season" FROM table_70021 WHERE "Score" = 'vasco da gama' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
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 class_of_service ( booking_class varchar, rank int, class_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 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 flight_fare ( flight_id int, fare_id int )
TABLE: CREATE TABLE month ( month_number int, month_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 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 equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar )
TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int )
TABLE: CREATE TABLE days ( days_code varchar, day_name varchar )
TABLE: CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text )
TABLE: CREATE TABLE 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 time_interval ( period text, begin_time int, end_time int )
TABLE: CREATE TABLE state ( state_code text, state_name text, country_name text )
TABLE: CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar )
TABLE: CREATE TABLE code_description ( code varchar, description text )
TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int )
TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type 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 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 date_day ( month_number int, day_number int, year int, day_name varchar )
### Question ###
is there a DL flight from BOSTON to SAN FRANCISCO that stops in DENVER
### Accurate SQL ###
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'DENVER' AND flight_stop.stop_airport = AIRPORT_SERVICE_2.airport_code AND flight.flight_id = flight_stop.flight_id AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.airline_code = 'DL' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
provide the number of patients whose age is less than 89?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "89" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_14 ( record VARCHAR, opponent VARCHAR )
### Question ###
Which record has john flemming as the opponent?
### Accurate SQL ###
| SELECT record FROM table_name_14 WHERE opponent = "john flemming" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.