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 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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
### Question ###
provide the number of patients whose marital status is divorced and lab test name is vancomycin?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "DIVORCED" AND lab.label = "Vancomycin" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 ( class VARCHAR, frequency_mhz VARCHAR, erp_w VARCHAR )
### Question ###
What class is assigned to frequencies larger than 89.3 with an ERP W of 250?
### Accurate SQL ###
| SELECT class FROM table_name_60 WHERE frequency_mhz > 89.3 AND erp_w = 250 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_29686983_1 (round VARCHAR, fastest_lap VARCHAR, pole_position VARCHAR)
### Question ###
what is the round wher the fabien foret had the fastest lap and david salom was the pole position?
### Accurate SQL ###
| SELECT round FROM table_29686983_1 WHERE fastest_lap = "Fabien Foret" AND pole_position = "David Salom" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 ( authority VARCHAR, area VARCHAR, roll VARCHAR, decile VARCHAR )
### Question ###
Name the authority for te akau with roll less than 254 and decile of 8
### Accurate SQL ###
| SELECT authority FROM table_name_64 WHERE roll < 254 AND decile = "8" AND area = "te akau" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (constituency VARCHAR, conservative VARCHAR)
### Question ###
What constituency does the Conservative Darren Millar belong to?
### Accurate SQL ###
| SELECT constituency FROM table_name_93 WHERE conservative = "darren millar" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_38 ( points VARCHAR, visitor VARCHAR, home VARCHAR )
### Question ###
How many points have pittsburgh as the visitor, and philadelphia as the home?
### Accurate SQL ###
| SELECT COUNT(points) FROM table_name_38 WHERE visitor = "pittsburgh" AND home = "philadelphia" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_15700367_6 ( overs_bowled VARCHAR, name VARCHAR )
### Question ###
How many overs bowled for muttiah muralitharan?
### Accurate SQL ###
| SELECT COUNT(overs_bowled) FROM table_15700367_6 WHERE name = "Muttiah Muralitharan" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE acceptance (Author VARCHAR, Submission_ID VARCHAR)
TABLE: CREATE TABLE submission (Author VARCHAR, Submission_ID VARCHAR)
### Question ###
List the authors who do not have submission to any workshop.
### Accurate SQL ###
| SELECT Author FROM submission WHERE NOT Submission_ID IN (SELECT Submission_ID FROM acceptance) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_21819 ( "SECR No." real, "SR No." real, "BR No." real, "Builder" text, "Date Delivered" text, "Date Withdrawn" text )
### Question ###
What is the withdraw date for secr no. 771?
### Accurate SQL ###
| SELECT "Date Withdrawn" FROM table_21819 WHERE "SECR No." = '771' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1147701_5 ( model_name VARCHAR, engine_code VARCHAR )
### Question ###
What is the model of the enginge d5252 t?
### Accurate SQL ###
| SELECT model_name FROM table_1147701_5 WHERE engine_code = "D5252 T" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (regular_season_champion_s_ VARCHAR, year VARCHAR)
### Question ###
WHich Regular Season Champions has a Year of 1943–44?
### Accurate SQL ###
| SELECT regular_season_champion_s_ FROM table_name_70 WHERE year = "1943–44" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) )
TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) )
TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) )
TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) )
TABLE: CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(4,0) )
TABLE: CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) )
TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) )
### Question ###
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, draw a line chart about the change of manager_id over hire_date .
### Accurate SQL ###
| SELECT HIRE_DATE, MANAGER_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_21062353_1 ( opponent VARCHAR, game VARCHAR )
### Question ###
Who were the the opponents of the Wildcats for game 8 of the season?
### Accurate SQL ###
| SELECT opponent FROM table_21062353_1 WHERE game = 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_31 (total VARCHAR, a_score VARCHAR, b_score VARCHAR)
### Question ###
Can you tell me the Total that has the A Score larger than 6.4, and the B Score smaller than 9.025?
### Accurate SQL ###
| SELECT total FROM table_name_31 WHERE a_score > 6.4 AND b_score < 9.025 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_17837 ( "Colt model no." text, "Name" text, "Stock" text, "Fire control" text, "Rear sight" text, "Forward assist" text, "Barrel length" text, "Barrel profile" text, "Barrel twist" text, "Hand guards" text, "Bayonet Lug" text, "Muzzle device" text )
### Question ###
What is the bayonet lug status for a m4 hbar and m4le carbine equipped?
### Accurate SQL ###
| SELECT "Bayonet Lug" FROM table_17837 WHERE "Barrel profile" = 'M4 HBAR' AND "Name" = 'M4LE Carbine' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_97 (episode VARCHAR, writer_s_ VARCHAR)
### Question ###
What episode was written by jonathan lewis?
### Accurate SQL ###
| SELECT episode FROM table_name_97 WHERE writer_s_ = "jonathan lewis" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_25 ( home_team VARCHAR, away_team VARCHAR )
### Question ###
Which Home team has an Away team of collingwood?
### Accurate SQL ###
| SELECT home_team FROM table_name_25 WHERE away_team = "collingwood" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_57346 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
### Question ###
Who was the home team when Hawthorn was the away team?
### Accurate SQL ###
| SELECT "Home team" FROM table_57346 WHERE "Away team" = 'hawthorn' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_55424 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text )
### Question ###
What was the loss of the Mariners game when they had a record of 21-34?
### Accurate SQL ###
| SELECT "Loss" FROM table_55424 WHERE "Record" = '21-34' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE 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 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 microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
### Question ###
how much it costs for the hospital stay of patient 027-142835 in their last hospital encounter?
### Accurate SQL ###
| SELECT SUM(cost.cost) FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-142835' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_32 (artist VARCHAR, year VARCHAR)
### Question ###
Which artist was 2003?
### Accurate SQL ###
| SELECT artist FROM table_name_32 WHERE year = 2003 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_204_567 ( id number, "team" text, "location" text, "stadium" text, "capacity" number, "manager" text, "captain" text, "kit manufacturer" text, "shirt sponsor" text )
### Question ###
of those teams with kit manufactured by nike , which has a stadium with the most capacity ?
### Accurate SQL ###
| SELECT "team" FROM table_204_567 WHERE "kit manufacturer" = 'nike' ORDER BY "capacity" DESC LIMIT 1 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_57 ( format VARCHAR, album VARCHAR, year VARCHAR )
### Question ###
What is the format of the album Pacific Ocean Blue in 1991?
### Accurate SQL ###
| SELECT format FROM table_name_57 WHERE album = "pacific ocean blue" AND year = 1991 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE elimination ( elimination_id text, wrestler_id text, team text, eliminated_by text, elimination_move text, time text )
TABLE: CREATE TABLE wrestler ( wrestler_id number, name text, reign text, days_held text, location text, event text )
### Question ###
Please show the most common reigns of wrestlers.
### Accurate SQL ###
| SELECT reign FROM wrestler GROUP BY reign 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_10075 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" real )
### Question ###
What is the country with a 70-74-69=213 score?
### Accurate SQL ###
| SELECT "Country" FROM table_10075 WHERE "Score" = '70-74-69=213' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_42931 ( "Position" real, "Team" text, "Points" real, "Played" real, "Drawn" real, "Lost" real, "Against" real, "Difference" text )
### Question ###
What average played has an against less than 15?
### Accurate SQL ###
| SELECT AVG("Played") FROM table_42931 WHERE "Against" < '15' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_33 (rank VARCHAR, finish VARCHAR)
### Question ###
What rank has a 25 finish?
### Accurate SQL ###
| SELECT rank FROM table_name_33 WHERE finish = "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 laptimes ( raceid number, driverid number, lap number, position number, time text, milliseconds number )
TABLE: CREATE TABLE driverstandings ( driverstandingsid number, raceid number, driverid number, points number, position number, positiontext text, wins number )
TABLE: CREATE TABLE drivers ( driverid number, driverref text, number number, code text, forename text, surname text, dob text, nationality text, url text )
TABLE: CREATE TABLE constructorresults ( constructorresultsid number, raceid number, constructorid number, points number, status number )
TABLE: CREATE TABLE pitstops ( raceid number, driverid number, stop number, lap number, time text, duration text, milliseconds number )
TABLE: CREATE TABLE constructorstandings ( constructorstandingsid number, raceid number, constructorid number, points number, position number, positiontext text, wins number )
TABLE: CREATE TABLE results ( resultid number, raceid number, driverid number, constructorid number, number number, grid number, position number, positiontext text, positionorder number, points number, laps number, time text, milliseconds number, fastestlap number, rank number, fastestlaptime text, fastestlapspeed text, statusid number )
TABLE: CREATE TABLE status ( statusid number, status text )
TABLE: CREATE TABLE constructors ( constructorid number, constructorref text, name text, nationality text, url text )
TABLE: CREATE TABLE qualifying ( qualifyid number, raceid number, driverid number, constructorid number, number number, position number, q1 text, q2 text, q3 text )
TABLE: CREATE TABLE circuits ( circuitid number, circuitref text, name text, location text, country text, lat number, lng number, alt number, url text )
TABLE: CREATE TABLE seasons ( year number, url text )
TABLE: CREATE TABLE races ( raceid number, year number, round number, circuitid number, name text, date text, time text, url text )
### Question ###
What is the maximum fastest lap speed in race named 'Monaco Grand Prix' in 2008 ?
### Accurate SQL ###
| SELECT MAX(T2.fastestlapspeed) FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year = 2008 AND T1.name = "Monaco Grand Prix" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_204_310 ( id number, "month" text, "year" number, "player" text, "county" text, "club" text, "position" number )
### Question ###
how many players were from waterford ?
### Accurate SQL ###
| SELECT COUNT("player") FROM table_204_310 WHERE "county" = 'waterford' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_37407 ( "Squad No" real, "Player" text, "Position" text, "Tries" real, "Goals" real, "Points" real )
### Question ###
What is the smallest number of tries when Matt Diskin is the player and there are more than 16 points?
### Accurate SQL ###
| SELECT MIN("Tries") FROM table_37407 WHERE "Player" = 'matt diskin' AND "Points" > '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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
### Question ###
How many patients below 67 years of age have stayed in the hospital for more than 34 days?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "67" AND demographic.days_stay > "34" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_24 (season VARCHAR, round VARCHAR, home_result VARCHAR)
### Question ###
Round of 2r, and a Home result of 0-0 has what season?
### Accurate SQL ###
| SELECT season FROM table_name_24 WHERE round = "2r" AND home_result = "0-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_75 (streak VARCHAR, location_attendance VARCHAR, record VARCHAR)
### Question ###
Which Streak is in new orleans arena and a Record of 31–33?
### Accurate SQL ###
| SELECT streak FROM table_name_75 WHERE location_attendance = "new orleans arena" AND record = "31–33" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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_97 (silver VARCHAR, gold VARCHAR)
### Question ###
How many silver metals are possessed by countries with 2 gold medals?
### Accurate SQL ###
| SELECT COUNT(silver) FROM table_name_97 WHERE gold = 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 party_host ( party_id number, host_id number, is_main_in_charge others )
TABLE: CREATE TABLE party ( party_id number, party_theme text, location text, first_year text, last_year text, number_of_hosts number )
TABLE: CREATE TABLE host ( host_id number, name text, nationality text, age text )
### Question ###
Show different nationalities along with the number of hosts of each nationality.
### Accurate SQL ###
| SELECT nationality, COUNT(*) FROM host GROUP BY nationality |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
### Question ###
what is average age of patients whose age is greater than or equal to 79 and admission year is greater than or equal to 2111?
### Accurate SQL ###
| SELECT AVG(demographic.age) FROM demographic WHERE demographic.age >= "79" AND demographic.admityear >= "2111" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE Staff ( staff_id INTEGER, gender VARCHAR(1), first_name VARCHAR(80), last_name VARCHAR(80), email_address VARCHAR(255), phone_number VARCHAR(80) )
TABLE: CREATE TABLE Products ( product_id INTEGER, parent_product_id INTEGER, product_category_code VARCHAR(20), date_product_first_available DATETIME, date_product_discontinued DATETIME, product_name VARCHAR(80), product_description VARCHAR(255), product_price DECIMAL(19,4) )
TABLE: CREATE TABLE Customers ( customer_id INTEGER, customer_type_code VARCHAR(20), address_line_1 VARCHAR(80), address_line_2 VARCHAR(80), town_city VARCHAR(80), state VARCHAR(80), email_address VARCHAR(255), phone_number VARCHAR(80) )
TABLE: CREATE TABLE Complaints ( complaint_id INTEGER, product_id INTEGER, customer_id INTEGER, complaint_outcome_code VARCHAR(20), complaint_status_code VARCHAR(20), complaint_type_code VARCHAR(20), date_complaint_raised DATETIME, date_complaint_closed DATETIME, staff_id INTEGER )
### Question ###
What are all the different product names, and how many complains has each received Show bar chart, sort by the X-axis from low to high please.
### Accurate SQL ###
| SELECT product_name, COUNT(*) FROM Products AS t1 JOIN Complaints AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_name ORDER BY product_name |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_77 ( object_type VARCHAR, right_ascension___j2000__ VARCHAR )
### Question ###
what is the object type when the right ascension (j2000) is 11h10m42.8s?
### Accurate SQL ###
| SELECT object_type FROM table_name_77 WHERE right_ascension___j2000__ = "11h10m42.8s" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 ( college VARCHAR, pick VARCHAR )
### Question ###
What college received Pick 5?
### Accurate SQL ###
| SELECT college FROM table_name_93 WHERE pick = 5 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_63 ( year INTEGER, team VARCHAR, player VARCHAR )
### Question ###
What most recent year had North Melbourne as a team and Hamish Mcintosh as a player?
### Accurate SQL ###
| SELECT MAX(year) FROM table_name_63 WHERE team = "north melbourne" AND player = "hamish mcintosh" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE Products ( product_id INTEGER, parent_product_id INTEGER, production_type_code VARCHAR(15), unit_price DECIMAL(19,4), product_name VARCHAR(80), product_color VARCHAR(20), product_size VARCHAR(20) )
TABLE: CREATE TABLE Order_Items ( order_item_id INTEGER, order_id INTEGER, product_id INTEGER, product_quantity VARCHAR(50), other_order_item_details VARCHAR(255) )
TABLE: CREATE TABLE Customers ( customer_id INTEGER, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), gender VARCHAR(1), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), town_city VARCHAR(50), state_county_province VARCHAR(50), country VARCHAR(50) )
TABLE: CREATE TABLE Invoice_Line_Items ( order_item_id INTEGER, invoice_number INTEGER, product_id INTEGER, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19,4), derived_product_cost DECIMAL(19,4), derived_vat_payable DECIMAL(19,4), derived_total_cost DECIMAL(19,4) )
TABLE: CREATE TABLE Product_Categories ( production_type_code VARCHAR(15), product_type_description VARCHAR(80), vat_rating DECIMAL(19,4) )
TABLE: CREATE TABLE Orders ( order_id INTEGER, customer_id INTEGER, date_order_placed DATETIME, order_details VARCHAR(255) )
TABLE: CREATE TABLE Invoices ( invoice_number INTEGER, order_id INTEGER, invoice_date DATETIME )
TABLE: CREATE TABLE Financial_Transactions ( transaction_id INTEGER, account_id INTEGER, invoice_number INTEGER, transaction_type VARCHAR(15), transaction_date DATETIME, transaction_amount DECIMAL(19,4), transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255) )
TABLE: CREATE TABLE Accounts ( account_id INTEGER, customer_id INTEGER, date_account_opened DATETIME, account_name VARCHAR(50), other_account_details VARCHAR(255) )
### Question ###
Show the number of date account opened from each date account opened, and I want to rank by the y axis in desc.
### Accurate SQL ###
| SELECT date_account_opened, COUNT(date_account_opened) FROM Accounts ORDER BY COUNT(date_account_opened) 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_90 (status VARCHAR, area_km_2 VARCHAR, population VARCHAR)
### Question ###
What status has an area km 2 less than 27.82, with 352 as the population?
### Accurate SQL ###
| SELECT status FROM table_name_90 WHERE area_km_2 < 27.82 AND population = 352 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_58757 ( "Name" text, "Pos." text, "Height" text, "Weight" text, "Date of Birth" text, "Club" text )
### Question ###
What is the Height if the weight is kg (lb), the club is Sainte-foy and the pos is cf?
### Accurate SQL ###
| SELECT "Height" FROM table_58757 WHERE "Weight" = 'kg (lb)' AND "Club" = 'sainte-foy' AND "Pos." = 'cf' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE student_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 ta ( campus_job_id int, student_id int, location varchar )
TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar )
TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar )
TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar )
TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int )
TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int )
TABLE: CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar )
TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int )
TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text 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 requirement ( requirement_id int, requirement varchar, college 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 gsi ( course_offering_id int, student_id int )
TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar )
TABLE: CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar )
TABLE: CREATE TABLE 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 area ( course_id int, area varchar )
### Question ###
I will be taking BE 888 , what courses should I take before it ?
### Accurate SQL ###
| SELECT DISTINCT advisory_requirement FROM course WHERE department = 'BE' AND number = 888 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (total_games INTEGER, pct VARCHAR, team VARCHAR, conference VARCHAR, lost VARCHAR)
### Question ###
What were the total games in the Big Ten conference when Nebraska lost fewer than 488 games and had a Pct less than 0.7014?
### Accurate SQL ###
| SELECT SUM(total_games) FROM table_name_68 WHERE conference = "big ten" AND lost < 488 AND team = "nebraska" AND pct < 0.7014 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_72 (director VARCHAR, notes VARCHAR)
### Question ###
Who had notes of Prizzi's Honor?
### Accurate SQL ###
| SELECT director FROM table_name_72 WHERE notes = "prizzi's honor" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_39038 ( "Result" text, "Date" text, "Race" text, "Venue" text, "Group" text, "Distance" text, "Weight (kg)" real, "Time" text, "Jockey" text, "Winner/2nd" text )
### Question ###
What venue has g1 as the group?
### Accurate SQL ###
| SELECT "Venue" FROM table_39038 WHERE "Group" = 'g1' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (surface VARCHAR, partner VARCHAR)
### Question ###
What was the surface for the game that was played with partner Tiya Rolle?
### Accurate SQL ###
| SELECT surface FROM table_name_35 WHERE partner = "tiya rolle" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_16360 ( "No. in series" real, "No. in season" real, "Title" text, "Director" text, "Writer(s)" text, "Original air date" text, "Production code" text )
### Question ###
When did the episode title 'Duet For One' air?
### Accurate SQL ###
| SELECT "Original air date" FROM table_16360 WHERE "Title" = 'Duet for One' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_37 ( pos VARCHAR, weight INTEGER )
### Question ###
What is the pos with weight less than 205?
### Accurate SQL ###
| SELECT pos FROM table_name_37 WHERE weight < 205 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_24113 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Black Knights points" real, "Opponents" real, "Record" text )
### Question ###
Name the most game
### Accurate SQL ###
| SELECT MAX("Game") FROM table_24113 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE 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 )
### Question ###
what are the five most frequently given lab tests for patients who had previously received systemic antibiotics - metronidazole within the same hospital visit?
### Accurate SQL ###
| SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'systemic antibiotics - metronidazole') AS t1 JOIN (SELECT patient.uniquepid, lab.labname, lab.labresulttime, patient.patienthealthsystemstayid FROM lab JOIN patient ON lab.patientunitstayid = patient.patientunitstayid) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.treatmenttime < t2.labresulttime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid GROUP BY t2.labname) AS t3 WHERE t3.c1 <= 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 basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text )
TABLE: CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text )
### Question ###
Create a bar chart showing school_id across all neutral, and rank All_Neutral in descending order.
### Accurate SQL ###
| SELECT All_Neutral, School_ID FROM basketball_match ORDER BY All_Neutral 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 course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar )
TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int )
TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar )
TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar )
TABLE: CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments int, respected int, participation int, heavy_reading int, tough_grader int, hilarious int, would_take_again int, good_lecture int, no_skip int )
TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar )
TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar )
TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int )
TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar )
TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int )
TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int )
TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int )
TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar )
TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar )
TABLE: CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar )
TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int )
TABLE: CREATE TABLE area ( course_id int, area varchar )
TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar )
### Question ###
For fulfilling the MDE requirement , what 's the easiest class ?
### Accurate SQL ###
| SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%MDE%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 WHERE PROGRAM_COURSEalias1.category LIKE '%MDE%') |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE Courses (author_id VARCHAR, course_name VARCHAR)
TABLE: CREATE TABLE Course_Authors_and_Tutors (login_name VARCHAR, author_id VARCHAR)
### Question ###
Find the login name of the course author that teaches the course with name "advanced database".
### Accurate SQL ###
| SELECT T1.login_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = "advanced database" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (partner VARCHAR, date VARCHAR)
### Question ###
Which Partner has a Date of 12 july 2009?
### Accurate SQL ###
| SELECT partner FROM table_name_18 WHERE date = "12 july 2009" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_23 ( match VARCHAR, points VARCHAR, draw VARCHAR )
### Question ###
How many match values have points under 14 and 0 draws?
### Accurate SQL ###
| SELECT COUNT(match) FROM table_name_23 WHERE points < 14 AND draw < 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_90 (location VARCHAR, score VARCHAR)
### Question ###
What was the location of the game with a score of 2:3?
### Accurate SQL ###
| SELECT location FROM table_name_90 WHERE score = "2: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_name_1 (res VARCHAR, time VARCHAR)
### Question ###
In the round that lasted 0:20, what was the Res?
### Accurate SQL ###
| SELECT res FROM table_name_1 WHERE time = "0:20" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_203_255 ( id number, "no" number, "test no" number, "1st team" text, "2nd team" text, "winner" text, "margin" text, "toss" text, "bat" text, "date" text )
### Question ###
what year was the first game ?
### Accurate SQL ###
| SELECT "date" FROM table_203_255 WHERE id = 1 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_8 (republican_ticket VARCHAR, communist_ticket VARCHAR, socialist_ticket VARCHAR)
### Question ###
Who's the Republican ticket with a Communist ticket of (none), and a Socialist ticket of joseph g. glass?
### Accurate SQL ###
| SELECT republican_ticket FROM table_name_8 WHERE communist_ticket = "(none)" AND socialist_ticket = "joseph g. glass" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
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 intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
### Question ###
what was the last ward id of patient 030-40287 until 4 years ago?
### Accurate SQL ###
| SELECT patient.wardid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-40287') AND DATETIME(patient.unitadmittime) <= DATETIME(CURRENT_TIME(), '-4 year') ORDER BY patient.unitadmittime DESC LIMIT 1 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_34870 ( "Team" text, "Average" real, "Points" real, "Played" real, "1989-90" text, "1990-91" text, "1991-1992" real )
### Question ###
Which played number has an average of 1.026 and a 1989-90 that is 36?
### Accurate SQL ###
| SELECT "Played" FROM table_34870 WHERE "Average" > '1.026' AND "1989-90" = '36' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_27155678_2 (gene_name VARCHAR, genus_species VARCHAR)
### Question ###
Name the gene name for methylobacterium nodulans
### Accurate SQL ###
| SELECT gene_name FROM table_27155678_2 WHERE genus_species = "Methylobacterium nodulans" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_25664518_3 ( itv1_weekly_ranking INTEGER )
### Question ###
What is the maximum ITV1 weekly ranking?
### Accurate SQL ###
| SELECT MAX(itv1_weekly_ranking) FROM table_25664518_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_204_85 ( id number, "dates" text, "tournament" text, "host country" text, "winner" text, "notes" text )
### Question ###
what was the country listed the first time there was a new tournament ?
### Accurate SQL ###
| SELECT "host country" FROM table_204_85 WHERE "notes" = 'new tournament' ORDER BY id 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 program ( program_id int, name varchar, college varchar, introduction varchar )
TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int )
TABLE: CREATE TABLE 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 instructor ( instructor_id int, name varchar, uniqname 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 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 offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int )
TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar )
TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar )
TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int )
TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int )
TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar )
TABLE: CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar )
TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar )
TABLE: CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments int, respected int, participation int, heavy_reading int, tough_grader int, hilarious int, would_take_again int, good_lecture int, no_skip int )
TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar )
TABLE: CREATE TABLE area ( course_id int, area varchar )
TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int )
### Question ###
Is 493 available as a Monday / Wednesday class ?
### Accurate SQL ###
| SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course_offering.friday = 'N' AND course_offering.monday = 'Y' AND course_offering.thursday = 'N' AND course_offering.tuesday = 'N' AND course_offering.wednesday = 'Y' AND course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 493 AND semester.semester = 'WN' AND semester.semester_id = course_offering.semester AND semester.year = 2016 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_16430 ( "Rnd" real, "Race Name" text, "Pole position" text, "Fastest lap" text, "Winning driver" text, "Winning team" text, "Report" text )
### Question ###
Who had the fastest lap in the races won by Max Papis?
### Accurate SQL ###
| SELECT "Fastest lap" FROM table_16430 WHERE "Winning driver" = 'Max Papis' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_train_146 ( "id" int, "lymphocyte_count" int, "c_peptide_level" float, "vitamin_d_deficiency" bool, "diabetic" string, "vitamin_d" int, "NOUSE" float )
### Question ###
lymphocyte count < 500 / l
### Accurate SQL ###
| SELECT * FROM table_train_146 WHERE lymphocyte_count < 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 procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number )
TABLE: CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time )
TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text )
TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text )
TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time )
TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number )
TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text )
TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto 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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number )
TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time )
### Question ###
until 1 year ago, what are the five frequently ordered treatments for patients with age 40s?
### Accurate SQL ###
| SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 40 AND 49) AND DATETIME(procedures_icd.charttime) <= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 <= 5) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_26 ( pole INTEGER, podium VARCHAR, race VARCHAR, flap VARCHAR )
### Question ###
What was the pole for a race lower than 16 with a Flap higher than 8 and a podium higher than 11?
### Accurate SQL ###
| SELECT AVG(pole) FROM table_name_26 WHERE race < 16 AND flap > 8 AND podium > 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_49 ( voltage VARCHAR, model_number VARCHAR )
### Question ###
What's the voltage for the pentium dual-core e2140?
### Accurate SQL ###
| SELECT voltage FROM table_name_49 WHERE model_number = "pentium dual-core e2140" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_11800185_1 (no_of_sikhs VARCHAR, country VARCHAR)
### Question ###
What is the number of sikhs in Japan?
### Accurate SQL ###
| SELECT no_of_sikhs FROM table_11800185_1 WHERE country = "Japan" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_71455 ( "Call sign" text, "Frequency MHz" real, "City of license" text, "ERP W" real, "Class" text, "FCC info" text )
### Question ###
what is the highest frequency mhz with the call sign w292cu?
### Accurate SQL ###
| SELECT MAX("Frequency MHz") FROM table_71455 WHERE "Call sign" = 'w292cu' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use 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 (score VARCHAR, attendance VARCHAR)
### Question ###
What is the score of the game with 39,592 attendance?
### Accurate SQL ###
| SELECT score FROM table_name_19 WHERE attendance = "39,592" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1682026_3 (profits__billion_$_ VARCHAR, assets__billion_$_ VARCHAR)
### Question ###
What are the profits (in billions) where the assets are 192.8 billion?
### Accurate SQL ###
| SELECT profits__billion_$_ FROM table_1682026_3 WHERE assets__billion_$_ = "192.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_29327 ( "Greek national account" text, "1970" text, "1980" text, "1990" text, "1995" text, "1996" text, "1997" text, "1998" text, "1999" text, "2000" text, "2001 1" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text, "2013 2" text, "2014 2" text, "2015 3" text )
### Question ###
What is 1995 when 20011 is 45.8?
### Accurate SQL ###
| SELECT "1995" FROM table_29327 WHERE "2001 1" = '45.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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
### Question ###
give me the number of patients whose diagnoses short title is retention urine nos?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Retention urine NOS" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
How many patients on id route of drug administration had a hospital stay for more than 16 days?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "16" AND prescriptions.route = "ID" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_50 (first_edition VARCHAR, isbn VARCHAR)
### Question ###
Which first edition has an ISBN of 978-0785166252?
### Accurate SQL ###
| SELECT first_edition FROM table_name_50 WHERE isbn = "978-0785166252" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_29488 ( "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 ###
How many millions of US viewers were there for the episode 'No Safe Place'?
### Accurate SQL ###
| SELECT "U.S. viewers (millions)" FROM table_29488 WHERE "Title" = 'No Safe Place' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_49 ( melbourne VARCHAR, gold_coast VARCHAR, adelaide VARCHAR, auckland VARCHAR )
### Question ###
Name the melbourne for adelaide of no with auckland of yes and gold coast of yes
### Accurate SQL ###
| SELECT melbourne FROM table_name_49 WHERE adelaide = "no" AND auckland = "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_name_81 (lead VARCHAR, home VARCHAR)
### Question ###
Who is the lead of the team from Lockerbie?
### Accurate SQL ###
| SELECT lead FROM table_name_81 WHERE home = "lockerbie" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_62548 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" real )
### Question ###
What was the average money when the score was 68-69-68-72=277?
### Accurate SQL ###
| SELECT AVG("Money ( $ )") FROM table_62548 WHERE "Score" = '68-69-68-72=277' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_6990 ( "Administrative Panel" real, "Agricultural Panel" real, "Cultural and Educational Panel" real, "Industrial and Commercial Panel" real, "Labour Panel" real, "National University of Ireland" real, "University of Dublin" real, "Nominated by the Taoiseach" real, "Total" real )
### Question ###
What is the highest labour panel value with a cultural and educational panel greater than 1, a University of Dublin value greater than 0, and a total value less than 60?
### Accurate SQL ###
| SELECT MAX("Labour Panel") FROM table_6990 WHERE "Cultural and Educational Panel" > '1' AND "University of Dublin" > '0' AND "Total" < '60' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE 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 diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE 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 d_items ( row_id number, itemid number, label text, linksto text )
TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text )
TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text )
TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number )
TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number )
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 icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time )
TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time )
TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number )
### Question ###
provide me with the top five diagnoses that had the highest five year mortality rate.
### Accurate SQL ###
| SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t4.icd9_code FROM (SELECT t3.icd9_code, DENSE_RANK() OVER (ORDER BY t3.c1 DESC) AS c2 FROM (SELECT t2.icd9_code, 100 - SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t2.charttime) > 5 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) AS c1 FROM (SELECT t1.subject_id, t1.icd9_code, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.icd9_code, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id GROUP BY admissions.subject_id, diagnoses_icd.icd9_code HAVING MIN(diagnoses_icd.charttime) = diagnoses_icd.charttime) AS t1 WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', t1.charttime) > 5 * 365) AS t2 JOIN patients ON t2.subject_id = patients.subject_id GROUP BY t2.icd9_code) AS t3) AS t4 WHERE t4.c2 <= 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 member_of ( facid number, dno number, appt_type text )
TABLE: CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text )
TABLE: CREATE TABLE department ( dno number, division text, dname text, room text, building text, dphone number )
TABLE: CREATE TABLE course ( cid text, cname text, credits number, instructor number, days text, hours text, dno number )
TABLE: CREATE TABLE enrolled_in ( stuid number, cid text, grade text )
TABLE: CREATE TABLE minor_in ( stuid number, dno number )
TABLE: CREATE TABLE faculty ( facid number, lname text, fname text, rank text, sex text, phone number, room text, building text )
TABLE: CREATE TABLE gradeconversion ( lettergrade text, gradepoint number )
### Question ###
What are the full names of students minoring in department 140?
### Accurate SQL ###
| SELECT T2.fname, T2.lname FROM minor_in AS T1 JOIN student AS T2 ON T1.stuid = T2.stuid WHERE T1.dno = 140 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_10812938_5 ( cfl_team VARCHAR, college VARCHAR )
### Question ###
What's the team of the player from St. Francis Xavier College?
### Accurate SQL ###
| SELECT cfl_team FROM table_10812938_5 WHERE college = "St. Francis Xavier" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_59 ( silver VARCHAR, rank VARCHAR, total VARCHAR )
### Question ###
What is the total number of silver medals of the team ranked 7 with more than 1 total medal?
### Accurate SQL ###
| SELECT COUNT(silver) FROM table_name_59 WHERE rank = "7" AND total > 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_74960 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text )
### Question ###
Which Score has an Opponent of melanie south?
### Accurate SQL ###
| SELECT "Score" FROM table_74960 WHERE "Opponent" = 'melanie south' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE 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 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 medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
### Question ###
what is the change in the bedside glucose of patient 007-1517's value last measured on the first hospital visit compared to the value second to last measured on the first hospital visit?
### Accurate SQL ###
| SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-1517' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)) AND lab.labname = 'bedside glucose' ORDER BY lab.labresulttime DESC LIMIT 1) - (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-1517' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1)) AND lab.labname = 'bedside glucose' ORDER BY lab.labresulttime DESC LIMIT 1 OFFSET 1) |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_63 ( rank VARCHAR, bronze VARCHAR, silver VARCHAR )
### Question ###
What is the rank that has 1 bronze and 1 silver?
### Accurate SQL ###
| SELECT COUNT(rank) FROM table_name_63 WHERE bronze = 1 AND silver > 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_12834315_1 (muzzle_device VARCHAR, hand_guards VARCHAR)
### Question ###
What's the type of muzzle devices on the models with round hand guards?
### Accurate SQL ###
| SELECT muzzle_device FROM table_12834315_1 WHERE hand_guards = "Round" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE 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 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 ###
let me know both the short title and icd9 code of procedure of patient thomas nazario.
### Accurate SQL ###
| SELECT procedures.icd9_code, procedures.short_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Thomas Nazario" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_15340 ( "Client" text, "Years of Operation" text, "Area of Operation" text, "Country" text, "Services" text )
### Question ###
What years was soc a client?
### Accurate SQL ###
| SELECT "Years of Operation" FROM table_15340 WHERE "Client" = 'soc' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_20662 ( "Title" text, "Series" text, "Release" text, "Featuring" text, "Writer" text, "Director" text, "Length" text, "Timeline" text, "Release Date" text )
### Question ###
Who was the director of the audiobook released August 31, 2009?
### Accurate SQL ###
| SELECT "Director" FROM table_20662 WHERE "Release Date" = 'August 31, 2009' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_34 ( decile VARCHAR, area VARCHAR, authority VARCHAR, roll VARCHAR )
### Question ###
Which Decile has an Authority of state, a Roll smaller than 61, and an Area of kotemaori?
### Accurate SQL ###
| SELECT decile FROM table_name_34 WHERE authority = "state" AND roll < 61 AND area = "kotemaori" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number )
TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text )
TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE 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 icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time )
TABLE: CREATE TABLE 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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number )
TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time )
TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text )
TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time )
TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text )
### Question ###
tell me the top four diagnosis that has the highest two year mortality rate?
### Accurate SQL ###
| SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t4.icd9_code FROM (SELECT t3.icd9_code, DENSE_RANK() OVER (ORDER BY t3.c1 DESC) AS c2 FROM (SELECT t2.icd9_code, 100 - SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t2.charttime) > 2 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) AS c1 FROM (SELECT t1.subject_id, t1.icd9_code, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.icd9_code, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id GROUP BY admissions.subject_id, diagnoses_icd.icd9_code HAVING MIN(diagnoses_icd.charttime) = diagnoses_icd.charttime) AS t1 WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', t1.charttime) > 2 * 365) AS t2 JOIN patients ON t2.subject_id = patients.subject_id GROUP BY t2.icd9_code) AS t3) AS t4 WHERE t4.c2 <= 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_24037660_2 ( gtc_winning_team VARCHAR, lmp_winning_team VARCHAR )
### Question ###
What was the gtc winning team when lmp winning team was #8 drayson racing?
### Accurate SQL ###
| SELECT gtc_winning_team FROM table_24037660_2 WHERE lmp_winning_team = "#8 Drayson Racing" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_67475 ( "Matches" real, "Innings" real, "Not Outs" real, "Runs" real, "Average" real )
### Question ###
What's the total Innings that has Runs of 1598, and Matches less than 41?
### Accurate SQL ###
| SELECT COUNT("Innings") FROM table_67475 WHERE "Runs" = '1598' AND "Matches" < '41' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.