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 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 ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title 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_labitems ( row_id number, itemid number, label text ) TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) TABLE: CREATE TABLE procedures_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 outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value 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 patients ( row_id number, subject_id number, gender text, dob time, dod time ) TABLE: CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) ### Question ### list the four most frequent lab tests that were given to patients within 2 months after they were diagnosed with cellulitis of leg since 4 years ago. ### Accurate SQL ###
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'cellulitis of leg') AND DATETIME(diagnoses_icd.charttime) >= DATETIME(CURRENT_TIME(), '-4 year')) AS t1 JOIN (SELECT admissions.subject_id, labevents.itemid, labevents.charttime FROM labevents JOIN admissions ON labevents.hadm_id = admissions.hadm_id WHERE DATETIME(labevents.charttime) >= DATETIME(CURRENT_TIME(), '-4 year')) AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.charttime AND DATETIME(t2.charttime) BETWEEN DATETIME(t1.charttime) AND DATETIME(t1.charttime, '+2 month') GROUP BY t2.itemid) AS t3 WHERE t3.c1 <= 4)
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_35 ( d_47 VARCHAR, d_48 VARCHAR, d_42 VARCHAR ) ### Question ### Name the D 47 when it has a D 48 of d 49 and D 42 of r 42 ### Accurate SQL ###
SELECT d_47 FROM table_name_35 WHERE d_48 = "d 49" AND d_42 = "r 42"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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_15 (year VARCHAR, label VARCHAR, Nr VARCHAR) ### Question ### Which Year has a Label-Nr of 88146? ### Accurate SQL ###
SELECT year FROM table_name_15 WHERE label - Nr = 88146
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_7266 ( "Position" text, "Name" text, "Height (cm)" real, "Weight (kg)" real, "Birthdate" text, "Birthplace" text, "Previous Club/Team" text ) ### Question ### Which Position has a Name of john taft? ### Accurate SQL ###
SELECT "Position" FROM table_7266 WHERE "Name" = 'john taft'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_31987 ( "Year" real, "Album" text, "Song" text, "Label" text, "Catalog#" text, "Format" text, "Country" text ) ### Question ### Which song had Central Station as a label and whose album was Various - Wild Nights 4? ### Accurate SQL ###
SELECT "Song" FROM table_31987 WHERE "Label" = 'central station' AND "Album" = 'various - wild nights 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 patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) TABLE: CREATE TABLE 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 medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) ### Question ### what was the daily average intake of per iv flush: antecubital l 20 gauge that patient 006-122567 had received? ### Accurate SQL ###
SELECT AVG(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-122567')) AND intakeoutput.celllabel = 'per iv flush: antecubital l 20 gauge' AND intakeoutput.cellpath LIKE '%intake%' GROUP BY STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime)
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_17738 ( "Year" real, "Song title" text, "Artist" text, "Master recording ?" text, "Release date" text, "Single / Pack" text ) ### Question ### How many master recordings are there for 'Famous for Nothing'? ### Accurate SQL ###
SELECT COUNT("Master recording ?") FROM table_17738 WHERE "Song title" = 'Famous For Nothing'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ### Question ### provide the number of patients whose admission type is emergency and drug name is sodium polystyrene sulfonate? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND prescriptions.drug = "Sodium Polystyrene Sulfonate"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_27501971_2 (resultado VARCHAR, country VARCHAR) ### Question ### What was the resultado when E.E.U.U was the country? ### Accurate SQL ###
SELECT resultado FROM table_27501971_2 WHERE country = "E.E.U.U"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### 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 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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) TABLE: CREATE TABLE 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) ) ### Question ### For those employees who did not have any job in the past, visualize a scatter chart about the correlation between salary and department_id . ### Accurate SQL ###
SELECT SALARY, DEPARTMENT_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE purchases ( purchase_transaction_id number, purchase_details text ) TABLE: CREATE TABLE ref_transaction_types ( transaction_type_code text, transaction_type_description text ) TABLE: CREATE TABLE sales ( sales_transaction_id number, sales_details text ) TABLE: CREATE TABLE investors ( investor_id number, investor_details text ) TABLE: CREATE TABLE lots ( lot_id number, investor_id number, lot_details text ) TABLE: CREATE TABLE transactions ( transaction_id number, investor_id number, transaction_type_code text, date_of_transaction time, amount_of_transaction number, share_count text, other_details text ) TABLE: CREATE TABLE transactions_lots ( transaction_id number, lot_id number ) ### Question ### Show the transaction type code that occurs the most frequently. ### Accurate SQL ###
SELECT transaction_type_code FROM transactions GROUP BY transaction_type_code 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_52217 ( "Year" text, "Builder" text, "Motors" text, "Trailers" text, "Control Trailers" text ) ### Question ### Name the year for mcwf and control trailers of 35 ### Accurate SQL ###
SELECT "Year" FROM table_52217 WHERE "Builder" = 'mcwf' AND "Control Trailers" = '35'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE city (city VARCHAR, regional_population VARCHAR) ### Question ### Which three cities have the largest regional population? ### Accurate SQL ###
SELECT city FROM city ORDER BY regional_population DESC LIMIT 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_16922657_2 (w INTEGER) ### Question ### What is the minimum Wins a team has? ### Accurate SQL ###
SELECT MIN(w) FROM table_16922657_2
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_85 (total VARCHAR, e_score VARCHAR, a_score VARCHAR) ### Question ### What was the total score when the E score was larger than 9.6 and the A score was 6? ### Accurate SQL ###
SELECT total FROM table_name_85 WHERE e_score > 9.6 AND a_score = 6
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_66 ( away_team VARCHAR, home_team VARCHAR ) ### Question ### What is footscray's away team score? ### Accurate SQL ###
SELECT away_team AS score FROM table_name_66 WHERE home_team = "footscray"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_2402209_1 (no_of_barangays VARCHAR, area_coordinator VARCHAR) ### Question ### How many Barangays lived in the municipality with area coordinator of 110.95? ### Accurate SQL ###
SELECT no_of_barangays FROM table_2402209_1 WHERE area_coordinator = "110.95"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### what is the number of patients whose discharge location is snf and diagnoses long title is pneumonitis due to inhalation of food or vomitus? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.discharge_location = "SNF" AND diagnoses.long_title = "Pneumonitis due to inhalation of food or vomitus"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_13074 ( "Helium" text, "Neon" text, "Argon" text, "Krypton" text, "Xenon" text, "Radon" text ) ### Question ### What neon has an Argon of 4.203? ### Accurate SQL ###
SELECT "Neon" FROM table_13074 WHERE "Argon" = '4.203'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE submission ( Submission_ID int, Scores real, Author text, College text ) TABLE: CREATE TABLE workshop ( Workshop_ID int, Date text, Venue text, Name text ) TABLE: CREATE TABLE Acceptance ( Submission_ID int, Workshop_ID int, Result text ) ### Question ### A bar chart shows the venue for each workshop, sort how many venue in desc order. ### Accurate SQL ###
SELECT Venue, COUNT(Venue) FROM workshop GROUP BY Venue ORDER BY COUNT(Venue) 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_170961_2 ( census_ranking VARCHAR, population VARCHAR ) ### Question ### when the population was 1599, what was the census ranking? ### Accurate SQL ###
SELECT census_ranking FROM table_170961_2 WHERE population = 1599
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_52617 ( "Club" text, "Premier League" text, "Championship/First Division" text, "League One/Second Division" text, "League Two/Third Division" text ) ### Question ### I want the league one/second division for club of millwall ### Accurate SQL ###
SELECT "League One/Second Division" FROM table_52617 WHERE "Club" = 'millwall'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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 ( moving_to VARCHAR, transfer_fee VARCHAR, name VARCHAR ) ### Question ### Where is Odjidja-Ofoe, with an undisclosed transfer fee, moving to? ### Accurate SQL ###
SELECT moving_to FROM table_name_64 WHERE transfer_fee = "undisclosed" AND name = "odjidja-ofoe"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_24399615_4 (episode_no INTEGER, cable_rank VARCHAR) ### Question ### What episode number had a cable ranking of 8? ### Accurate SQL ###
SELECT MIN(episode_no) FROM table_24399615_4 WHERE cable_rank = "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_25044 ( "GDP (PPP) per capita 2010 TABLE: African/World rank 2010 TABLE: " text, "Nation" text, "GDP by agriculture 2010" text, "GDP by industry 2010" text, "GDP by services 2010" text, "Total GDP (PPP) 2010 TABLE: African/World rank 2010 TABLE: " text, "GDP real growth rate 2010" text ) ### Question ### Gdp per capita for malawi ### Accurate SQL ###
SELECT "GDP (PPP) per capita 2010; African/World rank 2010;" FROM table_25044 WHERE "Nation" = 'Malawi'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ### Question ### give me the number of patients whose ethnicity is black/cape verdean and diagnoses icd9 code is 1536? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND diagnoses.icd9_code = "1536"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_29171931_3 (incoming_head_coach VARCHAR, outgoing_head_coach VARCHAR) ### Question ### Who was the incoming head coach after Wan Jamak Wan Hassan quit the coaching job? ### Accurate SQL ###
SELECT incoming_head_coach FROM table_29171931_3 WHERE outgoing_head_coach = "Wan Jamak Wan Hassan"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_41437 ( "Date" text, "Location" text, "Country" text, "Event" text, "Winner" text, "Runner-up" text ) ### Question ### What is Date when Runner-up is Sof a Mul novich ( per )? ### Accurate SQL ###
SELECT "Date" FROM table_41437 WHERE "Runner-up" = 'sofía mulánovich ( per )'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_30 ( Id VARCHAR ) ### Question ### Name the 1821 with 1861 of 3733 ### Accurate SQL ###
SELECT 1821 FROM table_name_30 WHERE 1861 = "3733"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE 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 ) ### Question ### report the number of patients on ivpca route of drug administration who have been diagnosed with other specified procedures as the cause of abnormal reaction of patient, or of later complication, without mention of misadventure at time of procedure. ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Other specified procedures as the cause of abnormal reaction of patient, or of later complication, without mention of misadventure at time of procedure" AND prescriptions.route = "IVPCA"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_1974545_1 ( nickname VARCHAR, enrollment VARCHAR ) ### Question ### Name the nickname for enrollment being 9000 ### Accurate SQL ###
SELECT nickname FROM table_1974545_1 WHERE enrollment = 9000
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Customer_Orders ( order_id INTEGER, customer_id INTEGER, order_date DATETIME, order_status_code VARCHAR(15) ) TABLE: CREATE TABLE Products ( product_id INTEGER, product_type_code VARCHAR(15), product_name VARCHAR(80), product_price DOUBLE ) TABLE: CREATE TABLE Customers ( customer_id INTEGER, payment_method_code VARCHAR(15), customer_number VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80) ) TABLE: CREATE TABLE Order_Items ( order_item_id INTEGER, order_id INTEGER, product_id INTEGER, order_quantity VARCHAR(80) ) TABLE: CREATE TABLE Addresses ( address_id INTEGER, line_1_number_building VARCHAR(80), city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50) ) TABLE: CREATE TABLE Contacts ( contact_id INTEGER, customer_id INTEGER, gender VARCHAR(1), first_name VARCHAR(80), last_name VARCHAR(50), contact_phone VARCHAR(80) ) TABLE: CREATE TABLE Customer_Address_History ( customer_id INTEGER, address_id INTEGER, date_from DATETIME, date_to DATETIME ) ### Question ### Show the number of customer address history in each day and group by date to with a line chart. ### Accurate SQL ###
SELECT date_to, COUNT(date_to) FROM Customer_Address_History AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id JOIN Addresses AS T3 ON T1.address_id = T3.address_id GROUP BY date_to
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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_42 (result VARCHAR, game VARCHAR) ### Question ### What was the result of game 3? ### Accurate SQL ###
SELECT result FROM table_name_42 WHERE game = "game 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_20503 ( "Bowl Game" text, "Date" text, "Stadium" text, "City" text, "Television" text, "Conference Matchups" text, "Payout ( US$ )" text ) ### Question ### What teams played in the Capital One bowl game on January 1, 2009? ### Accurate SQL ###
SELECT "Conference Matchups" FROM table_20503 WHERE "Date" = 'January 1, 2009' AND "Bowl Game" = 'Capital 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_2093995_1 (parking VARCHAR, city__neighborhood VARCHAR, stations VARCHAR) ### Question ### How much parking is in Van Nuys at the Sepulveda station? ### Accurate SQL ###
SELECT parking FROM table_2093995_1 WHERE city__neighborhood = "Van Nuys" AND stations = "Sepulveda"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE minor_in ( stuid number, dno number ) TABLE: CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) 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 ) TABLE: CREATE TABLE member_of ( facid number, dno number, appt_type text ) TABLE: CREATE TABLE enrolled_in ( stuid number, cid text, grade 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 ) ### Question ### Find the first name and last name of the instructor of course that has course name ### Accurate SQL ###
SELECT T2.fname, T2.lname FROM course AS T1 JOIN faculty AS T2 ON T1.instructor = T2.facid WHERE T1.cname = "COMPUTER LITERACY"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_43117 ( "Team" text, "Country" text, "Home" text, "Skip" text, "Third" text, "Second" text, "Lead" text ) ### Question ### For what country is the skip Andy Kapp? ### Accurate SQL ###
SELECT "Country" FROM table_43117 WHERE "Skip" = 'andy kapp'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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 (losses INTEGER, win__percentage VARCHAR, no_result VARCHAR) ### Question ### What is the number of losses for the game with a win % of 71.43%, and No Result is more than 0? ### Accurate SQL ###
SELECT SUM(losses) FROM table_name_23 WHERE win__percentage = "71.43%" AND no_result > 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 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 ### provide the number of patients less than 48 years who are diagnosed with vascular hamartomas. ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "48" AND diagnoses.long_title = "Vascular hamartomas"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE festival_detail ( festival_id number, festival_name text, chair_name text, location text, year number, num_of_audience number ) TABLE: CREATE TABLE nomination ( artwork_id number, festival_id number, result text ) TABLE: CREATE TABLE artwork ( artwork_id number, type text, name text ) ### Question ### What is the average number of audience for festivals? ### Accurate SQL ###
SELECT AVG(num_of_audience) FROM festival_detail
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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 ( label VARCHAR, region VARCHAR, date VARCHAR ) ### Question ### What is the label for the UK in 1996? ### Accurate SQL ###
SELECT label FROM table_name_34 WHERE region = "uk" AND date = "1996"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_11161 ( "Date" text, "Venue" text, "Result" text, "Win/ Loss/ Draw" text, "Competition" text ) ### Question ### Which competition had a result of 1-0? ### Accurate SQL ###
SELECT "Competition" FROM table_11161 WHERE "Result" = '1-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_81 ( award VARCHAR, result VARCHAR, production VARCHAR ) ### Question ### Which award was An Officer and a Gentleman nominated for? ### Accurate SQL ###
SELECT award FROM table_name_81 WHERE result = "nominated" AND production = "an officer and a gentleman"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_18118221_1 (location VARCHAR, total_passengers__millions__2011_12 VARCHAR) ### Question ### Which location has 103.534 million passengers in 2011-12? ### Accurate SQL ###
SELECT location FROM table_18118221_1 WHERE total_passengers__millions__2011_12 = "103.534"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_course ( program_id int, course_id int, workload int, category 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 requirement ( requirement_id int, requirement varchar, college varchar ) TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) TABLE: CREATE TABLE course_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 gsi ( course_offering_id int, student_id int ) TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int ) TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int ) TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) TABLE: CREATE TABLE area ( course_id int, area 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 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 ta ( campus_job_id int, student_id int, location varchar ) TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname 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 ) ### Question ### Name for me all PreMajor classes . ### Accurate SQL ###
SELECT DISTINCT course.department, course.name, course.number FROM course, program, program_course WHERE program_course.category LIKE '%PreMajor%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_id = program_course.program_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_68 ( call_sign VARCHAR, erp_w VARCHAR ) ### Question ### What was the call sign for ERP W of 99? ### Accurate SQL ###
SELECT call_sign FROM table_name_68 WHERE erp_w = 99
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_14006_1 (condition VARCHAR, bleeding_time VARCHAR, prothrombin_time VARCHAR) ### Question ### what's the condition with bleeding time being unaffected and prothrombin time being prolonged ### Accurate SQL ###
SELECT condition FROM table_14006_1 WHERE bleeding_time = "Unaffected" AND prothrombin_time = "Prolonged"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_13018116_1 ( pts_agst INTEGER, pts_for VARCHAR ) ### Question ### Name the most points against when points for is 860 ### Accurate SQL ###
SELECT MAX(pts_agst) FROM table_13018116_1 WHERE pts_for = 860
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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_409 ( id number, "date" text, "race name" text, "location" text, "uci rating" number, "winner" text, "team" text ) ### Question ### what is the name of the last race ? ### Accurate SQL ###
SELECT "race name" FROM table_204_409 ORDER BY id 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_1725413_5 (open_era VARCHAR, first_title VARCHAR) ### Question ### How many open era titles does the team with their first title in 1925 have? ### Accurate SQL ###
SELECT open_era FROM table_1725413_5 WHERE first_title = 1925
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE PERFORMERS ( Customer_Phone VARCHAR, Customer_Name VARCHAR ) ### Question ### What is the phone number of the performer Ashley? ### Accurate SQL ###
SELECT Customer_Phone FROM PERFORMERS WHERE Customer_Name = "Ashley"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ### Question ### count the number of patients whose primary disease is aortic valve insufficiency/aortic valve replacement/sda and lab test fluid is blood. ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" AND lab.fluid = "Blood"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_2 (week INTEGER, date VARCHAR, attendance VARCHAR) ### Question ### what is the lowest week when the date is september 16, 1979 and the attendance less than 54,212? ### Accurate SQL ###
SELECT MIN(week) FROM table_name_2 WHERE date = "september 16, 1979" AND attendance < 54 OFFSET 212
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_46 ( notes VARCHAR, athlete VARCHAR ) ### Question ### What is listed in notes for the athlete, lassi karonen? ### Accurate SQL ###
SELECT notes FROM table_name_46 WHERE athlete = "lassi karonen"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_57851 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) ### Question ### Where was the game played when Geelong was the away team? ### Accurate SQL ###
SELECT "Venue" FROM table_57851 WHERE "Away team" = 'geelong'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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 (third VARCHAR, nation VARCHAR) ### Question ### Who came in third in England? ### Accurate SQL ###
SELECT third FROM table_name_60 WHERE nation = "england"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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_69 ( constructor VARCHAR, race VARCHAR ) ### Question ### Name the constructor for the belgian grand prix ### Accurate SQL ###
SELECT constructor FROM table_name_69 WHERE race = "belgian 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 climber ( climber_id number, name text, country text, time text, points number, mountain_id number ) TABLE: CREATE TABLE mountain ( mountain_id number, name text, height number, prominence number, range text, country text ) ### Question ### Show the times used by climbers to climb mountains in Country Uganda. ### Accurate SQL ###
SELECT T1.time FROM climber AS T1 JOIN mountain AS T2 ON T1.mountain_id = T2.mountain_id WHERE T2.country = "Uganda"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_36833 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Venue" text, "Attendance" text, "Record" text ) ### Question ### What is the largest week number for the venue of League Park for the date of November 25, 1920? ### Accurate SQL ###
SELECT MAX("Week") FROM table_36833 WHERE "Venue" = 'league park' AND "Date" = 'november 25, 1920'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_20181270_3 (landesliga_mitte VARCHAR, bayernliga VARCHAR) ### Question ### Name the landesliga mitte sv türk gücü münchen ### Accurate SQL ###
SELECT landesliga_mitte FROM table_20181270_3 WHERE bayernliga = "SV Türk Gücü München"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) TABLE: CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) ### Question ### What are the average prices of products, grouped by manufacturer name, could you show in desc by the y-axis? ### Accurate SQL ###
SELECT T2.Name, AVG(T1.Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY AVG(T1.Price) 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_62 (rank VARCHAR, games VARCHAR, team VARCHAR, points VARCHAR) ### Question ### What's the rank of the Tau Cerámica that has 377 points and more than 21 games? ### Accurate SQL ###
SELECT COUNT(rank) FROM table_name_62 WHERE team = "tau cerámica" AND points = 377 AND games > 21
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_8102 ( "Distance" text, "Time" text, "Date" text, "Location" text, "Notes" text ) ### Question ### Which Date has Notes of notes? ### Accurate SQL ###
SELECT "Date" FROM table_8102 WHERE "Notes" = 'notes'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_158 ( "Team" text, "Stadium" text, "Capacity" real, "Lowest" real, "Highest" real, "Average" real ) ### Question ### What are the highest recorded attendance rates of the stadiums with an average attendance of 4752? ### Accurate SQL ###
SELECT "Highest" FROM table_158 WHERE "Average" = '4752'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight real ) TABLE: CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate real ) ### Question ### Show weight from each date of birth, and I want to rank in asc by the y axis please. ### Accurate SQL ###
SELECT Date_of_Birth, Weight FROM people ORDER BY Weight
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_80221 ( "Year" real, "Alabama" text, "Arkansas" text, "Auburn" text, "Ole Miss" text, "Mississippi St." text ) ### Question ### Who was the Alabama player associated with Walt Harris? ### Accurate SQL ###
SELECT "Alabama" FROM table_80221 WHERE "Mississippi St." = 'walt harris'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_41 (significand VARCHAR, number_of_decimal_digits VARCHAR, total_bits VARCHAR) ### Question ### What's the total number of signicand with ~34.0 decimal digits and more than 128 total bits? ### Accurate SQL ###
SELECT COUNT(significand) FROM table_name_41 WHERE number_of_decimal_digits = "~34.0" AND total_bits > 128
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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 ( gpu_model VARCHAR, frequency VARCHAR, sspec_number VARCHAR ) ### Question ### what is the gpu model when the frequency is 3.4 ghz and the sspec number is sr00b(d2)? ### Accurate SQL ###
SELECT gpu_model FROM table_name_8 WHERE frequency = "3.4 ghz" AND sspec_number = "sr00b(d2)"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_22 ( position VARCHAR, college VARCHAR ) ### Question ### What position did the CFL player drafted out of college of toronto in 2007 play? ### Accurate SQL ###
SELECT position FROM table_name_22 WHERE college = "toronto"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_45126 ( "Player" text, "Wkts" real, "Runs" real, "Econ" real, "Ovrs" real ) ### Question ### what is the sum of the wkts when the ovrs were bigger than 2 and econ was bigger than 7.84? ### Accurate SQL ###
SELECT SUM("Wkts") FROM table_45126 WHERE "Ovrs" > '2' AND "Econ" > '7.84'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_50675 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" text, "Finish" text ) ### Question ### What was the finish for the golfer with a total of 285? ### Accurate SQL ###
SELECT "Finish" FROM table_50675 WHERE "Total" = '285'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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 ( country VARCHAR, notes VARCHAR, rank VARCHAR ) ### Question ### What country has a rank of 3 and notes of r? ### Accurate SQL ###
SELECT country FROM table_name_97 WHERE notes = "r" AND rank = 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_27 (outcome VARCHAR, surface VARCHAR) ### Question ### What is the outcome of the match played on carpet surface? ### Accurate SQL ###
SELECT outcome FROM table_name_27 WHERE surface = "carpet"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_22103 ( "Rank" real, "Airport Name" text, "Location" text, "IATA Code" text, "Tonnes" text, "% Chg. 2010/11" text ) ### Question ### What rank is the airport whose IATA Code is JFK? ### Accurate SQL ###
SELECT "Rank" FROM table_22103 WHERE "IATA Code" = 'JFK'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_74887 ( "Year" real, "Location" text, "Gold" text, "Silver" text, "Bronze" text ) ### Question ### What's the lowest Year with the Location of Bangkok? ### Accurate SQL ###
SELECT MIN("Year") FROM table_74887 WHERE "Location" = 'bangkok'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_73 ( round3 INTEGER, round4 VARCHAR ) ### Question ### what is the lowest round3 when round4 is 37? ### Accurate SQL ###
SELECT MIN(round3) FROM table_name_73 WHERE round4 = 37
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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_34 ( id number, "season" text, "appearance" number, "interchange" number, "tries" number, "goals" number, "f/g" number, "points" number ) ### Question ### which team name had the most goals in a year -lrb- bulldogs , roosters , tigers -rrb- ### Accurate SQL ###
SELECT "season" FROM table_203_34 WHERE "season" IN ('bulldogs', 'roosters', 'tigers') GROUP BY "season" ORDER BY SUM("goals") 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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) ### Question ### provide the discharge location of edward schafer. ### Accurate SQL ###
SELECT demographic.discharge_location FROM demographic WHERE demographic.name = "Edward Schafer"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### 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 chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE procedures_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 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 microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) ### Question ### get the id of the patients who had been diagnosed with prim central sleep apnea until 2104. ### Accurate SQL ###
SELECT admissions.subject_id FROM admissions WHERE admissions.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'prim central sleep apnea') AND STRFTIME('%y', diagnoses_icd.charttime) <= '2104')
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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_22 ( "id" int, "pre_treatment_with_hydroxyethyl_starch" int, "requiring_dialysis" bool, "intracerebral_hemorrhage" bool, "serum_creatinine" float, "kidney_disease" bool, "allergy_to_hydroxyethyl_starch" bool, "age" float, "NOUSE" float ) ### Question ### age < 18 years ### Accurate SQL ###
SELECT * FROM table_train_22 WHERE age < 18
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_15 (date VARCHAR, away VARCHAR) ### Question ### What is the Date with an Away that is central blues? ### Accurate SQL ###
SELECT date FROM table_name_15 WHERE away = "central blues"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Rooms ( RoomId VARCHAR, roomName VARCHAR, basePrice VARCHAR ) ### Question ### Find the id and name of the most expensive base price room. ### Accurate SQL ###
SELECT RoomId, roomName FROM Rooms ORDER BY basePrice 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 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 ) 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) ) ### Question ### Return the average price of products that have each category code. ### Accurate SQL ###
SELECT product_category_code, AVG(product_price) FROM Products GROUP BY product_category_code
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_77 ( nation VARCHAR, gold VARCHAR, silver VARCHAR, bronze VARCHAR ) ### Question ### Which Nation has Silver smaller than 16, Bronze larger than 6, and Gold of 2? ### Accurate SQL ###
SELECT nation FROM table_name_77 WHERE silver < 16 AND bronze > 6 AND 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 table_6196 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" real, "Finish" text ) ### Question ### Name the most total with to par more than 16 ### Accurate SQL ###
SELECT MAX("Total") FROM table_6196 WHERE "To par" > '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 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 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 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 ### give me the number of patients whose ethnicity is white and lab test name is prot. electrophoresis, urine? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "WHITE" AND lab.label = "Prot. Electrophoresis, Urine"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_51499 ( "Pick" real, "Round" text, "Player" text, "Position" text, "School" text ) ### Question ### What's terry jones' lowest pick? ### Accurate SQL ###
SELECT MIN("Pick") FROM table_51499 WHERE "Player" = 'terry jones'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) TABLE: CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) ### Question ### For those records from the products and each product's manufacturer, return a bar chart about the distribution of founder and the sum of code , and group by attribute founder, and I want to sort by the Y-axis in desc. ### Accurate SQL ###
SELECT T2.Founder, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Founder ORDER BY T1.Code DESC
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### how many patients with diagnoses icd9 code 4210 have additive type drug prescription? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "4210" AND prescriptions.drug_type = "ADDITIVE"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_7967 ( "Player" text, "League" real, "Scottish Cup" real, "League Cup" real, "Challenge Cup" real, "Total" real ) ### Question ### What is the sum for the Scottish cup that has player Damon Gray, and more than 1 league? ### Accurate SQL ###
SELECT SUM("Scottish Cup") FROM table_7967 WHERE "Player" = 'damon gray' AND "League" > '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_28846752_4 (innings INTEGER, highest_score VARCHAR) ### Question ### What is the innings when the highest score is 72? ### Accurate SQL ###
SELECT MAX(innings) FROM table_28846752_4 WHERE highest_score = "72"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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_55 (country VARCHAR, director_s_ VARCHAR) ### Question ### Julio Robledo represents which country? ### Accurate SQL ###
SELECT country FROM table_name_55 WHERE director_s_ = "julio robledo"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_56522 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) ### Question ### Which away team has an away team score of 11.16 (82)? ### Accurate SQL ###
SELECT "Away team" FROM table_56522 WHERE "Away team score" = '11.16 (82)'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_53630 ( "Rank" real, "Name" text, "Team" text, "Games" real, "Points" real ) ### Question ### What is the least amount of games for Luis scola with a rank greater than 1? ### Accurate SQL ###
SELECT MIN("Games") FROM table_53630 WHERE "Rank" > '1' AND "Name" = 'luis scola'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_12 (bronze VARCHAR, silver INTEGER) ### Question ### What is the total when bronze has a silver larger than 2? ### Accurate SQL ###
SELECT COUNT(bronze) FROM table_name_12 WHERE silver > 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 d_items ( row_id number, itemid number, label text, linksto text ) TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE 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 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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount 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 microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name 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 admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) ### Question ### how many hours is it since patient 53176 last received the glucose lab test in their current hospital encounter? ### Accurate SQL ###
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', labevents.charttime)) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'glucose') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 53176 AND admissions.dischtime IS NULL) ORDER BY labevents.charttime DESC LIMIT 1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_63 (to_par VARCHAR, place VARCHAR, score VARCHAR) ### Question ### What is the To par of the T4 Place Player with a Score of 72-69-73=214? ### Accurate SQL ###
SELECT to_par FROM table_name_63 WHERE place = "t4" AND score = 72 - 69 - 73 = 214
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_13 (launched VARCHAR, completed VARCHAR) ### Question ### What is the launched date of the destroyer completed 25 February 1936? ### Accurate SQL ###
SELECT launched FROM table_name_13 WHERE completed = "25 february 1936"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use 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 (events INTEGER, top_25 VARCHAR, cuts_made VARCHAR) ### Question ### How many events have a Top-25 of 1 and made less than 1 cut? ### Accurate SQL ###
SELECT MAX(events) FROM table_name_38 WHERE top_25 = 1 AND cuts_made < 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_86 ( recording VARCHAR, year VARCHAR ) ### Question ### Name the recording for 2012 ### Accurate SQL ###
SELECT recording FROM table_name_86 WHERE year = "2012"