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_3070 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Wildcats points" real, "Opponents" real, "Record" text )
### Question ###
What is the number of the first game?
### Accurate SQL ###
|
SELECT MIN("Game") FROM table_3070
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_90 ( melbourne VARCHAR, adelaide VARCHAR, gold_coast VARCHAR )
### Question ###
yes or no for the melbourne that has no for adelaide, no for gold coast?
### Accurate SQL ###
|
SELECT melbourne FROM table_name_90 WHERE adelaide = "yes" AND gold_coast = "no"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_72749 ( "Rank" real, "City 1" text, "City 2" text, "2012 Passengers (in millions)" text, "2011 Passengers (in millions)" text, "Distance" text )
### Question ###
What the is the first city listed on the route that had 6.6+ passengers in 2011 and a distance of 1075km?
### Accurate SQL ###
|
SELECT "City 1" FROM table_72749 WHERE "2011 Passengers (in millions)" = '6.6+' AND "Distance" = '1075km'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1341690_5 ( party VARCHAR, district VARCHAR )
### Question ###
How many parties won the election in the California 23 district?
### Accurate SQL ###
|
SELECT COUNT(party) FROM table_1341690_5 WHERE district = "California 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_60 (upstream_rate VARCHAR, version VARCHAR, standard_name VARCHAR)
### Question ###
What's the upstream rate for Itu g.992.2 with a version of ADSL?
### Accurate SQL ###
|
SELECT upstream_rate FROM table_name_60 WHERE version = "adsl" AND standard_name = "itu g.992.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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
### Question ###
Provide the number of american indian/alaska native ethnic background patients who had a pco2 lab test.
### Accurate SQL ###
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND lab.label = "pCO2"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_13 (league INTEGER, club VARCHAR, play_offs VARCHAR)
### Question ###
Which of the lowest leagues had Aldershot town as a club when the play-offs number was less than 0?
### Accurate SQL ###
|
SELECT MIN(league) FROM table_name_13 WHERE club = "aldershot town" AND play_offs < 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_30 ( time_retired VARCHAR, grid VARCHAR )
### Question ###
What is the time/retired for grid 9?
### Accurate SQL ###
|
SELECT time_retired FROM table_name_30 WHERE grid = 9
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_25306 ( "Country" text, "Type of Protection" text, "Maximum Term" text, "PCT route available" text, "Conversion from Patent Application" text )
### Question ###
In Tangier Zone, what is the PCT route availibility?
### Accurate SQL ###
|
SELECT "PCT route available" FROM table_25306 WHERE "Country" = 'Tangier Zone'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_25379 ( "No." real, "Player" text, "Hometown" text, "Class" text, "Position" text, "Height" text, "Weight" real )
### Question ###
What is every class with a position of guard and Tal Brody as the player?
### Accurate SQL ###
|
SELECT "Class" FROM table_25379 WHERE "Position" = 'Guard' AND "Player" = 'Tal Brody'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_62729 ( "Week" real, "Partner" text, "Dance" text, "Song" text, "Result" text )
### Question ###
What week was she safe for a salsa dance?
### Accurate SQL ###
|
SELECT SUM("Week") FROM table_62729 WHERE "Result" = 'safe' AND "Dance" = 'salsa'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_82 (province VARCHAR, _community VARCHAR, geographical_regions VARCHAR, height VARCHAR)
### Question ###
What is province of community with height larger than 1.8 and is in el cibao region?
### Accurate SQL ###
|
SELECT province, _community FROM table_name_82 WHERE geographical_regions = "el cibao" AND height > 1.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_8 ( time INTEGER, nationality VARCHAR, lane VARCHAR )
### Question ###
The swimmer from the United States in a lane less than 5, had what as the average time?
### Accurate SQL ###
|
SELECT AVG(time) FROM table_name_8 WHERE nationality = "united states" AND lane < 5
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
### Question ###
how many patients whose lab test chart time is 2111-12-22 19:13:00?
### Accurate SQL ###
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.charttime = "2111-12-22 19:13:00"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_81 ( grid INTEGER, laps VARCHAR, driver VARCHAR )
### Question ###
What is the lowest Grid for jj lehto with over 51 laps?
### Accurate SQL ###
|
SELECT MIN(grid) FROM table_name_81 WHERE laps > 51 AND driver = "jj lehto"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_43816 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" text )
### Question ###
What event had a win, record of 8-1 and n/a round?
### Accurate SQL ###
|
SELECT "Event" FROM table_43816 WHERE "Res." = 'win' AND "Round" = 'n/a' AND "Record" = '8-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_62331 ( "Month" text, "15th- 20th century" text, "U.S. (1912)" text, "U.S. (2013)" text, "Britain (2013)" text, "Hindu" text )
### Question ###
In 1912 when the U.S used sapphire, what was the Hindu birthstone?
### Accurate SQL ###
|
SELECT "Hindu" FROM table_62331 WHERE "U.S. (1912)" = 'sapphire'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 ( prefix VARCHAR, chemical_class VARCHAR )
### Question ###
What prefix has chemical class Iodoalkane?
### Accurate SQL ###
|
SELECT prefix FROM table_name_73 WHERE chemical_class = "iodoalkane"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (lost VARCHAR, goal_difference VARCHAR, drawn VARCHAR)
### Question ###
What is the number of games lost when goal difference is +13 and draws are more than 12?
### Accurate SQL ###
|
SELECT COUNT(lost) FROM table_name_65 WHERE goal_difference = "+13" AND drawn > 12
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_68883 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
### Question ###
Who did they play on August 26?
### Accurate SQL ###
|
SELECT "Opponent" FROM table_68883 WHERE "Date" = 'august 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_29127804_3 (surface VARCHAR, location VARCHAR)
### Question ###
what is the material of the surface in the dehradun , uttarakhand, india location
### Accurate SQL ###
|
SELECT surface FROM table_29127804_3 WHERE location = "Dehradun , Uttarakhand, India"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_16 (away_team VARCHAR, home_team VARCHAR)
### Question ###
When the home team was fitzroy, what did the away team score?
### Accurate SQL ###
|
SELECT away_team AS score FROM table_name_16 WHERE home_team = "fitzroy"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1458 ( "Institution" text, "Location" text, "Nickname" text, "Enrollment" real, "Established" real )
### Question ###
How many teams were established at University of Maryland?
### Accurate SQL ###
|
SELECT COUNT("Established") FROM table_1458 WHERE "Institution" = 'University of Maryland'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_78 ( moving_to VARCHAR, nat VARCHAR )
### Question ###
Who is moving with the nationality of Tri?
### Accurate SQL ###
|
SELECT moving_to FROM table_name_78 WHERE nat = "tri"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_18 ( fc_matches VARCHAR, total VARCHAR )
### Question ###
Which FC match has a total of 24?
### Accurate SQL ###
|
SELECT fc_matches FROM table_name_18 WHERE total = "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_name_29 (mass VARCHAR, launch_date_time___gmt__ VARCHAR)
### Question ###
What is Mass, when Launch Date/Time ( GMT ) is 25 November 1976, 03:59?
### Accurate SQL ###
|
SELECT mass FROM table_name_29 WHERE launch_date_time___gmt__ = "25 november 1976, 03:59"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (area_km_2 VARCHAR, census_ranking VARCHAR, population VARCHAR)
### Question ###
What is the total area with the Census Ranking of 3,129 of 5,008, and a Population larger than 460?
### Accurate SQL ###
|
SELECT COUNT(area_km_2) FROM table_name_66 WHERE census_ranking = "3,129 of 5,008" AND population > 460
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_92 (game VARCHAR, february VARCHAR, record VARCHAR)
### Question ###
How many games have a February larger than 11, and a Record of 23-7-8?
### Accurate SQL ###
|
SELECT COUNT(game) FROM table_name_92 WHERE february > 11 AND record = "23-7-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 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 )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
### Question ###
what is the hospitals minimum cost that involves a procedure called a blood product administration - fresh frozen plasma?
### Accurate SQL ###
|
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'blood product administration - fresh frozen plasma')) GROUP BY cost.patienthealthsystemstayid) AS t1
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 number, customer_id number, date_account_opened time, account_name text, other_account_details text )
TABLE: CREATE TABLE financial_transactions ( transaction_id number, account_id number, invoice_number number, transaction_type text, transaction_date time, transaction_amount number, transaction_comment text, other_transaction_details text )
TABLE: CREATE TABLE product_categories ( production_type_code text, product_type_description text, vat_rating number )
TABLE: CREATE TABLE customers ( customer_id number, customer_first_name text, customer_middle_initial text, customer_last_name text, gender text, email_address text, login_name text, login_password text, phone_number text, town_city text, state_county_province text, country text )
TABLE: CREATE TABLE order_items ( order_item_id number, order_id number, product_id number, product_quantity text, other_order_item_details text )
TABLE: CREATE TABLE orders ( order_id number, customer_id number, date_order_placed time, order_details text )
TABLE: CREATE TABLE invoices ( invoice_number number, order_id number, invoice_date time )
TABLE: CREATE TABLE products ( product_id number, parent_product_id number, production_type_code text, unit_price number, product_name text, product_color text, product_size text )
TABLE: CREATE TABLE invoice_line_items ( order_item_id number, invoice_number number, product_id number, product_title text, product_quantity text, product_price number, derived_product_cost number, derived_vat_payable number, derived_total_cost number )
### Question ###
How many customers don't have an account?
### Accurate SQL ###
|
SELECT COUNT(*) FROM customers WHERE NOT customer_id IN (SELECT customer_id FROM accounts)
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
### Question ###
what are the top three most common output events until 1 year ago?
### Accurate SQL ###
|
SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%output%' AND DATETIME(intakeoutput.intakeoutputtime) <= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY intakeoutput.celllabel) AS t1 WHERE t1.c1 <= 3
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_10062 ( "Railway" text, "Builder" text, "Built" text, "Wheels" text, "Location" text, "ObjectNumber" text )
### Question ###
Which railway was built in 1920?
### Accurate SQL ###
|
SELECT "Railway" FROM table_10062 WHERE "Built" = '1920'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_19 ( country VARCHAR, finish VARCHAR, year_s__won VARCHAR )
### Question ###
Which Country has a Finish of t32, and a Year(s) won of 1996?
### Accurate SQL ###
|
SELECT country FROM table_name_19 WHERE finish = "t32" AND year_s__won = "1996"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_73505 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
### Question ###
Where was the game in which Carl Landry (25) did the most high points played?
### Accurate SQL ###
|
SELECT "Location Attendance" FROM table_73505 WHERE "High points" = 'Carl Landry (25)'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_13079788_3 ( date VARCHAR, gtc_winner VARCHAR, gt3_winner VARCHAR )
### Question ###
what are all the date for gtc winners graeme mundy jamie smyth and gt3 winners hector lester tim mullen
### Accurate SQL ###
|
SELECT date FROM table_13079788_3 WHERE gtc_winner = "Graeme Mundy Jamie Smyth" AND gt3_winner = "Hector Lester Tim Mullen"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
provide the number of patients who have right upper quadrant pain primary disease along with procedure icd9 code 5781.
### Accurate SQL ###
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "RUQ PAIN" AND procedures.icd9_code = "5781"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_28145 ( "Camera" text, "Filter" text, "Wavelength" text, "Total exposure time" text, "Exposures" real )
### Question ###
how many exposures where there when the total exposure time is 105,000s?
### Accurate SQL ###
|
SELECT "Exposures" FROM table_28145 WHERE "Total exposure time" = '105,000s'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (ties INTEGER, played INTEGER)
### Question ###
What is the average Ties, when Played is greater than 5?
### Accurate SQL ###
|
SELECT AVG(ties) FROM table_name_68 WHERE played > 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_8616 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Attendance" text )
### Question ###
What date did the Ravens play the buffalo bills?
### Accurate SQL ###
|
SELECT "Date" FROM table_8616 WHERE "Opponent" = 'buffalo bills'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_33501 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
### Question ###
What was the venue where the home team scored 10.15 (75)?
### Accurate SQL ###
|
SELECT "Venue" FROM table_33501 WHERE "Home team score" = '10.15 (75)'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1359 ( "N\u00b0" real, "Television service" text, "Country" text, "Language" text, "Content" text, "DAR" text, "HDTV" text, "PPV" text, "Package/Option" text )
### Question ###
Does the sky calcio 6 hd have PPV?
### Accurate SQL ###
|
SELECT "PPV" FROM table_1359 WHERE "Television service" = 'Sky Calcio 6 HD'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_19998428_3 (san_julián_municipality___percentage_ VARCHAR, san_antonio_de_lomerío_municipality___percentage_ VARCHAR)
### Question ###
If the San Antonio de Lomerio municipality percentage is 5.480, what is the total percentage for the San Julian municipality?
### Accurate SQL ###
|
SELECT COUNT(san_julián_municipality___percentage_) FROM table_19998428_3 WHERE san_antonio_de_lomerío_municipality___percentage_ = "5.480"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_51223 ( "Jurisdiction" text, "For Prohibition" real, "Percent For" real, "Against Prohibition" real, "Percent Against" real )
### Question ###
What is the highest percent supporting prohibition when the number opposing is less than 2,978 and the percent opposing is less than 31.2 while the number supporting is less than 9,461?
### Accurate SQL ###
|
SELECT MAX("Percent For") FROM table_51223 WHERE "Against Prohibition" < '2,978' AND "Percent Against" < '31.2' AND "For Prohibition" < '9,461'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE VOTING_RECORD ( Secretary_Vote VARCHAR, ELECTION_CYCLE VARCHAR )
### Question ###
What are the distinct secretary votes in the fall election cycle?
### Accurate SQL ###
|
SELECT DISTINCT Secretary_Vote FROM VOTING_RECORD WHERE ELECTION_CYCLE = "Fall"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text )
TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text )
TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number )
TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text )
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 outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number )
TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod 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 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 d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE 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 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 microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name 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 )
### Question ###
what were the four most frequently prescribed drugs for patients aged 50s until 4 years ago?
### Accurate SQL ###
|
SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 50 AND 59) AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 4
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_12 (venue VARCHAR, runs VARCHAR)
### Question ###
What was the venue for runs 325/6?
### Accurate SQL ###
|
SELECT venue FROM table_name_12 WHERE runs = "325/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_1013129_1 ( college_junior_club_team VARCHAR, player VARCHAR )
### Question ###
What teams did the player vadim sharifijanov play for?
### Accurate SQL ###
|
SELECT college_junior_club_team FROM table_1013129_1 WHERE player = "Vadim Sharifijanov"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_64723 ( "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text )
### Question ###
What was the date of the tournament with a clay surface and an opponent of Irina Falconi?
### Accurate SQL ###
|
SELECT "Date" FROM table_64723 WHERE "Surface" = 'clay' AND "Opponent" = 'irina falconi'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text )
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 TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time )
TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text )
TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean )
TABLE: CREATE TABLE 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 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 Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text )
TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
TABLE: CREATE TABLE PostTags ( PostId number, TagId number )
TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number )
TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text )
TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time )
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 PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number )
TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number )
TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId 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 PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text )
TABLE: CREATE TABLE VoteTypes ( Id number, Name 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 ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text )
TABLE: CREATE TABLE PostTypes ( Id number, Name text )
TABLE: CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number )
TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number )
### Question ###
Users Reputation in Latin America. Shows reputation from Latin American users. Also shows location and a couple of additional South American countries.
### Accurate SQL ###
|
SELECT Reputation, DisplayName, Location FROM Users WHERE (Location LIKE '%France%') AND Reputation > 101 ORDER BY Reputation 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_61 ( city VARCHAR, icao VARCHAR )
### Question ###
Which city has an ICAO of Oejn?
### Accurate SQL ###
|
SELECT city FROM table_name_61 WHERE icao = "oejn"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_204_624 ( id number, "school" text, "team name" text, "town" text, "county" text, "enrollment (2010-11 & 2011-12)" number, "primary mshsaa class*" number, "football class" number )
### Question ###
how many of the schools had at least 500 students enrolled in the 2010-2011 and 2011-2012 season ?
### Accurate SQL ###
|
SELECT COUNT("team name") FROM table_204_624 WHERE "enrollment (2010-11 & 2011-12)" >= 500
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_32622 ( "Stage" text, "Date" text, "Route" text, "Terrain" text, "Length" text, "Winner" text )
### Question ###
Which stage took the tour through Boulogne-Billancourt?
### Accurate SQL ###
|
SELECT "Stage" FROM table_32622 WHERE "Route" = 'boulogne-billancourt'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (album VARCHAR, year VARCHAR)
### Question ###
Which album was on June 1998?
### Accurate SQL ###
|
SELECT album FROM table_name_27 WHERE year = "june 1998"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 ( result VARCHAR, date VARCHAR )
### Question ###
What was the result of the game from September 10, 2000?
### Accurate SQL ###
|
SELECT result FROM table_name_68 WHERE date = "september 10, 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 labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom 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 d_items ( row_id number, itemid number, label text, linksto text )
TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label 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 patients ( row_id number, subject_id number, gender text, dob time, dod time )
TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number )
TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time )
TABLE: CREATE TABLE 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 cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number )
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 microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name 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 )
### Question ###
calculate the number of patients who have been prescribed amiodarone since 1 year ago.
### Accurate SQL ###
|
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'amiodarone' AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-1 year'))
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_9648 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Round" real, "Time" text, "Location" text )
### Question ###
What is the total number of Round(s), when Time is 'n/a', and when Location is 'Canton, Ohio, USA'?
### Accurate SQL ###
|
SELECT COUNT("Round") FROM table_9648 WHERE "Time" = 'n/a' AND "Location" = 'canton, ohio, usa'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_35 (total INTEGER, nation VARCHAR, silver VARCHAR)
### Question ###
What is the total that wehn Lithuania is the nation, and Silver is more than 0?
### Accurate SQL ###
|
SELECT MIN(total) FROM table_name_35 WHERE nation = "lithuania" AND silver > 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 Drama_Workshop_Groups ( Workshop_Group_ID INTEGER, Address_ID INTEGER, Currency_Code CHAR(15), Marketing_Region_Code CHAR(15), Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Customers ( Customer_ID VARCHAR(100), Address_ID INTEGER, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Performers_in_Bookings ( Order_ID INTEGER, Performer_ID INTEGER )
TABLE: CREATE TABLE Clients ( Client_ID INTEGER, Address_ID INTEGER, Customer_Email_Address VARCHAR(255), Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Performers ( Performer_ID INTEGER, Address_ID INTEGER, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Bookings ( Booking_ID INTEGER, Customer_ID INTEGER, Workshop_Group_ID VARCHAR(100), Status_Code CHAR(15), Store_ID INTEGER, Order_Date DATETIME, Planned_Delivery_Date DATETIME, Actual_Delivery_Date DATETIME, Other_Order_Details VARCHAR(255) )
TABLE: CREATE TABLE Stores ( Store_ID VARCHAR(100), Address_ID INTEGER, Marketing_Region_Code CHAR(15), Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Products ( Product_ID VARCHAR(100), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Product_Description VARCHAR(255), Other_Product_Service_Details VARCHAR(255) )
TABLE: CREATE TABLE Invoices ( Invoice_ID INTEGER, Order_ID INTEGER, payment_method_code CHAR(15), Product_ID INTEGER, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), Order_Item_ID INTEGER )
TABLE: CREATE TABLE Bookings_Services ( Order_ID INTEGER, Product_ID INTEGER )
TABLE: CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10), payment_method_description VARCHAR(80) )
TABLE: CREATE TABLE Customer_Orders ( Order_ID INTEGER, Customer_ID INTEGER, Store_ID INTEGER, Order_Date DATETIME, Planned_Delivery_Date DATETIME, Actual_Delivery_Date DATETIME, Other_Order_Details VARCHAR(255) )
TABLE: CREATE TABLE Invoice_Items ( Invoice_Item_ID INTEGER, Invoice_ID INTEGER, Order_ID INTEGER, Order_Item_ID INTEGER, Product_ID INTEGER, Order_Quantity INTEGER, Other_Item_Details VARCHAR(255) )
TABLE: CREATE TABLE Ref_Service_Types ( Service_Type_Code CHAR(15), Parent_Service_Type_Code CHAR(15), Service_Type_Description VARCHAR(255) )
TABLE: CREATE TABLE Marketing_Regions ( Marketing_Region_Code CHAR(15), Marketing_Region_Name VARCHAR(255), Marketing_Region_Descriptrion VARCHAR(255), Other_Details VARCHAR(255) )
TABLE: CREATE TABLE Services ( Service_ID INTEGER, Service_Type_Code CHAR(15), Workshop_Group_ID INTEGER, Product_Description VARCHAR(255), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Other_Product_Service_Details VARCHAR(255) )
TABLE: CREATE TABLE Order_Items ( Order_Item_ID INTEGER, Order_ID INTEGER, Product_ID INTEGER, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255) )
TABLE: CREATE TABLE Addresses ( Address_ID VARCHAR(100), Line_1 VARCHAR(255), Line_2 VARCHAR(255), City_Town VARCHAR(255), State_County VARCHAR(255), Other_Details VARCHAR(255) )
### Question ###
Show all the planned delivery dates and bin by year in a line chart, could you rank by the x-axis in ascending please?
### Accurate SQL ###
|
SELECT Planned_Delivery_Date, COUNT(Planned_Delivery_Date) FROM Bookings ORDER BY Planned_Delivery_Date
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1792 ( "Country" text, "Population (2011)" real, "GDP (nominal) (2010, US$ millions)" real, "Military expenditures (2011, US$ millions)" real, "Military expenditures (2011, % of GDP)" text, "Defence expenditures, (2011, per capita)" real, "Deployable military (2011, thousands)" text )
### Question ###
Name the country for deployable military is 23
### Accurate SQL ###
|
SELECT "Country" FROM table_1792 WHERE "Deployable military (2011, thousands)" = '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_75 (shooter VARCHAR, total VARCHAR)
### Question ###
Which shooter was the olympic bronze medalist?
### Accurate SQL ###
|
SELECT shooter FROM table_name_75 WHERE total = "olympic bronze medalist"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_204_98 ( id number, "year" number, "competition" text, "venue" text, "position" text, "event" text, "notes" text )
### Question ###
how many many competitions were held in 2006 ?
### Accurate SQL ###
|
SELECT COUNT("competition") FROM table_204_98 WHERE "year" = 2006
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_19 ( away_team VARCHAR )
### Question ###
What is the score for the away team at Essendon?
### Accurate SQL ###
|
SELECT away_team AS score FROM table_name_19 WHERE away_team = "essendon"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_35 (laps VARCHAR, driver VARCHAR, grid VARCHAR)
### Question ###
How many laps did Chuck Stevenson have with a grid of less than 11?
### Accurate SQL ###
|
SELECT COUNT(laps) FROM table_name_35 WHERE driver = "chuck stevenson" AND grid < 11
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_79 (player VARCHAR, country VARCHAR, to_par VARCHAR)
### Question ###
What is Player, when Country is "United States", and when To Par is "WD"?
### Accurate SQL ###
|
SELECT player FROM table_name_79 WHERE country = "united states" AND to_par = "wd"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_62 (a330 VARCHAR, a310 VARCHAR)
### Question ###
What is the A330 and the A310 wide?
### Accurate SQL ###
|
SELECT a330 FROM table_name_62 WHERE a310 = "wide"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
### Question ###
give me the time of discharge and lab test fluid for patient with patient id 74032.
### Accurate SQL ###
|
SELECT demographic.dischtime, lab.fluid FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.subject_id = "74032"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
### Question ###
find the discharge time for subject id 6983.
### Accurate SQL ###
|
SELECT demographic.dischtime FROM demographic WHERE demographic.subject_id = "6983"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_8 ( capacity VARCHAR, venue VARCHAR, established VARCHAR )
### Question ###
What is the capacity at the nop aquatic centre, established after 1929?
### Accurate SQL ###
|
SELECT COUNT(capacity) FROM table_name_8 WHERE venue = "nop aquatic centre" AND established > 1929
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_18 ( bodyweight VARCHAR, total__kg_ VARCHAR )
### Question ###
Which bodyweight has a Total (kg) of 145.0?
### Accurate SQL ###
|
SELECT bodyweight FROM table_name_18 WHERE total__kg_ = "145.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 drivers ( driverId INTEGER, driverRef TEXT, number TEXT, code TEXT, forename TEXT, surname TEXT, dob TEXT, nationality TEXT, url TEXT )
TABLE: CREATE TABLE circuits ( circuitId INTEGER, circuitRef TEXT, name TEXT, location TEXT, country TEXT, lat REAL, lng REAL, alt TEXT, url TEXT )
TABLE: CREATE TABLE races ( raceId INTEGER, year INTEGER, round INTEGER, circuitId INTEGER, name TEXT, date TEXT, time TEXT, url TEXT )
TABLE: CREATE TABLE qualifying ( qualifyId INTEGER, raceId INTEGER, driverId INTEGER, constructorId INTEGER, number INTEGER, position INTEGER, q1 TEXT, q2 TEXT, q3 TEXT )
TABLE: CREATE TABLE seasons ( year INTEGER, url TEXT )
TABLE: CREATE TABLE status ( statusId INTEGER, status TEXT )
TABLE: CREATE TABLE pitStops ( raceId INTEGER, driverId INTEGER, stop INTEGER, lap INTEGER, time TEXT, duration TEXT, milliseconds INTEGER )
TABLE: CREATE TABLE constructors ( constructorId INTEGER, constructorRef TEXT, name TEXT, nationality TEXT, url TEXT )
TABLE: CREATE TABLE driverStandings ( driverStandingsId INTEGER, raceId INTEGER, driverId INTEGER, points REAL, position INTEGER, positionText TEXT, wins INTEGER )
TABLE: CREATE TABLE lapTimes ( raceId INTEGER, driverId INTEGER, lap INTEGER, position INTEGER, time TEXT, milliseconds INTEGER )
TABLE: CREATE TABLE constructorStandings ( constructorStandingsId INTEGER, raceId INTEGER, constructorId INTEGER, points REAL, position INTEGER, positionText TEXT, wins INTEGER )
TABLE: CREATE TABLE constructorResults ( constructorResultsId INTEGER, raceId INTEGER, constructorId INTEGER, points REAL, status TEXT )
TABLE: CREATE TABLE results ( resultId INTEGER, raceId INTEGER, driverId INTEGER, constructorId INTEGER, number INTEGER, grid INTEGER, position TEXT, positionText TEXT, positionOrder INTEGER, points REAL, laps TEXT, time TEXT, milliseconds TEXT, fastestLap TEXT, rank TEXT, fastestLapTime TEXT, fastestLapSpeed TEXT, statusId INTEGER )
### Question ###
Find the id and location of circuits that belong to France or Belgium. Plot them as bar chart.
### Accurate SQL ###
|
SELECT location, circuitId FROM circuits WHERE country = "France" OR country = "Belgium"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
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 ###
give me the number of patients whose admission location is trsf within this facility and primary disease is upper gi bleed?
### Accurate SQL ###
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.diagnosis = "UPPER GI BLEED"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_64 (name VARCHAR, county VARCHAR)
### Question ###
Tell me the name with sør-trøndelag
### Accurate SQL ###
|
SELECT name FROM table_name_64 WHERE county = "sør-trøndelag"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number )
TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number )
TABLE: CREATE TABLE ReviewTaskResultTypes ( 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 PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text )
TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time )
TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number )
TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time )
TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text )
TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE CloseReasonTypes ( 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 PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number )
TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean )
TABLE: CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text )
TABLE: CREATE TABLE VoteTypes ( Id number, Name text )
TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text )
TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId 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 FlagTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number )
TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount 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 PostTags ( PostId number, TagId number )
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 PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
TABLE: CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text )
TABLE: CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other )
### Question ###
Top 150 users from Rajkot.
### Accurate SQL ###
|
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%ahmedabad%' OR UPPER(Location) LIKE '%AHMEDABAD' ORDER BY Reputation DESC LIMIT 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 Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER )
TABLE: CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) )
TABLE: CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER )
TABLE: CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) )
TABLE: CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) )
### Question ###
Find the number of students whose age is younger than the average age and group by students' last name in a bar chart, and could you order X-axis in ascending order?
### Accurate SQL ###
|
SELECT LName, COUNT(LName) FROM Student WHERE Age < (SELECT AVG(Age) FROM Student) GROUP BY LName ORDER BY LName
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_26630 ( "Name" text, "Deceased Spouse" text, "Cause of Death" text, "Date of Spouses Death" text, "Length of Marriage" text, "Children Together" text, "Current Marital Status" text )
### Question ###
Name the deceased spouse for length of marriage being 24 years
### Accurate SQL ###
|
SELECT "Deceased Spouse" FROM table_26630 WHERE "Length of Marriage" = '24 years'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_86 ( result VARCHAR, opponent VARCHAR )
### Question ###
What's the result when the Carolina Panthers were the opponent?
### Accurate SQL ###
|
SELECT result FROM table_name_86 WHERE opponent = "carolina panthers"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_39 ( pick__number INTEGER, player VARCHAR )
### Question ###
What is the pick number of Jesse Alexander?
### Accurate SQL ###
|
SELECT MIN(pick__number) FROM table_name_39 WHERE player = "jesse alexander"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_78061 ( "Track" real, "Recorded" text, "Catalogue" text, "Release Date" text, "Song Title" text, "Time" text )
### Question ###
Tell me the time for 6/6/77 release date and song title of way down
### Accurate SQL ###
|
SELECT "Time" FROM table_78061 WHERE "Release Date" = '6/6/77' AND "Song Title" = 'way down'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE medicine_enzyme_interaction ( enzyme_id number, medicine_id number, interaction_type text )
TABLE: CREATE TABLE enzyme ( id number, name text, location text, product text, chromosome text, omim number, porphyria text )
TABLE: CREATE TABLE medicine ( id number, name text, trade_name text, fda_approved text )
### Question ###
What is the id and name of the enzyme that can interact with the most medicines as an activator?
### Accurate SQL ###
|
SELECT T1.id, T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id WHERE T2.interaction_type = 'activitor' GROUP BY T1.id ORDER BY COUNT(*) 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_79494 ( "Year" real, "Game" text, "Genre" text, "Platform(s)" text, "Developer(s)" text )
### Question ###
What game in the genre of adventure, has a windows platform and its year is after 1997?
### Accurate SQL ###
|
SELECT "Game" FROM table_79494 WHERE "Year" > '1997' AND "Platform(s)" = 'windows' AND "Genre" = 'adventure'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
### Question ###
what is the name of a procedure that patient 017-72915 has been given for two times on the first hospital visit?
### Accurate SQL ###
|
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, COUNT(treatment.treatmenttime) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-72915' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)) GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 = 2
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_70954 ( "D 47 +" text, "D 46 +" text, "D 45 +" text, "D 44 +" text, "D 43 O" text, "D 42 O" text, "D 41 \u221a" text, "D 40 \u221a" text )
### Question ###
Name the D 46 which has D 44 of r 25
### Accurate SQL ###
|
SELECT "D 46 +" FROM table_70954 WHERE "D 44 +" = 'r 25'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_68 ( attendance_average VARCHAR, reg_season VARCHAR )
### Question ###
What is the average attendance of the team that had a regular season result of 2nd aisa, 24-16?
### Accurate SQL ###
|
SELECT attendance_average FROM table_name_68 WHERE reg_season = "2nd aisa, 24-16"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_93 (city VARCHAR, built VARCHAR)
### Question ###
What city was the building built in 1988?
### Accurate SQL ###
|
SELECT city FROM table_name_93 WHERE built = 1988
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1818254_1 ( population INTEGER, city VARCHAR )
### Question ###
What was the population of Minneapolis in 2012?
### Accurate SQL ###
|
SELECT MAX(population) FROM table_1818254_1 WHERE city = "Minneapolis"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_23718905_6 ( bowl_game VARCHAR, matchup_results VARCHAR )
### Question ###
In what bowl game was the result Oklahoma 31, Stanford 27?
### Accurate SQL ###
|
SELECT bowl_game FROM table_23718905_6 WHERE matchup_results = "Oklahoma 31, Stanford 27"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_23030 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (millions)" text )
### Question ###
Name the viewers for the episode directed by tony phelan
### Accurate SQL ###
|
SELECT "U.S. viewers (millions)" FROM table_23030 WHERE "Directed by" = 'Tony Phelan'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_25563779_4 (champion VARCHAR, national_trophy_rookie VARCHAR)
### Question ###
Who is the champion if the national trophy/rookie is not held?
### Accurate SQL ###
|
SELECT champion FROM table_25563779_4 WHERE national_trophy_rookie = "not held"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_51238 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
### Question ###
What date were the high assists rondo (5) and the high rebounds rondo (10)?
### Accurate SQL ###
|
SELECT "Date" FROM table_51238 WHERE "High assists" = 'rondo (5)' AND "High rebounds" = 'rondo (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 gsi ( course_offering_id int, student_id int )
TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar )
TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int )
TABLE: CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar )
TABLE: CREATE TABLE 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 ( program_id int, name varchar, college varchar, introduction varchar )
TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int )
TABLE: CREATE TABLE area ( course_id int, area varchar )
TABLE: CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar )
TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar )
TABLE: CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments int, respected int, participation int, heavy_reading int, tough_grader int, hilarious int, would_take_again int, good_lecture int, no_skip int )
TABLE: CREATE TABLE 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_course ( program_id int, course_id int, workload int, category varchar )
TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location 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 requirement ( requirement_id int, requirement varchar, college varchar )
TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int )
### Question ###
Tell me a few easy 300 -level courses .
### Accurate SQL ###
|
SELECT DISTINCT course.name, course.number, program_course.workload FROM course, program_course WHERE course.department = 'EECS' AND course.number BETWEEN 300 AND 300 + 100 AND program_course.course_id = course.course_id AND program_course.workload < 3 ORDER BY program_course.workload
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_2897457_5 ( position VARCHAR, pick__number VARCHAR )
### Question ###
What position did the #94 pick play?
### Accurate SQL ###
|
SELECT position FROM table_2897457_5 WHERE pick__number = 94
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
get me the number of patients on base type drug prescription who have diagnoses icd9 code 78321.
### Accurate SQL ###
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "78321" AND prescriptions.drug_type = "BASE"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_70 (electors INTEGER, share_of_votes VARCHAR)
### Question ###
What is the total of electors when the share of votes was 11,0%?
### Accurate SQL ###
|
SELECT SUM(electors) FROM table_name_70 WHERE share_of_votes = "11,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_57296 ( "Rank" real, "Rider" text, "Team" text, "Speed" text, "Time" text )
### Question ###
Name the speed for 1:36.46.93
### Accurate SQL ###
|
SELECT "Speed" FROM table_57296 WHERE "Time" = '1:36.46.93'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_92 ( wins VARCHAR, draws INTEGER )
### Question ###
What's the total wins when the draws are less than 0?
### Accurate SQL ###
|
SELECT COUNT(wins) FROM table_name_92 WHERE draws < 0
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_71677 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Record" text )
### Question ###
Which record happened on the date of May 7?
### Accurate SQL ###
|
SELECT "Record" FROM table_71677 WHERE "Date" = 'may 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 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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
which patients have prescription for aripiprazole medication?
### Accurate SQL ###
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Aripiprazole"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_21100348_15 ( rank INTEGER, player VARCHAR )
### Question ###
What rank does Rodney Marsh have?
### Accurate SQL ###
|
SELECT MAX(rank) FROM table_21100348_15 WHERE player = "Rodney Marsh"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_31 (Id VARCHAR)
### Question ###
What 1973 has a 1978 of 75%?
### Accurate SQL ###
|
SELECT 1973 FROM table_name_31 WHERE 1978 = "75%"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_42159 ( "Team #1" text, "Agg." text, "Team #2" text, "1st leg" text, "2nd leg" text )
### Question ###
Which 1st leg has a Team #1 of ummc ekaterinburg?
### Accurate SQL ###
|
SELECT "1st leg" FROM table_42159 WHERE "Team #1" = 'ummc ekaterinburg'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.