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_34649 ( "Draw" real, "Singer" text, "Song" text, "Points" real, "Place" real )
### Question ###
What are the Points when the Place is 9?
### Accurate SQL ###
| SELECT "Points" FROM table_34649 WHERE "Place" = '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_48171 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
### Question ###
what is the record when the opponent is jeff williams?
### Accurate SQL ###
| SELECT "Record" FROM table_48171 WHERE "Opponent" = 'jeff williams' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_11964154_9 (record VARCHAR, score VARCHAR)
### Question ###
what's the record where score is w 105–92 (ot)
### Accurate SQL ###
| SELECT record FROM table_11964154_9 WHERE score = "W 105–92 (OT)" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_14726 ( "Date" text, "Home captain" text, "Away captain" text, "Venue" text, "Result" text )
### Question ###
Who was the Away Captain at The Oval?
### Accurate SQL ###
| SELECT "Away captain" FROM table_14726 WHERE "Venue" = 'the oval' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_47723 ( "Dates" text, "Tournament" text, "Prize fund ( \uffe5 )" real, "Winner" text, "OWGR pts" real )
### Question ###
Which OWGR pts has Dates of may 10-13?
### Accurate SQL ###
| SELECT SUM("OWGR pts") FROM table_47723 WHERE "Dates" = 'may 10-13' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_50085 ( "Game" real, "Date" text, "Team" text, "Score" text, "Record" text, "Streak" text )
### Question ###
What was the record following game 67?
### Accurate SQL ###
| SELECT "Record" FROM table_50085 WHERE "Game" = '67' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_62 ( venue VARCHAR, score VARCHAR )
### Question ###
Where was the match with a score of 18.6 (114) - 21.14 (140)?
### Accurate SQL ###
| SELECT venue FROM table_name_62 WHERE score = "18.6 (114) - 21.14 (140)" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_22673872_1 ( rnd INTEGER, winning_driver VARCHAR, track VARCHAR )
### Question ###
In what round did Al Unser win at Wisconsin State Fair Park Speedway?
### Accurate SQL ###
| SELECT MIN(rnd) FROM table_22673872_1 WHERE winning_driver = "Al Unser" AND track = "Wisconsin State Fair Park Speedway" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_49 (lost VARCHAR, drawn VARCHAR, tries_against VARCHAR)
### Question ###
What is the number of losses for the team with 1 draw and 34 tries against?
### Accurate SQL ###
| SELECT lost FROM table_name_49 WHERE drawn = "1" AND tries_against = "34" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_47641 ( "Lane" real, "Name" text, "Country" text, "Mark" text, "React" real )
### Question ###
Can you tell me the lowest React that has the Lane of 5?
### Accurate SQL ###
| SELECT MIN("React") FROM table_47641 WHERE "Lane" = '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_11214772_2 (semi_finalist__number2 VARCHAR, year VARCHAR)
### Question ###
Which team was the second semi finalist in 2007?
### Accurate SQL ###
| SELECT semi_finalist__number2 FROM table_11214772_2 WHERE year = 2007 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
### Question ###
calculate patient 006-254232's duration of stay of the last stay in the icu.
### Accurate SQL ###
| SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-254232') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime 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_36108 ( "Year" real, "Player" text, "Country" text, "Score" text, "Margin of victory" text, "Winner's share ( $ )" real )
### Question ###
Which Score has a Year larger than 1980, and a Margin of victory of 2 strokes, and a Country of united states, and a Player of jim furyk?
### Accurate SQL ###
| SELECT "Score" FROM table_36108 WHERE "Year" > '1980' AND "Margin of victory" = '2 strokes' AND "Country" = 'united states' AND "Player" = 'jim furyk' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 ( enrollment VARCHAR, _number___county VARCHAR, mascot VARCHAR )
### Question ###
How many are enrolled at 49 Marion with the Warriors as their mascot?
### Accurate SQL ###
| SELECT COUNT(enrollment) FROM table_name_74 WHERE _number___county = "49 marion" AND mascot = "warriors" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_30 ( date VARCHAR, away_team VARCHAR )
### Question ###
What is the date where the away team is Richmond?
### Accurate SQL ###
| SELECT date FROM table_name_30 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_32 (points VARCHAR, goals VARCHAR, games VARCHAR)
### Question ###
How many points were scored by the player with 79 goals and who played 38 games?
### Accurate SQL ###
| SELECT points FROM table_name_32 WHERE goals = "79" AND games = "38" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_5 ( date VARCHAR, decision VARCHAR, home VARCHAR )
### Question ###
Name the date for turco decision and home of st. louis
### Accurate SQL ###
| SELECT date FROM table_name_5 WHERE decision = "turco" AND home = "st. louis" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_57997 ( "Rank" text, "Name" text, "Height ft / m" text, "Floors" real, "Year" real )
### Question ###
What is the height that has a year after 1983 and is named Phoenix Tower?
### Accurate SQL ###
| SELECT "Height ft / m" FROM table_57997 WHERE "Year" > '1983' AND "Name" = 'phoenix tower' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_8681 ( "Position" real, "Club" text, "Played" real, "Points" real, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real )
### Question ###
How many goals against were scored when the position was higher than 1 and the played was higher than 10?
### Accurate SQL ###
| SELECT COUNT("Goals against") FROM table_8681 WHERE "Position" > '1' AND "Played" > '10' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_60 ( score VARCHAR, team_2 VARCHAR )
### Question ###
What is the 2nd round with a score of 3 - 3, and a team 2 fc lorient (d2)?
### Accurate SQL ###
| SELECT 2 AS nd_round FROM table_name_60 WHERE score = "3 - 3" AND team_2 = "fc lorient (d2)" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE photos ( id int, camera_lens_id int, mountain_id int, color text, name text )
TABLE: CREATE TABLE mountain ( id int, name text, Height real, Prominence real, Range text, Country text )
TABLE: CREATE TABLE camera_lens ( id int, brand text, name text, focal_length_mm real, max_aperture real )
### Question ###
Pie. what are the id and name of the mountains that have at least 2 photos?
### Accurate SQL ###
| SELECT T1.name, T1.id FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_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 Transactions ( transaction_id INTEGER, investor_id INTEGER, transaction_type_code VARCHAR(10), date_of_transaction DATETIME, amount_of_transaction DECIMAL(19,4), share_count VARCHAR(40), other_details VARCHAR(255) )
TABLE: CREATE TABLE Investors ( investor_id INTEGER, Investor_details VARCHAR(255) )
TABLE: CREATE TABLE Transactions_Lots ( transaction_id INTEGER, lot_id INTEGER )
TABLE: CREATE TABLE Purchases ( purchase_transaction_id INTEGER, purchase_details VARCHAR(255) )
TABLE: CREATE TABLE Ref_Transaction_Types ( transaction_type_code VARCHAR(10), transaction_type_description VARCHAR(80) )
TABLE: CREATE TABLE Sales ( sales_transaction_id INTEGER, sales_details VARCHAR(255) )
TABLE: CREATE TABLE Lots ( lot_id INTEGER, investor_id INTEGER, lot_details VARCHAR(255) )
### Question ###
A pie chart for what are the number of the purchase details of transactions with amount bigger than 10000?
### Accurate SQL ###
| SELECT purchase_details, COUNT(purchase_details) FROM Purchases AS T1 JOIN Transactions AS T2 ON T1.purchase_transaction_id = T2.transaction_id WHERE T2.amount_of_transaction > 10000 GROUP BY purchase_details |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_36077 ( "Series Ep." text, "Episode" real, "Netflix" text, "Segment A" text, "Segment B" text, "Segment C" text, "Segment D" text )
### Question ###
Which series episode has a Netflix episode of S03E16?
### Accurate SQL ###
| SELECT "Series Ep." FROM table_36077 WHERE "Netflix" = 's03e16' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_624 ( id number, "school" text, "team name" text, "town" text, "county" text, "enrollment (2010-11 & 2011-12)" number, "primary mshsaa class*" number, "football class" number )
### Question ###
which school has the largest enrollment ?
### Accurate SQL ###
| SELECT "school" FROM table_204_624 ORDER BY "enrollment (2010-11 & 2011-12)" 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 countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) )
TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) )
TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) )
TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) )
TABLE: CREATE TABLE 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 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) )
### Question ###
For those employees who was hired before 2002-06-21, a bar chart shows the distribution of job_id and the amount of job_id , and group by attribute job_id, order from low to high by the total number.
### Accurate SQL ###
| SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY COUNT(JOB_ID) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_59131 ( "Name" text, "Pos." text, "Height" text, "Weight" text, "Date of Birth" text, "Club" text )
### Question ###
What is the name when weight shows head coach: Aleksandr Kabanov?
### Accurate SQL ###
| SELECT "Name" FROM table_59131 WHERE "Weight" = 'head coach: aleksandr kabanov' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_45920 ( "Date" text, "Opponents" text, "Venue" text, "Result" text, "Score F\u2013A" text )
### Question ###
What was the result of the game played in Venue H?
### Accurate SQL ###
| SELECT "Result" FROM table_45920 WHERE "Venue" = '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 Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
TABLE: CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
### Question ###
For those records from the products and each product's manufacturer, a bar chart shows the distribution of name and code , and group by attribute headquarter, I want to rank in asc by the X-axis.
### Accurate SQL ###
| SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name ORDER BY T1.Name |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar )
TABLE: CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text )
TABLE: CREATE TABLE 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 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 )
TABLE: CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text )
TABLE: CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int )
TABLE: CREATE TABLE 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 compartment_class ( compartment varchar, class_type varchar )
TABLE: CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text )
TABLE: CREATE TABLE 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 time_interval ( period text, begin_time int, end_time int )
TABLE: CREATE TABLE airline ( airline_code varchar, airline_name text, note text )
TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar )
TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text )
TABLE: CREATE TABLE 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 flight_leg ( flight_id int, leg_number int, leg_flight int )
TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int )
TABLE: CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar )
TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id int )
TABLE: CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar )
### Question ###
yes i'm looking for a flight between OAKLAND and BOSTON with a stopover in DALLAS FORT WORTH do you have one of those
### 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, airport_service AS AIRPORT_SERVICE_3, city AS CITY_0, city AS CITY_1, city AS CITY_2, city AS CITY_3, flight, flight_stop AS FLIGHT_STOP_0, flight_stop AS FLIGHT_STOP_1 WHERE ((CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'DALLAS' AND CITY_3.city_code = AIRPORT_SERVICE_3.city_code AND CITY_3.city_name = 'FORT WORTH' AND FLIGHT_STOP_0.stop_airport = AIRPORT_SERVICE_2.airport_code AND FLIGHT_STOP_1.stop_airport = AIRPORT_SERVICE_3.airport_code AND flight.flight_id = FLIGHT_STOP_0.flight_id AND flight.flight_id = FLIGHT_STOP_1.flight_id) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'OAKLAND' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
### Question ###
when did patient 030-8973 the first time had ventric output since 12/25/2103?
### Accurate SQL ###
| SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-8973')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'ventric' AND STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime) >= '2103-12-25' ORDER BY intakeoutput.intakeoutputtime LIMIT 1 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_87 (total INTEGER, gold VARCHAR, bronze VARCHAR, rank VARCHAR)
### Question ###
What is the largest total for a team with 1 bronze, 0 gold medals and ranking of 7?
### Accurate SQL ###
| SELECT MAX(total) FROM table_name_87 WHERE bronze = 1 AND rank = "7" AND gold > 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 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 )
TABLE: CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text )
### Question ###
Give me the comparison about Team_ID over the All_Games , and show total number in asc order.
### Accurate SQL ###
| SELECT All_Games, Team_ID FROM basketball_match ORDER BY 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_71775 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Record" text )
### Question ###
What was the score of the game when the record was 59-65?
### Accurate SQL ###
| SELECT "Score" FROM table_71775 WHERE "Record" = '59-65' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE 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 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 ###
Tell me the number of patients with delta abnormal lab test who had a lipase test done.
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.flag = "delta" AND lab.label = "Lipase" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_19259 ( "AGR Power Station" text, "Net MWe" real, "Construction started" real, "Connected to grid" real, "Commercial operation" real, "Accounting closure date" real )
### Question ###
What year did construction start at Heysham 1
### Accurate SQL ###
| SELECT "Construction started" FROM table_19259 WHERE "AGR Power Station" = 'Heysham 1' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_75 (film VARCHAR, recipient VARCHAR)
### Question ###
What film had Bub Ltd as the recipient?
### Accurate SQL ###
| SELECT film FROM table_name_75 WHERE recipient = "bub ltd" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_27716091_1 (directed_by VARCHAR, production_code VARCHAR)
### Question ###
who put on the show where the numbers were 227412
### Accurate SQL ###
| SELECT directed_by FROM table_27716091_1 WHERE production_code = 227412 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_53901 ( "Player" text, "Dates of captaincy" text, "Lost" real, "Tied" real, "No result" real, "% win [A ]" real )
### Question ###
What is the low no result with more than 5 loss and a win ration lesser than 58.06?
### Accurate SQL ###
| SELECT MIN("No result") FROM table_53901 WHERE "Lost" > '5' AND "% win [A ]" < '58.06' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE code_description ( code varchar, description text )
TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int )
TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text )
TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare 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 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 equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar )
TABLE: CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar )
TABLE: CREATE TABLE state ( state_code text, state_name text, country_name text )
TABLE: CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text )
TABLE: CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar )
TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id int )
TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int )
TABLE: CREATE TABLE days ( days_code varchar, day_name varchar )
TABLE: CREATE TABLE month ( month_number int, month_name text )
TABLE: CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar )
TABLE: CREATE TABLE airline ( airline_code varchar, airline_name text, note text )
TABLE: CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text )
TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar )
TABLE: CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar )
TABLE: CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text )
TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_time int )
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 time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int )
### Question ###
list DAILY flights from BOSTON to OAKLAND using CO
### Accurate SQL ###
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'OAKLAND' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'CO') AND flight.flight_days = 'DAILY' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_96 (year VARCHAR, laps VARCHAR, start VARCHAR)
### Question ###
Tell me the year with Laps less than 197 and start of 2
### Accurate SQL ###
| SELECT year FROM table_name_96 WHERE laps < 197 AND start = "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 category ( id int, business_id varchar, category_name varchar )
TABLE: CREATE TABLE checkin ( cid int, business_id varchar, count int, day varchar )
TABLE: CREATE TABLE business ( bid int, business_id varchar, name varchar, full_address varchar, city varchar, latitude varchar, longitude varchar, review_count bigint, is_open tinyint, rating float, state varchar )
TABLE: CREATE TABLE neighborhood ( id int, business_id varchar, neighborhood_name varchar )
TABLE: CREATE TABLE user ( uid int, user_id varchar, name varchar )
TABLE: CREATE TABLE tip ( tip_id int, business_id varchar, text longtext, user_id varchar, likes int, year int, month varchar )
TABLE: CREATE TABLE review ( rid int, business_id varchar, user_id varchar, rating float, text longtext, year int, month varchar )
### Question ###
Return me the number of cities that has ' Panda Express ' .
### Accurate SQL ###
| SELECT COUNT(DISTINCT (city)) FROM business WHERE name = 'Panda Express' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_3 ( id number, "province" text, "capital" text, "population" number, "density" text, "municipalities" text, "legal districts" number )
### Question ###
what is the number of legal districts in almeria province ?
### Accurate SQL ###
| SELECT COUNT(*) FROM table_203_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 vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
### Question ###
how much of patient 035-2205's change in sao2 second measured on the last intensive care unit visit compared to the value first measured on the last intensive care unit visit?
### Accurate SQL ###
| SELECT (SELECT vitalperiodic.sao2 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-2205') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1) AND NOT vitalperiodic.sao2 IS NULL ORDER BY vitalperiodic.observationtime LIMIT 1 OFFSET 1) - (SELECT vitalperiodic.sao2 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-2205') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1) AND NOT vitalperiodic.sao2 IS NULL ORDER BY vitalperiodic.observationtime 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_1011 ( "Player" text, "Touchdowns (5 points)" real, "Extra points 1 point" real, "Field goals (5 points)" real, "Total Points" real )
### Question ###
How many field goals were made by the person with 100 points in total?
### Accurate SQL ###
| SELECT MAX("Field goals (5 points)") FROM table_1011 WHERE "Total Points" = '100' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_34217 ( "Player" text, "Position" text, "Games started" text, "Hometown" text, "Height" text, "Weight" real, "Class" text, "Previous experience" text )
### Question ###
Position of fullback has what highest weight?
### Accurate SQL ###
| SELECT MAX("Weight") FROM table_34217 WHERE "Position" = 'fullback' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_73 ( spans VARCHAR, built VARCHAR )
### Question ###
What spans were built in 1896?
### Accurate SQL ###
| SELECT spans FROM table_name_73 WHERE built = "1896" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_43 ( points VARCHAR, club VARCHAR )
### Question ###
How many points for the skater from club btsc?
### Accurate SQL ###
| SELECT COUNT(points) FROM table_name_43 WHERE club = "btsc" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_913 ( id number, "#" number, "date" text, "venue" text, "opponent" text, "score" text, "result" text, "competition" text )
### Question ###
which venue has the largest result
### Accurate SQL ###
| SELECT "venue" FROM table_204_913 ORDER BY "result" + "result" 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 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 Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number )
TABLE: CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text )
TABLE: CREATE TABLE VoteTypes ( Id number, Name text )
TABLE: CREATE TABLE PostTags ( PostId number, TagId number )
TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean )
TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number )
TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text )
TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number )
TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description 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 PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text )
TABLE: CREATE TABLE PostTypes ( Id number, Name text )
TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time )
TABLE: CREATE TABLE 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 FlagTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text )
TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text )
TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId 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 ReviewTaskStates ( Id number, Name text, Description text )
TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number )
TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
TABLE: CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text )
TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number )
TABLE: CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number )
TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number )
### Question ###
Up and down votes on my answers.
### Accurate SQL ###
| SELECT p.Id AS AnswerNumber, q.Title, SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END) AS UpVotes, SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) AS DownVotes, (SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END) - SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END)) AS Total FROM Posts AS p LEFT JOIN Votes AS v ON v.PostId = p.Id INNER JOIN Posts AS q ON q.Id = p.ParentId WHERE p.PostTypeId = 2 AND p.OwnerUserId = @UserId AND VoteTypeId = 3 GROUP BY p.Id, q.Title ORDER BY Total 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_19647 ( "Position" real, "Team" text, "Played" real, "Wins" real, "Draws" real, "Losses" real, "Scored" real, "Conceded" real, "Points" real )
### Question ###
Name the number of wins for when points is 17
### Accurate SQL ###
| SELECT COUNT("Wins") FROM table_19647 WHERE "Points" = '17' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE player ( player_id number, player text, years_played text, total_wl text, singles_wl text, doubles_wl text, team number )
TABLE: CREATE TABLE match_season ( season number, player text, position text, country number, team number, draft_pick_number number, draft_class text, college text )
TABLE: CREATE TABLE country ( country_id number, country_name text, capital text, official_native_language text )
TABLE: CREATE TABLE team ( team_id number, name text )
### Question ###
Show the season, the player, and the name of the team that players belong to.
### Accurate SQL ###
| SELECT T1.season, T1.player, T2.name FROM match_season AS T1 JOIN team AS T2 ON T1.team = T2.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_19982 ( "Team" text, "Car(s)" text, "#" real, "Driver(s)" text, "Primary Sponsor(s)" text, "Listed Owner(s)" text, "Crew Chief" text )
### Question ###
Who is Jason Leffler's primary sponsor?
### Accurate SQL ###
| SELECT "Primary Sponsor(s)" FROM table_19982 WHERE "Driver(s)" = 'Jason Leffler' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1108394_6 (staten_island VARCHAR, brooklyn VARCHAR)
### Question ###
What was Staten Island when Brooklyn was 940?
### Accurate SQL ###
| SELECT staten_island FROM table_1108394_6 WHERE brooklyn = "940" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_2716 ( "Edition" text, "Round" text, "Date" text, "Partnering" text, "Against" text, "Surface" text, "Opponents" text, "W/L" text, "Result" text )
### Question ###
Name the result for ji nov k radek t p nek
### Accurate SQL ###
| SELECT "Result" FROM table_2716 WHERE "Opponents" = 'Jiří Novák Radek Štěpánek' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE Document_Locations ( Document_ID INTEGER, Location_Code CHAR(15), Date_in_Location_From DATETIME, Date_in_Locaton_To DATETIME )
TABLE: CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Roles ( Role_Code CHAR(15), Role_Name VARCHAR(255), Role_Description VARCHAR(255) )
TABLE: CREATE TABLE Ref_Locations ( Location_Code CHAR(15), Location_Name VARCHAR(255), Location_Description VARCHAR(255) )
TABLE: CREATE TABLE Employees ( Employee_ID INTEGER, Role_Code CHAR(15), Employee_Name VARCHAR(255), Gender_MFU CHAR(1), Date_of_Birth DATETIME, Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15), Document_Type_Name VARCHAR(255), Document_Type_Description VARCHAR(255) )
TABLE: CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME, Day_Number INTEGER )
TABLE: CREATE TABLE All_Documents ( Document_ID INTEGER, Date_Stored DATETIME, Document_Type_Code CHAR(15), Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255) )
### Question ###
Show how many documents are stored and bin by year in a line chart.
### Accurate SQL ###
| SELECT Date_Stored, COUNT(Date_Stored) FROM All_Documents AS T1 JOIN Ref_Calendar AS T2 ON T1.Date_Stored = T2.Calendar_Date |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_28 (tournament VARCHAR, result VARCHAR)
### Question ###
In what tournament is there a result of 46-18?
### Accurate SQL ###
| SELECT tournament FROM table_name_28 WHERE result = "46-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_name_86 ( cubic_inches__exact_ VARCHAR, unit VARCHAR )
### Question ###
What are the exact Cubic inches of the Unit of kruzhka?
### Accurate SQL ###
| SELECT cubic_inches__exact_ FROM table_name_86 WHERE unit = "kruzhka" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
### Question ###
how many times this year a hormonal therapy (for varices) - vasopressin procedure was ordered?
### Accurate SQL ###
| SELECT COUNT(*) FROM treatment WHERE treatment.treatmentname = 'hormonal therapy (for varices) - vasopressin' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE device ( device_id number, device text, carrier text, package_version text, applications text, software_platform text )
TABLE: CREATE TABLE stock ( shop_id number, device_id number, quantity number )
TABLE: CREATE TABLE shop ( shop_id number, shop_name text, location text, open_date text, open_year number )
### Question ###
What is the name of the shop that has the greatest quantity of devices in stock?
### Accurate SQL ###
| SELECT T2.shop_name FROM stock AS T1 JOIN shop AS T2 ON T1.shop_id = T2.shop_id GROUP BY T1.shop_id ORDER BY SUM(T1.quantity) 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_2508633_11 ( nfl_team VARCHAR, position VARCHAR, player VARCHAR )
### Question ###
What NFL Team has the player Danny Triplett with the position linebacker?
### Accurate SQL ###
| SELECT nfl_team FROM table_2508633_11 WHERE position = "Linebacker" AND player = "Danny Triplett" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_62 ( opponent VARCHAR, record VARCHAR )
### Question ###
Which opponent has a record of 78-60?
### Accurate SQL ###
| SELECT opponent FROM table_name_62 WHERE record = "78-60" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_221375_1 ( province_of_1936 VARCHAR, district VARCHAR )
### Question ###
Name province of 1936 viana do castelo
### Accurate SQL ###
| SELECT province_of_1936 FROM table_221375_1 WHERE district = "Viana do Castelo" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_47529 ( "Position" real, "Team" text, "Played" real, "Drawn" real, "Lost" real, "Goals For" real, "Goals Against" real, "Goal Difference" text, "Points 1" real )
### Question ###
What is the sum of Points 1, when Team is 'Gainsborough Trinity', and when Played is greater than 46?
### Accurate SQL ###
| SELECT SUM("Points 1") FROM table_47529 WHERE "Team" = 'gainsborough trinity' AND "Played" > '46' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_62 ( tournament VARCHAR )
### Question ###
Name the 2011 for tokyo tournament
### Accurate SQL ###
| SELECT 2011 FROM table_name_62 WHERE tournament = "tokyo" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_18 ( league_goals INTEGER, total_apps VARCHAR )
### Question ###
What are the average league goals that have 2 (1) as the total apps?
### Accurate SQL ###
| SELECT AVG(league_goals) FROM table_name_18 WHERE total_apps = "2 (1)" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_32 ( image_quality VARCHAR, date VARCHAR, multiple_sessions VARCHAR, authentication VARCHAR )
### Question ###
what is the image quality when the multiple sessions is x, the authentication is and the date is may 15, 2007?
### Accurate SQL ###
| SELECT image_quality FROM table_name_32 WHERE multiple_sessions = "x" AND authentication = "✓" AND date = "may 15, 2007" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_78424 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
### Question ###
What is the largest number of laps with a Grid larger than 14, a Time/Retired of + 2 laps, and a Driver of helmut marko?
### Accurate SQL ###
| SELECT MAX("Laps") FROM table_78424 WHERE "Grid" > '14' AND "Time/Retired" = '+ 2 laps' AND "Driver" = 'helmut marko' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (fastest_lap VARCHAR, circuit VARCHAR, pole_position VARCHAR, winning_team VARCHAR, race VARCHAR)
### Question ###
What is Fastest Lap, when Winning Team is Team BRM, when Race is 1, when Pole Position is Leanne Tander, and when Circuit is Phillip Island?
### Accurate SQL ###
| SELECT fastest_lap FROM table_name_8 WHERE winning_team = "team brm" AND race = 1 AND pole_position = "leanne tander" AND circuit = "phillip island" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_41465 ( "Player" text, "Att." real, "Yards" real, "Avg." real, "Long" real, "FumL" real )
### Question ###
What was the lowest long with 26 yards?
### Accurate SQL ###
| SELECT MIN("Long") FROM table_41465 WHERE "Yards" = '26' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE 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 patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE 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 cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
### Question ###
how many hours have passed since the first stay of patient 006-143187 in the ward 376 in the current hospital visit?
### Accurate SQL ###
| SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '006-143187' AND patient.wardid = 376 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_35 ( category VARCHAR )
### Question ###
What car was awarded sub 1 litre in 2000 (won by toyota 1sz-fe 1.0l yaris in 1999)?
### Accurate SQL ###
| SELECT 2000 FROM table_name_35 WHERE 1999 = "toyota 1sz-fe 1.0l yaris" AND category = "sub 1 litre" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_25 ( Id VARCHAR )
### Question ###
What is the 2005 Lukoil oil prodroduction when in 2007 oil production 91.100 million tonnes?
### Accurate SQL ###
| SELECT 2005 FROM table_name_25 WHERE 2007 = "91.100" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_69164 ( "Name" text, "Years" text, "Gender" text, "Area" text, "Authority" text, "Decile" real, "Roll" real )
### Question ###
What was the gender for the integrated authority with a roll of 142?
### Accurate SQL ###
| SELECT "Gender" FROM table_69164 WHERE "Authority" = 'integrated' AND "Roll" = '142' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_19112_3 (market_value__billion_$_ VARCHAR, company VARCHAR)
### Question ###
Name the market value for rhb capital
### Accurate SQL ###
| SELECT market_value__billion_$_ FROM table_19112_3 WHERE company = "RHB Capital" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_41 (monotone VARCHAR, clone_independence VARCHAR, pareto_efficiency VARCHAR, non_dictatorship VARCHAR)
### Question ###
what is the monotone when pareto efficiency is yes, non-dictatorship is yes, and clone independence is yes?
### Accurate SQL ###
| SELECT monotone FROM table_name_41 WHERE pareto_efficiency = "yes" AND non_dictatorship = "yes" AND clone_independence = "yes" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_73 (winner VARCHAR, tournament VARCHAR)
### Question ###
What is the name of the winner of the tour championship tournament?
### Accurate SQL ###
| SELECT winner FROM table_name_73 WHERE tournament = "the tour championship" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_38 ( laps INTEGER, grid VARCHAR, points VARCHAR )
### Question ###
What is the top lap that had 6 grids and more than 19 points?
### Accurate SQL ###
| SELECT MAX(laps) FROM table_name_38 WHERE grid = "6" AND points > 19 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_65 (count_palatine_of_the_rhine VARCHAR, interregnum_began VARCHAR)
### Question ###
What is the name of the Count Palatine of the Rhine with a Interregnum began of 2 april 1657 death of ferdinand iii?
### Accurate SQL ###
| SELECT count_palatine_of_the_rhine FROM table_name_65 WHERE interregnum_began = "2 april 1657 death of ferdinand iii" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_89 (source VARCHAR, name VARCHAR)
### Question ###
What was the source for the person named Cresswell?
### Accurate SQL ###
| SELECT source FROM table_name_89 WHERE name = "cresswell" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_6 ( type VARCHAR, source VARCHAR, name VARCHAR )
### Question ###
What is the type when the source is Realmadrid, and the name is Soldado?
### Accurate SQL ###
| SELECT type FROM table_name_6 WHERE source = "realmadrid" AND name = "soldado" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_67 (season VARCHAR, original_airdate VARCHAR, year VARCHAR)
### Question ###
What is the total number of Season(s), when Original Airdate is January 24, 1999, and when Year is less than 1999?
### Accurate SQL ###
| SELECT COUNT(season) FROM table_name_67 WHERE original_airdate = "january 24, 1999" 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 table_1140090_6 (circuit VARCHAR, race_name VARCHAR)
### Question ###
What circuit is the Vi Rhein-Pokalrennen race in?
### Accurate SQL ###
| SELECT circuit FROM table_1140090_6 WHERE race_name = "VI Rhein-Pokalrennen" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE Catalogs (date_of_latest_revision VARCHAR)
### Question ###
Find the dates on which more than one revisions were made.
### Accurate SQL ###
| SELECT date_of_latest_revision FROM Catalogs GROUP BY date_of_latest_revision HAVING COUNT(*) > 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_40436 ( "Band" text, "Value" text, "Ratio" text, "Ratio as %" text, "Average" text )
### Question ###
Which Ratio as % has a Ratio of 8/9?
### Accurate SQL ###
| SELECT "Ratio as %" FROM table_40436 WHERE "Ratio" = '8/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_60020 ( "Date" text, "Result" text, "Competition" text, "Venue" text, "Attendance" real )
### Question ###
Which Venue that has an Attendance larger than 1,000, and a Result of scotland 12-20 samoa?
### Accurate SQL ###
| SELECT "Venue" FROM table_60020 WHERE "Attendance" > '1,000' AND "Result" = 'scotland 12-20 samoa' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int )
TABLE: CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text )
TABLE: CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int )
TABLE: CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text )
### Question ###
A bar chart shows the distribution of meter_200 and the sum of ID , and group by attribute meter_200, display by the sum id in desc.
### Accurate SQL ###
| SELECT meter_200, SUM(ID) FROM swimmer GROUP BY meter_200 ORDER BY SUM(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 table_20184 ( "Class" text, "Wheel Arrangement" text, "Railway" text, "Number at Doncaster" real, "Number at Pyewipe" real, "Number at March" real )
### Question ###
Name the number of wheel arrangement when class is d14
### Accurate SQL ###
| SELECT COUNT("Wheel Arrangement") FROM table_20184 WHERE "Class" = 'D14' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_11858 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
### Question ###
How many laps for grid 12?
### Accurate SQL ###
| SELECT "Laps" FROM table_11858 WHERE "Grid" = '12' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_76 (production_number VARCHAR, title VARCHAR)
### Question ###
What was the production number of the episode titel of pre-hysterical hare?
### Accurate SQL ###
| SELECT COUNT(production_number) FROM table_name_76 WHERE title = "pre-hysterical hare" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (score VARCHAR, points VARCHAR, opponent VARCHAR)
### Question ###
What is the score of the game with 22 points and the capitals as the opponent?
### Accurate SQL ###
| SELECT score FROM table_name_37 WHERE points = 22 AND opponent = "capitals" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
give me the number of patients whose discharge location is snf and admission year is less than 2146?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "SNF" AND demographic.admityear < "2146" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_25183 ( "Romanised name" text, "Chinese name" text, "age at appointment" real, "Portfolio" text, "Prior occupation" text )
### Question ###
How old was the official with Chinese name ?
### Accurate SQL ###
| SELECT "age at appointment" FROM table_25183 WHERE "Chinese name" = '孫明揚' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE 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 diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
### Question ###
when was the last time patient 031-23605 got their urine, catheter specimen microbial testing until 08/2104?
### Accurate SQL ###
| SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-23605')) AND microlab.culturesite = 'urine, catheter specimen' AND STRFTIME('%y-%m', microlab.culturetakentime) <= '2104-08' ORDER BY microlab.culturetakentime DESC LIMIT 1 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_84 ( format VARCHAR, branding VARCHAR )
### Question ###
What format is CBC Radio 2?
### Accurate SQL ###
| SELECT format FROM table_name_84 WHERE branding = "cbc radio 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_37347 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
### Question ###
What day is their record 13-15?
### Accurate SQL ###
| SELECT "Date" FROM table_37347 WHERE "Record" = '13-15' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE teaches ( id text, course_id text, sec_id text, semester text, year number )
TABLE: CREATE TABLE department ( dept_name text, building text, budget number )
TABLE: CREATE TABLE instructor ( id text, name text, dept_name text, salary number )
TABLE: CREATE TABLE time_slot ( time_slot_id text, day text, start_hr number, start_min number, end_hr number, end_min number )
TABLE: CREATE TABLE prereq ( course_id text, prereq_id text )
TABLE: CREATE TABLE classroom ( building text, room_number text, capacity number )
TABLE: CREATE TABLE takes ( id text, course_id text, sec_id text, semester text, year number, grade text )
TABLE: CREATE TABLE course ( course_id text, title text, dept_name text, credits number )
TABLE: CREATE TABLE student ( id text, name text, dept_name text, tot_cred number )
TABLE: CREATE TABLE section ( course_id text, sec_id text, semester text, year number, building text, room_number text, time_slot_id text )
TABLE: CREATE TABLE advisor ( s_id text, i_id text )
### Question ###
What are the names and budgets of departments with budgets greater than the average?
### Accurate SQL ###
| SELECT dept_name, budget FROM department WHERE budget > (SELECT AVG(budget) FROM department) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_10816 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
### Question ###
In the game where the away team was Carlton and the crowd was larger than 25,000, what was the venue?
### Accurate SQL ###
| SELECT "Venue" FROM table_10816 WHERE "Crowd" > '25,000' AND "Away team" = 'carlton' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 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 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 )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
### Question ###
what is the daily maximum value of pressure control in patient 027-151154 this year?
### Accurate SQL ###
| SELECT MAX(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-151154')) AND lab.labname = 'pressure control' AND DATETIME(lab.labresulttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY STRFTIME('%y-%m-%d', lab.labresulttime) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE people ( people_id number, name text, height number, weight number, home town text )
TABLE: CREATE TABLE perpetrator ( perpetrator_id number, people_id number, date text, year number, location text, country text, killed number, injured number )
### Question ###
What are the names of perpetrators in country 'China' or 'Japan'?
### Accurate SQL ###
| SELECT T1.name FROM people AS T1 JOIN perpetrator AS T2 ON T1.people_id = T2.people_id WHERE T2.country = "China" OR T2.country = "Japan" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_54 (pi_code VARCHAR, area VARCHAR)
### Question ###
What is the PI code in the hindhead area?
### Accurate SQL ###
| SELECT pi_code FROM table_name_54 WHERE area = "hindhead" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.