text
stringlengths 432
6.49k
| target
stringlengths 2
4.44k
|
---|---|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_59 (attendance INTEGER, home VARCHAR, date VARCHAR)
### Question ###
What was the Attendance when the Home team was Montreal, on the Date of March 24?
### Accurate SQL ###
| SELECT SUM(attendance) FROM table_name_59 WHERE home = "montreal" AND date = "march 24" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_23394 ( "No. in series" text, "No. in season" real, "Family/families" text, "Location(s)" text, "Original air date" text )
### Question ###
What's the season number of the episode with series number US6?
### Accurate SQL ###
| SELECT MIN("No. in season") FROM table_23394 WHERE "No. in series" = 'US6' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_74898 ( "Round" text, "Circuit" text, "Date" text, "Winning driver" text, "Winning team" text )
### Question ###
With a Date of 22 July, what is the Winning team?
### Accurate SQL ###
| SELECT "Winning team" FROM table_74898 WHERE "Date" = '22 july' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text )
TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time )
TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time )
TABLE: CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time )
TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number )
TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number )
TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text )
TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text )
TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number )
TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text )
TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number )
TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text )
### Question ###
what procedure did patient 57023 receive that last time this year?
### Accurate SQL ###
| SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT procedures_icd.icd9_code FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 57023) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY procedures_icd.charttime DESC LIMIT 1) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_22 (weight INTEGER, home_town VARCHAR)
### Question ###
What is the total combined weight of players from minnetonka, mn?
### Accurate SQL ###
| SELECT SUM(weight) FROM table_name_22 WHERE home_town = "minnetonka, mn" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1939367_1 ( arabs_2001 INTEGER, province VARCHAR )
### Question ###
If the province is Manitoba, what is the Arabs 2001 number?
### Accurate SQL ###
| SELECT MAX(arabs_2001) FROM table_1939367_1 WHERE province = "Manitoba" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_15349 ( "Sydney" text, "Melbourne" text, "Perth" text, "Adelaide" text, "Gold Coast" text, "Auckland" text )
### Question ###
Which Melbourne has a Perth of yes, and an Auckland of yes?
### Accurate SQL ###
| SELECT "Melbourne" FROM table_15349 WHERE "Perth" = 'yes' AND "Auckland" = '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_1341973_6 ( result VARCHAR, incumbent VARCHAR )
### Question ###
What was the result of the election of the incumbent harry r. sheppard?
### Accurate SQL ###
| SELECT result FROM table_1341973_6 WHERE incumbent = "Harry R. Sheppard" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_35925 ( "Year" real, "Tournament" text, "Venue" text, "Result" text, "Extra" text )
### Question ###
What tournament has a year prior to 2001?
### Accurate SQL ###
| SELECT "Tournament" FROM table_35925 WHERE "Year" < '2001' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_34786 ( "Pick #" text, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
### Question ###
What is the name of the player that was Pick 15?
### Accurate SQL ###
| SELECT "Player" FROM table_34786 WHERE "Pick #" = '15' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_73 ( viewers__m_ VARCHAR, rank___number_ VARCHAR, share VARCHAR, rating VARCHAR )
### Question ###
How many vieweres for the episode with a share of 1, a Rating larger than 0.7000000000000001, and a Rank (#) of 100/102?
### Accurate SQL ###
| SELECT viewers__m_ FROM table_name_73 WHERE share = 1 AND rating > 0.7000000000000001 AND rank___number_ = "100/102" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE album ( albumid number, title text, artistid number )
TABLE: CREATE TABLE playlisttrack ( playlistid number, trackid number )
TABLE: CREATE TABLE genre ( genreid number, name text )
TABLE: CREATE TABLE artist ( artistid number, name text )
TABLE: CREATE TABLE invoiceline ( invoicelineid number, invoiceid number, trackid number, unitprice number, quantity number )
TABLE: CREATE TABLE invoice ( invoiceid number, customerid number, invoicedate time, billingaddress text, billingcity text, billingstate text, billingcountry text, billingpostalcode text, total number )
TABLE: CREATE TABLE track ( trackid number, name text, albumid number, mediatypeid number, genreid number, composer text, milliseconds number, bytes number, unitprice number )
TABLE: CREATE TABLE playlist ( playlistid number, name text )
TABLE: CREATE TABLE employee ( employeeid number, lastname text, firstname text, title text, reportsto number, birthdate time, hiredate time, address text, city text, state text, country text, postalcode text, phone text, fax text, email text )
TABLE: CREATE TABLE mediatype ( mediatypeid number, name text )
TABLE: CREATE TABLE customer ( customerid number, firstname text, lastname text, company text, address text, city text, state text, country text, postalcode text, phone text, fax text, email text, supportrepid number )
### Question ###
What are all the album titles, in alphabetical order?
### Accurate SQL ###
| SELECT title FROM album ORDER BY title |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_63916 ( "Year" text, "Total Support and Revenue" text, "Total Expenses" text, "Increase in Net Assets" text, "Net Assets at End of Year" text )
### Question ###
What net assets at end of year also has $736,132 as the increase in net assets?
### Accurate SQL ###
| SELECT "Net Assets at End of Year" FROM table_63916 WHERE "Increase in Net Assets" = '$736,132' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_50 (downhill_points INTEGER, total VARCHAR)
### Question ###
What are the downhill points for the skier with total of 9.31 points?
### Accurate SQL ###
| SELECT SUM(downhill_points) FROM table_name_50 WHERE total = "9.31" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_26234 ( "No" real, "Player" text, "Height (m)" text, "Height (f)" text, "Position" text, "Year born" real, "Current Club" text )
### Question ###
How many positions are available for players who are 6' 07'?
### Accurate SQL ###
| SELECT COUNT("Position") FROM table_26234 WHERE "Height (f)" = '6'' 07' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_9560 ( "Name" text, "Mi from Kingston" real, "Km from Kingston" real, "Parish" text, "Length feet" real, "Length meters" real )
### Question ###
What is Name, when Length Meters is greater than 66.4, and when Km From Kingston is 138.8?
### Accurate SQL ###
| SELECT "Name" FROM table_9560 WHERE "Length meters" > '66.4' AND "Km from Kingston" = '138.8' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_52 ( total VARCHAR, gold VARCHAR, bronze VARCHAR )
### Question ###
How many total medals for the nation with 1 gold and 6 bronzes?
### Accurate SQL ###
| SELECT COUNT(total) FROM table_name_52 WHERE gold = 1 AND bronze = 6 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_40579 ( "Spoofed Title" text, "Actual Title" text, "Writer" text, "Artist" text, "Issue" real, "Date" text )
### Question ###
What is the Artist with a Date that is june 1979?
### Accurate SQL ###
| SELECT "Artist" FROM table_40579 WHERE "Date" = 'june 1979' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE Companies (Profits_billion INTEGER)
### Question ###
What are the average profits of companies?
### Accurate SQL ###
| SELECT AVG(Profits_billion) FROM Companies |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_70968 ( "Index" text, "Name" text, "Chinese Name" text, "Country" text, "Status" text )
### Question ###
What is the English name of the player from Malaysia, Kuala Lumpur?
### Accurate SQL ###
| SELECT "Name" FROM table_70968 WHERE "Country" = 'malaysia, kuala lumpur' AND "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 table_35906 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner(s)-up" text )
### Question ###
On what Date was the Winning score 8 (69-72-70-69=280)?
### Accurate SQL ###
| SELECT "Date" FROM table_35906 WHERE "Winning score" = '–8 (69-72-70-69=280)' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text )
TABLE: CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text )
### Question ###
Find ACC_Road and Team_ID , and group by attribute ACC_Home, and visualize them by a bar chart, and rank by the Team_ID in ascending please.
### Accurate SQL ###
| SELECT ACC_Road, Team_ID FROM basketball_match GROUP BY ACC_Home, ACC_Road 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_name_46 ( site VARCHAR, cost___us$__ VARCHAR, editor VARCHAR )
### Question ###
Which site has a Cost free and a Editor of jsvi?
### Accurate SQL ###
| SELECT site FROM table_name_46 WHERE cost___us$__ = "free" AND editor = "jsvi" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_47419 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text )
### Question ###
What was the score for the match with tie number 23?
### Accurate SQL ###
| SELECT "Score" FROM table_47419 WHERE "Tie no" = '23' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_47 ( club VARCHAR, goals_against VARCHAR, goal_difference VARCHAR )
### Question ###
Which club had fewer than 29 goals against and a difference smaller than 26?
### Accurate SQL ###
| SELECT club FROM table_name_47 WHERE goals_against < 29 AND goal_difference < 26 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_80283 ( "Player" text, "Height" real, "Position" text, "Year born" real, "Current Club" text )
### Question ###
What position does Mario Kasun play?
### Accurate SQL ###
| SELECT "Position" FROM table_80283 WHERE "Player" = 'mario kasun' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_30120761_1 ( area__acres__ VARCHAR, civil_parish VARCHAR, townland VARCHAR )
### Question ###
What is the acreage of the Maghereen in the civil parish of Macroom?
### Accurate SQL ###
| SELECT COUNT(area__acres__) FROM table_30120761_1 WHERE civil_parish = "Macroom" AND townland = "Maghereen" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_29 (attendance INTEGER, score VARCHAR, loss VARCHAR)
### Question ###
What was the lowest attendance at a game that had a score of 5-4 and a loss of Williams (2-4)?
### Accurate SQL ###
| SELECT MIN(attendance) FROM table_name_29 WHERE score = "5-4" AND loss = "williams (2-4)" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_69499 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
### Question ###
What time was Opponent Fredson Paix o beaten in?
### Accurate SQL ###
| SELECT "Time" FROM table_69499 WHERE "Opponent" = 'fredson paixão' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_65 (score VARCHAR, player VARCHAR)
### Question ###
What is Scott Verplank's score?
### Accurate SQL ###
| SELECT score FROM table_name_65 WHERE player = "scott verplank" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE Product ( product_id INTEGER, product_name VARCHAR(80), product_details VARCHAR(255) )
TABLE: CREATE TABLE Staff ( staff_id INTEGER, staff_first_name VARCHAR(80), staff_last_name VARCHAR(80), other_staff_details VARCHAR(255) )
TABLE: CREATE TABLE Problems ( problem_id INTEGER, product_id INTEGER, closure_authorised_by_staff_id INTEGER, reported_by_staff_id INTEGER, date_problem_reported DATETIME, date_problem_closed DATETIME, problem_description VARCHAR(255), other_problem_details VARCHAR(255) )
TABLE: CREATE TABLE Problem_Category_Codes ( problem_category_code VARCHAR(20), problem_category_description VARCHAR(80) )
TABLE: CREATE TABLE Problem_Log ( problem_log_id INTEGER, assigned_to_staff_id INTEGER, problem_id INTEGER, problem_category_code VARCHAR(20), problem_status_code VARCHAR(20), log_entry_date DATETIME, log_entry_description VARCHAR(255), log_entry_fix VARCHAR(255), other_log_details VARCHAR(255) )
TABLE: CREATE TABLE Problem_Status_Codes ( problem_status_code VARCHAR(20), problem_status_description VARCHAR(80) )
### Question ###
Find all dates of the logs for the problem whose id is 10, show me a bar chart that bins the dates into the weekday interval, and counts the dates.
### Accurate SQL ###
| SELECT log_entry_date, COUNT(log_entry_date) FROM Problem_Log WHERE problem_id = 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 swimmer ( id number, name text, nationality text, meter_100 number, 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 number, name text, capacity number, city text, country text, opening_year number )
TABLE: CREATE TABLE event ( id number, name text, stadium_id number, year text )
TABLE: CREATE TABLE record ( id number, result text, swimmer_id number, event_id number )
### Question ###
Find the name of the stadium that has the maximum capacity.
### Accurate SQL ###
| SELECT name FROM stadium ORDER BY capacity 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_21191496_1 (winning_team VARCHAR, circuit VARCHAR)
### Question ###
When circuit ricardo tormo is the circuit who is the winning team?
### Accurate SQL ###
| SELECT winning_team FROM table_21191496_1 WHERE circuit = "circuit Ricardo Tormo" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_88 ( departure VARCHAR, kilometers VARCHAR )
### Question ###
What's listed for Departure that has 1676 listed for the Kilometers?
### Accurate SQL ###
| SELECT departure FROM table_name_88 WHERE kilometers = 1676 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE 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 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 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 diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
### Question ###
when was the last time patient 016-35266 was admitted via a hospital other hospital?
### Accurate SQL ###
| SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '016-35266' AND patient.hospitaladmitsource = 'other hospital' ORDER BY patient.hospitaladmittime DESC LIMIT 1 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_38614 ( "Home (1st leg)" text, "Home (2nd leg)" text, "1st Leg" text, "2nd leg" text, "Aggregate" text )
### Question ###
What was the home team for the 2nd leg for the match having a 1st leg score of 2-1?
### Accurate SQL ###
| SELECT "Home (2nd leg)" FROM table_38614 WHERE "1st Leg" = '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_17641314_3 ( school VARCHAR )
### Question ###
Name the minimum 11-12 enrollment for washington school
### Accurate SQL ###
| SELECT MIN(11 AS _12_enrollment) FROM table_17641314_3 WHERE school = "Washington" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_58029 ( "Year" real, "Tournament" text, "Venue" text, "Result" text, "Extra" text )
### Question ###
What was the Result in Year 1973?
### Accurate SQL ###
| SELECT "Result" FROM table_58029 WHERE "Year" = '1973' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE Subjects ( subject_id INTEGER, subject_name VARCHAR(120) )
TABLE: CREATE TABLE Course_Authors_and_Tutors ( author_id INTEGER, author_tutor_ATB VARCHAR(3), login_name VARCHAR(40), password VARCHAR(40), personal_name VARCHAR(80), middle_name VARCHAR(80), family_name VARCHAR(80), gender_mf VARCHAR(1), address_line_1 VARCHAR(80) )
TABLE: CREATE TABLE Courses ( course_id INTEGER, author_id INTEGER, subject_id INTEGER, course_name VARCHAR(120), course_description VARCHAR(255) )
TABLE: CREATE TABLE Student_Tests_Taken ( registration_id INTEGER, date_test_taken DATETIME, test_result VARCHAR(255) )
TABLE: CREATE TABLE Student_Course_Enrolment ( registration_id INTEGER, student_id INTEGER, course_id INTEGER, date_of_enrolment DATETIME, date_of_completion DATETIME )
TABLE: CREATE TABLE Students ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), family_name VARCHAR(40) )
### Question ###
Bar chart of how many date of completion from each date of completion, I want to sort by the y axis in ascending please.
### Accurate SQL ###
| SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment ORDER BY COUNT(date_of_completion) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_68 ( horizontal_bar VARCHAR, team VARCHAR, parallel_bars VARCHAR )
### Question ###
How many Horizontal Bars have a Team of japan (jpn), and Parallel Bars smaller than 38.924?
### Accurate SQL ###
| SELECT COUNT(horizontal_bar) FROM table_name_68 WHERE team = "japan (jpn)" AND parallel_bars < 38.924 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_43575 ( "Result" text, "TUF Competitor" text, "Opponent" text, "Method" text, "Event" text, "Date" text )
### Question ###
who is the opponent when the method is submission (rear naked choke) at 4:02 of round 2?
### Accurate SQL ###
| SELECT "Opponent" FROM table_43575 WHERE "Method" = 'submission (rear naked choke) at 4:02 of round 2' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_7 ( date_of_demolition VARCHAR, location VARCHAR )
### Question ###
How many dates of demolition are located on Wood Street?
### Accurate SQL ###
| SELECT COUNT(date_of_demolition) FROM table_name_7 WHERE location = "wood street" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE geographic ( city_name varchar, county varchar, region varchar )
TABLE: CREATE TABLE restaurant ( id int, name varchar, food_type varchar, city_name varchar, rating "decimal )
TABLE: CREATE TABLE location ( restaurant_id int, house_number int, street_name varchar, city_name varchar )
### Question ###
where are some restaurants good for french food in the yosemite and mono lake area ?
### Accurate SQL ###
| SELECT location.house_number, restaurant.name FROM geographic, location, restaurant WHERE geographic.region = 'yosemite and mono lake area' AND restaurant.city_name = geographic.city_name AND restaurant.food_type = 'french' AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.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_10120 ( "Scientic name" text, "Common name" text, "Authority" text, "Year" real, "Subgenus" text )
### Question ###
What is the authority of the scientific name of O. Tricuspis?
### Accurate SQL ###
| SELECT "Authority" FROM table_10120 WHERE "Scientic name" = 'o. tricuspis' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE savings ( custid number, balance number )
TABLE: CREATE TABLE checking ( custid number, balance number )
TABLE: CREATE TABLE accounts ( custid number, name text )
### Question ###
Find the name of accounts whose checking balance is higher than corresponding saving balance.
### Accurate SQL ###
| SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T2.balance > T3.balance |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_2 ( country VARCHAR, class___type VARCHAR )
### Question ###
What is Country, when Class / Type is 'Three masted full rigged ship'?
### Accurate SQL ###
| SELECT country FROM table_name_2 WHERE class___type = "three masted full rigged ship" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_48289 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
### Question ###
What was the score for the game when West Ham United was the away team?
### Accurate SQL ###
| SELECT "Score" FROM table_48289 WHERE "Away team" = 'west ham united' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE students ( student_id number, student_details text )
TABLE: CREATE TABLE people_addresses ( person_address_id number, person_id number, address_id number, date_from time, date_to time )
TABLE: CREATE TABLE people ( person_id number, first_name text, middle_name text, last_name text, cell_mobile_number text, email_address text, login_name text, password text )
TABLE: CREATE TABLE candidates ( candidate_id number, candidate_details text )
TABLE: CREATE TABLE addresses ( address_id number, line_1 text, line_2 text, city text, zip_postcode text, state_province_county text, country text )
TABLE: CREATE TABLE student_course_attendance ( student_id number, course_id number, date_of_attendance time )
TABLE: CREATE TABLE student_course_registrations ( student_id number, course_id number, registration_date time )
TABLE: CREATE TABLE candidate_assessments ( candidate_id number, qualification text, assessment_date time, asessment_outcome_code text )
TABLE: CREATE TABLE courses ( course_id text, course_name text, course_description text, other_details text )
### Question ###
What are all details of the students who registered but did not attend any course?
### Accurate SQL ###
| SELECT * FROM student_course_registrations WHERE NOT student_id IN (SELECT student_id FROM student_course_attendance) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_256286_13 (type VARCHAR, description VARCHAR)
### Question ###
When restoring capital punishment is the description how many types are there?
### Accurate SQL ###
| SELECT COUNT(type) FROM table_256286_13 WHERE description = "Restoring Capital Punishment" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_27503 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text )
### Question ###
It's not my job' is the minimum title in no. in season.
### Accurate SQL ###
| SELECT MIN("No. in season") FROM table_27503 WHERE "Title" = 'It''s Not My Job' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_13960 ( "Rank" real, "Player" text, "County" text, "Tally" text, "Total" real, "Opposition" text )
### Question ###
What is the tally with a total larger than 8, Waterford was the opposition?
### Accurate SQL ###
| SELECT "Tally" FROM table_13960 WHERE "Total" > '8' AND "Opposition" = 'waterford' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_24231638_3 ( manner_of_departure VARCHAR, team VARCHAR )
### Question ###
What is the manner of departure for the team racing santander?
### Accurate SQL ###
| SELECT manner_of_departure FROM table_24231638_3 WHERE team = "Racing Santander" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_53838 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
### Question ###
Name the home team scored 9.8 (62)
### Accurate SQL ###
| SELECT "Home team" FROM table_53838 WHERE "Home team score" = '9.8 (62)' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_79303 ( "Rank" real, "Lane" real, "Athlete" text, "Nationality" text, "Time" real, "React" real )
### Question ###
How many total Time listings have a 0.209 React entry and a Rank that is greater than 7?
### Accurate SQL ###
| SELECT COUNT("Time") FROM table_79303 WHERE "React" = '0.209' AND "Rank" > '7' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_44611 ( "Outcome" text, "Date" text, "Championship" text, "Surface" text, "Opponent" text, "Score" text )
### Question ###
What is Score, when Opponent is Natalia Rizhonkova?
### Accurate SQL ###
| SELECT "Score" FROM table_44611 WHERE "Opponent" = 'natalia rizhonkova' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_37589 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
### Question ###
Which visitor had a record of 7 5 3?
### Accurate SQL ###
| SELECT "Visitor" FROM table_37589 WHERE "Record" = '7–5–3' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_72552 ( "Rank" real, "Place" text, "County" text, "Per Capita Income" text, "Median House- hold Income" text, "Population" real, "Number of Households" real )
### Question ###
Which place has a rank of 71?
### Accurate SQL ###
| SELECT "Place" FROM table_72552 WHERE "Rank" = '71' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE Accounts ( Account_ID INTEGER, Statement_ID INTEGER, Account_Details VARCHAR(255) )
TABLE: CREATE TABLE Projects ( Project_ID INTEGER, Project_Details VARCHAR(255) )
TABLE: CREATE TABLE Documents ( Document_ID INTEGER, Document_Type_Code CHAR(15), Project_ID INTEGER, Document_Date DATETIME, Document_Name VARCHAR(255), Document_Description VARCHAR(255), Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Documents_with_Expenses ( Document_ID INTEGER, Budget_Type_Code CHAR(15), Document_Details VARCHAR(255) )
TABLE: CREATE TABLE Ref_Budget_Codes ( Budget_Type_Code CHAR(15), Budget_Type_Description 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 Statements ( Statement_ID INTEGER, Statement_Details VARCHAR(255) )
### Question ###
Return a bar chart showing the number of documents for each document type description, could you order Y-axis in ascending order?
### Accurate SQL ###
| SELECT Document_Type_Description, COUNT(Document_Type_Description) FROM Ref_Document_Types AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code GROUP BY Document_Type_Description ORDER BY COUNT(Document_Type_Description) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_70009 ( "Date" text, "City" text, "Country" text, "Venue" text, "Attendance" text )
### Question ###
Which City has mandalay bay resort
### Accurate SQL ###
| SELECT "City" FROM table_70009 WHERE "Venue" = 'mandalay bay resort' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE Acceptance ( Submission_ID int, Workshop_ID int, Result text )
TABLE: CREATE TABLE submission ( Submission_ID int, Scores real, Author text, College text )
TABLE: CREATE TABLE workshop ( Workshop_ID int, Date text, Venue text, Name text )
### Question ###
Visualize a bar chart for how many workshops did each author submit to? Return the author name and the number of workshops, and could you sort Y from high to low order?
### Accurate SQL ###
| SELECT Author, COUNT(DISTINCT T1.Workshop_ID) FROM Acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID ORDER BY COUNT(DISTINCT T1.Workshop_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_53249 ( "Race" text, "Circuit" text, "Date" text, "Pole position" text, "Winning driver" text, "Constructor" text, "Tyre" text, "Report" text )
### Question ###
Who was the winning driver of the Argentine Grand Prix?
### Accurate SQL ###
| SELECT "Winning driver" FROM table_53249 WHERE "Race" = 'argentine grand prix' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
### Question ###
provide the number of patients whose discharge location is snf and primary disease is hyperglycemia;hyponatremia?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "SNF" AND demographic.diagnosis = "HYPERGLYCEMIA;HYPONATREMIA" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
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 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 ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number )
TABLE: CREATE TABLE VoteTypes ( Id number, Name text )
TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text )
TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text )
TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number )
TABLE: CREATE TABLE 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 ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number )
TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number )
TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number )
TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number )
TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number )
TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time )
TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text )
TABLE: CREATE TABLE PostTypes ( Id number, Name text )
TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text )
TABLE: CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number )
TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean )
TABLE: CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number )
TABLE: CREATE TABLE PostTags ( PostId number, TagId 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 Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text )
### Question ###
Most favorited questions for a certain tag.
### Accurate SQL ###
| SELECT p.Id AS "post_link", p.FavoriteCount, p.Title, p.Body FROM Posts AS p INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE t.TagName = '##tagName:string##' ORDER BY p.FavoriteCount DESC |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_66 (poles VARCHAR, points VARCHAR)
### Question ###
What is the total number of poles and 63 points?
### Accurate SQL ###
| SELECT COUNT(poles) FROM table_name_66 WHERE points = "63" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE staff (staff_id VARCHAR, staff_first_name VARCHAR, staff_last_name VARCHAR)
TABLE: CREATE TABLE problems (reported_by_staff_id VARCHAR)
### Question ###
What are the id of problems reported by the staff named Dameon Frami or Jolie Weber?
### Accurate SQL ###
| SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Dameon" AND T2.staff_last_name = "Frami" UNION SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = "Jolie" AND T2.staff_last_name = "Weber" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE Locations ( Location_ID INTEGER, Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Events ( Event_ID INTEGER, Address_ID INTEGER, Channel_ID INTEGER, Event_Type_Code CHAR(15), Finance_ID INTEGER, Location_ID INTEGER )
TABLE: CREATE TABLE Parties_in_Events ( Party_ID INTEGER, Event_ID INTEGER, Role_Code CHAR(15) )
TABLE: CREATE TABLE Finances ( Finance_ID INTEGER, Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Assets ( Asset_ID INTEGER, Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Assets_in_Events ( Asset_ID INTEGER, Event_ID INTEGER )
TABLE: CREATE TABLE Parties ( Party_ID INTEGER, Party_Details VARCHAR(255) )
TABLE: CREATE TABLE Addresses ( Address_ID INTEGER, address_details VARCHAR(255) )
TABLE: CREATE TABLE Products ( Product_ID INTEGER, Product_Type_Code CHAR(15), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4) )
TABLE: CREATE TABLE Agreements ( Document_ID INTEGER, Event_ID INTEGER )
TABLE: CREATE TABLE Products_in_Events ( Product_in_Event_ID INTEGER, Event_ID INTEGER, Product_ID INTEGER )
TABLE: CREATE TABLE Channels ( Channel_ID INTEGER, Other_Details VARCHAR(255) )
### Question ###
Compare the total number of different product type codes, and I want to sort how many product type code from high to low order.
### Accurate SQL ###
| SELECT Product_Type_Code, COUNT(Product_Type_Code) FROM Products GROUP BY Product_Type_Code ORDER BY COUNT(Product_Type_Code) DESC |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_61202 ( "7:00 am" text, "7:30 am" text, "8:00 am" text, "9:00 am" text, "11:00 am" text, "noon" text, "12:30 pm" text, "1:00 pm" text, "1:30 pm" text, "2:00 pm" text, "3:00 pm" text, "3:30 pm" text, "4:00 pm" text, "4:30 pm" text, "5:00 pm" text, "6:30 pm" text )
### Question ###
What shows at 12:30 pm when 1:30 pm is All My Children?
### Accurate SQL ###
| SELECT "12:30 pm" FROM table_61202 WHERE "1:30 pm" = 'all my children' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_70911 ( "Player" text, "Height" real, "Position" text, "Year born" real, "Current Club" text )
### Question ###
What is the Height that has a year born before 1977
### Accurate SQL ###
| SELECT COUNT("Height") FROM table_70911 WHERE "Year born" < '1977' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1342149_18 ( candidates VARCHAR, district VARCHAR )
### Question ###
Who was the candidate in the election in the Louisiana 2 district?
### Accurate SQL ###
| SELECT candidates FROM table_1342149_18 WHERE district = "Louisiana 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_52377 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
### Question ###
what was the away team score in a game with north melbourne as home team?
### Accurate SQL ###
| SELECT "Away team score" FROM table_52377 WHERE "Home team" = 'melbourne' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_25121 ( "Details" text, "Host Nation(s)" text, "Final Venue" text, "Winner" text, "Result" text, "Runner-up" text )
### Question ###
If the results are Kuwait won by 72 runs scorecard, what are the details?
### Accurate SQL ###
| SELECT "Details" FROM table_25121 WHERE "Result" = 'Kuwait won by 72 runs Scorecard' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_63820 ( "Season" real, "Series" text, "Team" text, "Races" real, "Wins" real, "Podiums" real, "Points" real, "Position" text )
### Question ###
How many wins had a podium larger than 6 after season 2008?
### Accurate SQL ###
| SELECT COUNT("Wins") FROM table_63820 WHERE "Season" > '2008' AND "Podiums" > '6' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_27890 ( "Settlement" text, "Cyrillic Name Other Names" text, "Type" text, "Population (2011)" real, "Largest ethnic group (2002)" text, "Dominant religion (2002)" text )
### Question ###
What was the dominant religion (2002) of the Mala Remeta settlement?
### Accurate SQL ###
| SELECT "Dominant religion (2002)" FROM table_27890 WHERE "Settlement" = 'Mala Remeta' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_40 (points VARCHAR, series VARCHAR, position VARCHAR)
### Question ###
What is Points, when Series is Queensland Formula Ford Championship, and when Position is 1st?
### Accurate SQL ###
| SELECT points FROM table_name_40 WHERE series = "queensland formula ford championship" AND position = "1st" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_2249029_1 ( gdp_world_rank VARCHAR, asian_rank VARCHAR )
### Question ###
Name the gdp world rank for asian rank being 20
### Accurate SQL ###
| SELECT gdp_world_rank FROM table_2249029_1 WHERE asian_rank = 20 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_13758945_3 (points VARCHAR, tries_for VARCHAR)
### Question ###
what's the points with tries for being 64
### Accurate SQL ###
| SELECT points FROM table_13758945_3 WHERE tries_for = "64" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_29006 ( "Pick #" real, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
### Question ###
who is the player for the position defence and the college/junior/club team is ottawa 67's (ohl)?
### Accurate SQL ###
| SELECT "Player" FROM table_29006 WHERE "Position" = 'Defence' AND "College/junior/club team" = 'Ottawa 67''s (OHL)' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_48089 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
### Question ###
Which Method has a Round of 1, and a Record of 4 2?
### Accurate SQL ###
| SELECT "Method" FROM table_48089 WHERE "Round" = '1' AND "Record" = '4–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_train_100 ( "id" int, "systolic_blood_pressure_sbp" int, "stroke" bool, "body_weight" float, "diastolic_blood_pressure_dbp" int, "rosen_modified_hachinski_ischemic_score" int, "body_mass_index_bmi" float, "age" float, "NOUSE" float )
### Question ###
each subject must be >= 55 to >= 85 years of age.
### Accurate SQL ###
| SELECT * FROM table_train_100 WHERE age >= 55 AND age <= 85 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE body_builder ( People_ID VARCHAR, Total INTEGER )
TABLE: CREATE TABLE people ( Height VARCHAR, People_ID VARCHAR )
### Question ###
What are the heights of body builders with total score smaller than 315?
### Accurate SQL ###
| SELECT T2.Height FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Total < 315 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_7 (director VARCHAR, prod_code VARCHAR)
### Question ###
Who directed the episode with production code 40811-005?
### Accurate SQL ###
| SELECT director FROM table_name_7 WHERE prod_code = "40811-005" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE song (song_name VARCHAR, resolution INTEGER)
TABLE: CREATE TABLE song (song_name VARCHAR, f_id VARCHAR)
TABLE: CREATE TABLE files (f_id VARCHAR, formats VARCHAR)
### Question ###
Return the names of songs for which format is mp3 and resolution is below 1000.
### Accurate SQL ###
| SELECT T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = "mp3" INTERSECT SELECT song_name FROM song WHERE resolution < 1000 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
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 ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text )
TABLE: CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other )
TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text )
TABLE: CREATE TABLE PostTags ( PostId number, TagId number )
TABLE: CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text )
TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number )
TABLE: CREATE TABLE PostTypes ( Id number, Name text )
TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time )
TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number )
TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text )
TABLE: CREATE TABLE VoteTypes ( Id number, Name text )
TABLE: CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text )
TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text )
TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean )
TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text )
TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number )
TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number )
TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number )
TABLE: CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number )
TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId 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 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 Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number )
### Question ###
Top 2000 Stack Overflow Users From Netherlands By Reputation. Top 2000 SO users from Netherlands or Netherlands based cities.
### Accurate SQL ###
| SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS Position, DisplayName, Reputation, WebsiteUrl, Location, WebsiteUrl, AboutMe, 'http://stackoverflow.com/users/' + CAST(Id AS TEXT(10)) AS ProfileUrl FROM Users WHERE UPPER(Location) LIKE '%NETHERLANDS%' OR UPPER(Location) LIKE '%NEDERLAND%' OR UPPER(Location) LIKE N'%AMSTERDAM%' OR UPPER(Location) LIKE N'%EINDHOVEN%' OR UPPER(Location) LIKE N'%UTRECHT%' OR UPPER(Location) LIKE N'%NIJMEGEN%' OR UPPER(Location) LIKE N'%ROTTERDAM%' OR UPPER(Location) LIKE N'%HAAG%' ORDER BY Reputation DESC LIMIT 2000 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_13416000_3 (first_driver_s_ VARCHAR, country VARCHAR)
### Question ###
How many entries are there for first driver for Canada?
### Accurate SQL ###
| SELECT COUNT(first_driver_s_) FROM table_13416000_3 WHERE country = "Canada" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE 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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
provide the number of patients whose admission location is phys referral/normal deli and year of birth is less than 2168?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND demographic.dob_year < "2168" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE AssignedTo ( Scientist int, Project char(4) )
TABLE: CREATE TABLE Projects ( Code Char(4), Name Char(50), Hours int )
TABLE: CREATE TABLE Scientists ( SSN int, Name Char(30) )
### Question ###
Visualize a bar chart for what are the naems of all the projects, and how many scientists were assigned to each of them?, and show by the bar in ascending please.
### Accurate SQL ###
| SELECT Name, COUNT(*) FROM Projects AS T1 JOIN AssignedTo AS T2 ON T1.Code = T2.Project GROUP BY T1.Name ORDER BY Name |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_63 (series VARCHAR, director VARCHAR, release_date VARCHAR)
### Question ###
What was the series of the episode directed by Abe Levitow released on 1959-06-27?
### Accurate SQL ###
| SELECT series FROM table_name_63 WHERE director = "abe levitow" AND release_date = "1959-06-27" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
### Question ###
what is the total number of patients treated with potassium chl 40 meq / 1000 ml d5ns who belonged to american indian/alaska native origin
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND prescriptions.drug = "Potassium Chl 40 mEq / 1000 mL D5NS" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text )
TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text )
TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time )
TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number )
TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time )
TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text )
TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number )
TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text )
TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time )
TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number )
TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number )
### Question ###
how many patients in 2105 underwent a procedure-two vessels within 2 months after the diagnosis of a pneumococcal meningitis?
### Accurate SQL ###
| SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'pneumococcal meningitis') AND STRFTIME('%y', diagnoses_icd.charttime) = '2105') AS t1 JOIN (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'procedure-two vessels') AND STRFTIME('%y', procedures_icd.charttime) = '2105') AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.charttime AND DATETIME(t2.charttime) BETWEEN DATETIME(t1.charttime) AND DATETIME(t1.charttime, '+2 month') |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_12 (points INTEGER, name VARCHAR, lost VARCHAR)
### Question ###
How many average points did svg burgkirchen have with a loss smaller than 6?
### Accurate SQL ###
| SELECT AVG(points) FROM table_name_12 WHERE name = "svg burgkirchen" AND lost < 6 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_30120619_1 (barony VARCHAR, area__acres__ VARCHAR)
### Question ###
What is the barony of the townland whose area is 150 acres?
### Accurate SQL ###
| SELECT barony FROM table_30120619_1 WHERE area__acres__ = 150 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_51508 ( "Squad No." real, "Name" text, "Position" text, "League Apps" text, "League Goals" real, "FA Cup Apps" text, "FA Cup Goals" real, "League Cup Apps" text, "League Cup Goals" real, "FLT Apps" text, "FLT Goals" real, "Total Apps" text, "Total Goals" real )
### Question ###
Tell me the highest league goals with total goals less than 1 and FA cups more than 0
### Accurate SQL ###
| SELECT MAX("League Goals") FROM table_51508 WHERE "Total Goals" < '1' AND "FA Cup Goals" > '0' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_34 (rank INTEGER, name VARCHAR, matches VARCHAR)
### Question ###
What is the Rank for Viktors Dobrecovs with less than 325 Matches?
### Accurate SQL ###
| SELECT AVG(rank) FROM table_name_34 WHERE name = "viktors dobrecovs" AND matches < 325 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_49 ( byes INTEGER, wins VARCHAR )
### Question ###
What is the smallest byes when the wins are 3?
### Accurate SQL ###
| SELECT MIN(byes) FROM table_name_49 WHERE wins = 3 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_65386 ( "Heat" real, "Lane" real, "Name" text, "Nationality" text, "Time" text )
### Question ###
What time did Sara Nordenstam get?
### Accurate SQL ###
| SELECT "Time" FROM table_65386 WHERE "Name" = 'sara nordenstam' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_818 ( id number, "kategori" text, "1995" text, "2004" text, "2005" text, "2006" text, "2007" text )
### Question ###
how many categories are listed on this chart ?
### Accurate SQL ###
| SELECT COUNT("kategori") FROM table_203_818 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments int, respected int, participation int, heavy_reading int, tough_grader int, hilarious int, would_take_again int, good_lecture int, no_skip int )
TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar )
TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar )
TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar )
TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar )
TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int )
TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar )
TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar )
TABLE: CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar )
TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar )
TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar )
TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int )
TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int )
TABLE: CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar )
TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int )
TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int )
TABLE: CREATE TABLE area ( course_id int, area varchar )
TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int )
### Question ###
What upper-level classes are 3 credits ?
### Accurate SQL ###
| SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.credits = 3 AND program_course.category LIKE 'ULCS' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_29546218_3 ( skip__club_ VARCHAR, pf VARCHAR )
### Question ###
What is the total mumber of skip (club) entries when the pf is 40?
### Accurate SQL ###
| SELECT COUNT(skip__club_) FROM table_29546218_3 WHERE pf = 40 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_11884814_3 (swimsuit VARCHAR, interview VARCHAR)
### Question ###
What is the swimsuit score when the interview was 9.74?
### Accurate SQL ###
| SELECT swimsuit FROM table_11884814_3 WHERE interview = "9.74" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_27 ( bronze INTEGER, gold INTEGER )
### Question ###
What's the Bronze cumulative number for less than 0 gold?
### Accurate SQL ###
| SELECT SUM(bronze) FROM table_name_27 WHERE gold < 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.