schema
stringlengths
28
5.65k
question
stringlengths
0
990
rejected
stringlengths
2
4.44k
chosen
stringlengths
4
9.17k
weight
float64
0
8.95
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) 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) 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)
what is the number of patients whose discharge location is disc-tran cancer/chldrn h and procedure icd9 code is 3961?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "DISC-TRAN CANCER/CHLDRN H" AND procedures.icd9_code = "3961"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "3961" = "procedures"."icd9_code" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "DISC-TRAN CANCER/CHLDRN H" = "demographic"."discharge_location"
0.241211
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
compared to last measured on the last hospital visit is the bedside glucose of patient 013-23115 greater than second to last measured on the last hospital visit?
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 = '013-23115' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC 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 = '013-23115' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1)) AND lab.labname = 'bedside glucose' ORDER BY lab.labresulttime DESC LIMIT 1 OFFSET 1)
SELECT (SELECT "lab"."labresult" FROM "lab" WHERE "lab"."labname" = 'bedside glucose' AND "lab"."patientunitstayid" IN (SELECT "patient"."patientunitstayid" FROM "patient" WHERE "patient"."patienthealthsystemstayid" IN (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '013-23115' AND NOT "patient"."hospitaldischargetime" IS NULL ORDER BY "patient"."hospitaladmittime" DESC NULLS LAST LIMIT 1)) ORDER BY "lab"."labresulttime" DESC NULLS LAST LIMIT 1) > (SELECT "lab"."labresult" FROM "lab" WHERE "lab"."labname" = 'bedside glucose' AND "lab"."patientunitstayid" IN (SELECT "patient"."patientunitstayid" FROM "patient" WHERE "patient"."patienthealthsystemstayid" IN (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '013-23115' AND NOT "patient"."hospitaldischargetime" IS NULL ORDER BY "patient"."hospitaladmittime" DESC NULLS LAST LIMIT 1)) ORDER BY "lab"."labresulttime" DESC NULLS LAST LIMIT 1 OFFSET 1)
0.96582
CREATE TABLE table_name_61 (home_team VARCHAR, away_team VARCHAR)
Who was the home team when Hawthorn was the away team?
SELECT home_team FROM table_name_61 WHERE away_team = "hawthorn"
SELECT "home_team" FROM "table_name_61" WHERE "away_team" = "hawthorn"
0.068359
CREATE TABLE table_75797 ("Television service" TEXT, "Country" TEXT, "Language" TEXT, "Content" TEXT, "HDTV" TEXT, "Package/Option" TEXT)
What is Package/Option, when Content is Tennis?
SELECT "Package/Option" FROM table_75797 WHERE "Content" = 'tennis'
SELECT "Package/Option" FROM "table_75797" WHERE "Content" = 'tennis'
0.067383
CREATE TABLE table_34312 ("Position" TEXT, "Name" TEXT, "School" TEXT, "Unanimous" TEXT, "College Hall of Fame" TEXT)
What School has no no no Unanimously?
SELECT "School" FROM table_34312 WHERE "Unanimous" = 'no no no'
SELECT "School" FROM "table_34312" WHERE "Unanimous" = 'no no no'
0.063477
CREATE TABLE table_name_28 (seasons INT, spells VARCHAR, drawn VARCHAR, rank VARCHAR)
What is the highest season number with 57 draws, rank 20, and more than 1 spell?
SELECT MAX(seasons) FROM table_name_28 WHERE drawn = 57 AND rank = 20 AND spells > 1
SELECT MAX("seasons") FROM "table_name_28" WHERE "drawn" = 57 AND "rank" = 20 AND "spells" > 1
0.091797
CREATE TABLE table_dev_51 ("id" INT, "gender" TEXT, "antihypertensive_agents" BOOLEAN, "systolic_blood_pressure_sbp" INT, "hemoglobin_a1c_hba1c" FLOAT, "obesity" BOOLEAN, "diastolic_blood_pressure_dbp" INT, "body_mass_index_bmi" FLOAT, "hypertension" BOOLEAN, "prehypertension" BOOLEAN, "age" FLOAT, "glycosylated_hemoglobin" FLOAT, "NOUSE" FLOAT)
glycosylated hemoglobin ( hba1c ) > 9 %
SELECT * FROM table_dev_51 WHERE glycosylated_hemoglobin > 9 OR hemoglobin_a1c_hba1c > 9
SELECT * FROM "table_dev_51" WHERE "glycosylated_hemoglobin" > 9 OR "hemoglobin_a1c_hba1c" > 9
0.091797
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT)
when was the first laboratory test patient 002-58884 received last month?
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-58884')) AND DATETIME(lab.labresulttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY lab.labresulttime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '002-58884' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT "lab"."labresulttime" FROM "lab" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "lab"."patientunitstayid" WHERE DATETIME("lab"."labresulttime", 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') AND NOT "_u_1"."" IS NULL ORDER BY "lab"."labresulttime" NULLS FIRST LIMIT 1
0.639648
CREATE TABLE employees (EMPLOYEE_ID DECIMAL, FIRST_NAME VARCHAR, LAST_NAME VARCHAR, EMAIL VARCHAR, PHONE_NUMBER VARCHAR, HIRE_DATE DATE, JOB_ID VARCHAR, SALARY DECIMAL, COMMISSION_PCT DECIMAL, MANAGER_ID DECIMAL, DEPARTMENT_ID DECIMAL) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR)
For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of hire_date and the average of employee_id bin hire_date by weekday, and order by the Y-axis from high to low.
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(EMPLOYEE_ID) DESC
SELECT "HIRE_DATE", AVG("EMPLOYEE_ID") FROM "employees" WHERE NOT "DEPARTMENT_ID" IN (SELECT "DEPARTMENT_ID" FROM "departments" WHERE "MANAGER_ID" <= 200 AND "MANAGER_ID" >= 100) ORDER BY AVG("EMPLOYEE_ID") DESC NULLS LAST
0.216797
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
how many days was it since patient 95892 stayed in ward 14 for the first time on this hospital visit?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 95892 AND admissions.dischtime IS NULL)) AND transfers.wardid = 14 ORDER BY transfers.intime LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."dischtime" IS NULL AND "admissions"."subject_id" = 95892 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id") SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "transfers"."intime")) FROM "transfers" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "transfers"."icustay_id" WHERE "transfers"."wardid" = 14 AND NOT "_u_1"."" IS NULL ORDER BY "transfers"."intime" NULLS FIRST LIMIT 1
0.59375
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) CREATE TABLE university (School_ID INT, School TEXT, Location TEXT, Founded FLOAT, Affiliation TEXT, Enrollment FLOAT, Nickname TEXT, Primary_conference TEXT)
Draw a bar chart of affiliation versus sum enrollment, I want to show by the sum enrollment in desc.
SELECT Affiliation, SUM(Enrollment) FROM university GROUP BY Affiliation ORDER BY SUM(Enrollment) DESC
SELECT "Affiliation", SUM("Enrollment") FROM "university" GROUP BY "Affiliation" ORDER BY SUM("Enrollment") DESC NULLS LAST
0.120117
CREATE TABLE table_34711 ("Year" TEXT, "National Champion" TEXT, "Runner-Up" TEXT, "Location" TEXT, "Host" TEXT)
In what Year was Rhode Island the National Champion?
SELECT "Year" FROM table_34711 WHERE "National Champion" = 'rhode island'
SELECT "Year" FROM "table_34711" WHERE "National Champion" = 'rhode island'
0.073242
CREATE TABLE table_27913160_3 (pole_position VARCHAR, race VARCHAR)
Who had the pole position in Detroit?
SELECT pole_position FROM table_27913160_3 WHERE race = "Detroit"
SELECT "pole_position" FROM "table_27913160_3" WHERE "Detroit" = "race"
0.069336
CREATE TABLE table_204_539 (id DECIMAL, "date" TEXT, "name" TEXT, "moving from" TEXT, "moving to" TEXT, "fee" TEXT)
what is the most fee charged ?
SELECT MAX("fee") FROM table_204_539
SELECT MAX("fee") FROM "table_204_539"
0.037109
CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
how much of patient 035-2205's change in sao2 second measured on the last intensive care unit visit compared to the value first measured on the last intensive care unit visit?
SELECT (SELECT vitalperiodic.sao2 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-2205') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1) AND NOT vitalperiodic.sao2 IS NULL ORDER BY vitalperiodic.observationtime LIMIT 1 OFFSET 1) - (SELECT vitalperiodic.sao2 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-2205') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1) AND NOT vitalperiodic.sao2 IS NULL ORDER BY vitalperiodic.observationtime LIMIT 1)
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '035-2205' GROUP BY "patienthealthsystemstayid") SELECT (SELECT "vitalperiodic"."sao2" FROM "vitalperiodic" WHERE "vitalperiodic"."patientunitstayid" IN (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL AND NOT "patient"."unitdischargetime" IS NULL ORDER BY "patient"."unitadmittime" DESC NULLS LAST LIMIT 1) AND NOT "vitalperiodic"."sao2" IS NULL ORDER BY "vitalperiodic"."observationtime" NULLS FIRST LIMIT 1 OFFSET 1) - (SELECT "vitalperiodic"."sao2" FROM "vitalperiodic" WHERE "vitalperiodic"."patientunitstayid" IN (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_3" ON "_u_3"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_3"."" IS NULL AND NOT "patient"."unitdischargetime" IS NULL ORDER BY "patient"."unitadmittime" DESC NULLS LAST LIMIT 1) AND NOT "vitalperiodic"."sao2" IS NULL ORDER BY "vitalperiodic"."observationtime" NULLS FIRST LIMIT 1)
1.080078
CREATE TABLE table_22673872_1 (location VARCHAR, pole_position VARCHAR)
Which locations did Gordon Johncock hold the pole position?
SELECT location FROM table_22673872_1 WHERE pole_position = "Gordon Johncock"
SELECT "location" FROM "table_22673872_1" WHERE "Gordon Johncock" = "pole_position"
0.081055
CREATE TABLE table_39585 ("Player" TEXT, "Touchdowns" FLOAT, "Extra points" FLOAT, "Field goals" FLOAT, "Points" FLOAT)
How many touchdowns were scored by William Cole?
SELECT "Touchdowns" FROM table_39585 WHERE "Player" = 'william cole'
SELECT "Touchdowns" FROM "table_39585" WHERE "Player" = 'william cole'
0.068359
CREATE TABLE county (County_Id INT, County_name TEXT, Population FLOAT, Zip_code TEXT) CREATE TABLE election (Election_ID INT, Counties_Represented TEXT, District INT, Delegate TEXT, Party INT, First_Elected FLOAT, Committee TEXT) CREATE TABLE party (Party_ID INT, Year FLOAT, Party TEXT, Governor TEXT, Lieutenant_Governor TEXT, Comptroller TEXT, Attorney_General TEXT, US_Senate TEXT)
Show the name of each party and the corresponding number of delegates from that party in a bar chart, order by the bars from high to low.
SELECT T2.Party, AVG(COUNT(*)) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T2.Party ORDER BY T2.Party DESC
SELECT "T2"."Party", AVG(COUNT(*)) FROM "election" AS "T1" JOIN "party" AS "T2" ON "T1"."Party" = "T2"."Party_ID" GROUP BY "T2"."Party" ORDER BY "T2"."Party" DESC NULLS LAST
0.168945
CREATE TABLE table_name_12 (bronze INT, rank VARCHAR, total VARCHAR, silver VARCHAR)
I want the average bronze for total of 19 and silver of 8 with rank of 31
SELECT AVG(bronze) FROM table_name_12 WHERE total = 19 AND silver = 8 AND rank = "31"
SELECT AVG("bronze") FROM "table_name_12" WHERE "31" = "rank" AND "silver" = 8 AND "total" = 19
0.092773
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) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) 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)
Calculate the average age of patients who have left femur fracture primary disease and are 80 years or older.
SELECT AVG(demographic.age) FROM demographic WHERE demographic.diagnosis = "LEFT FEMUR FRACTURE" AND demographic.age >= "80"
SELECT AVG("demographic"."age") FROM "demographic" WHERE "80" <= "demographic"."age" AND "LEFT FEMUR FRACTURE" = "demographic"."diagnosis"
0.134766
CREATE TABLE table_204_824 (id DECIMAL, "no." DECIMAL, "train no:" TEXT, "origin" TEXT, "destination" TEXT, "train name" TEXT)
the number of passenger trains that left mangalore central is how many ?
SELECT COUNT(*) FROM table_204_824 WHERE "train name" = 'passenger'
SELECT COUNT(*) FROM "table_204_824" WHERE "train name" = 'passenger'
0.067383
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) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) 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) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
find out the number of patients who have oral route of drug administration and procedure icd9 code 8968.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE procedures.icd9_code = "8968" AND prescriptions.route = "ORAL"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "ORAL" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" JOIN "procedures" ON "8968" = "procedures"."icd9_code" AND "demographic"."hadm_id" = "procedures"."hadm_id"
0.282227
CREATE TABLE table_6976 ("Date" TEXT, "Tournament" TEXT, "Surface" TEXT, "Partnering" TEXT, "Opponents in the final" TEXT, "Score" TEXT)
What was the score of the game with Nathalie Tauziat as a partner?
SELECT "Score" FROM table_6976 WHERE "Partnering" = 'nathalie tauziat'
SELECT "Score" FROM "table_6976" WHERE "Partnering" = 'nathalie tauziat'
0.070313
CREATE TABLE manufacturers (code DECIMAL, name TEXT, headquarter TEXT, founder TEXT, revenue DECIMAL) CREATE TABLE products (code DECIMAL, name TEXT, price DECIMAL, manufacturer DECIMAL)
What is the sum of revenue from companies with headquarters in Austin?
SELECT SUM(revenue) FROM manufacturers WHERE headquarter = 'Austin'
SELECT SUM("revenue") FROM "manufacturers" WHERE "headquarter" = 'Austin'
0.071289
CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT)
count the current patients whose age is 60 or above.
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.dischtime IS NULL AND admissions.age >= 60
SELECT COUNT(DISTINCT "admissions"."subject_id") FROM "admissions" WHERE "admissions"."age" >= 60 AND "admissions"."dischtime" IS NULL
0.130859
CREATE TABLE table_12834315_8 (barrel_length VARCHAR, rear_sight VARCHAR, barrel_profile VARCHAR)
How many inches is the barrel length when the rear sight is weaver and the barrel profile is A2?
SELECT barrel_length FROM table_12834315_8 WHERE rear_sight = "Weaver" AND barrel_profile = "A2"
SELECT "barrel_length" FROM "table_12834315_8" WHERE "A2" = "barrel_profile" AND "Weaver" = "rear_sight"
0.101563
CREATE TABLE table_78567 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Attendance" TEXT)
What was the result for week 16?
SELECT "Result" FROM table_78567 WHERE "Week" = '16'
SELECT "Result" FROM "table_78567" WHERE "Week" = '16'
0.052734
CREATE TABLE table_name_7 (start_source VARCHAR, country VARCHAR, ended VARCHAR)
What is the start source of the irl country, which ended on 13 April?
SELECT start_source FROM table_name_7 WHERE country = "irl" AND ended = "13 april"
SELECT "start_source" FROM "table_name_7" WHERE "13 april" = "ended" AND "country" = "irl"
0.087891
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT)
when did patient 20862 get a d5w intake for the last time on 02/19/last year?
SELECT inputevents_cv.charttime FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20862)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'd5w' AND d_items.linksto = 'inputevents_cv') AND DATETIME(inputevents_cv.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m-%d', inputevents_cv.charttime) = '02-19' ORDER BY inputevents_cv.charttime DESC LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 20862 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'd5w' AND "d_items"."linksto" = 'inputevents_cv' GROUP BY "itemid") SELECT "inputevents_cv"."charttime" FROM "inputevents_cv" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "inputevents_cv"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "inputevents_cv"."itemid" WHERE DATETIME("inputevents_cv"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL AND STRFTIME('%m-%d', "inputevents_cv"."charttime") = '02-19' ORDER BY "inputevents_cv"."charttime" DESC NULLS LAST LIMIT 1
0.912109
CREATE TABLE table_17693171_1 (laps INT, time_retired VARCHAR)
If the time/retired is +1 lap, what is the amount of maximum laps?
SELECT MAX(laps) FROM table_17693171_1 WHERE time_retired = "+1 lap"
SELECT MAX("laps") FROM "table_17693171_1" WHERE "+1 lap" = "time_retired"
0.072266
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) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) 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) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
what is the number of patients whose primary disease is ruq pain and days of hospital stay is greater than 15?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "RUQ PAIN" AND demographic.days_stay > "15"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "15" < "demographic"."days_stay" AND "RUQ PAIN" = "demographic"."diagnosis"
0.146484
CREATE TABLE table_70288 ("Date" TEXT, "Visitor" TEXT, "Score" TEXT, "Home" TEXT, "Record" TEXT)
What was the score of the game when the record was 32 19 7?
SELECT "Score" FROM table_70288 WHERE "Record" = '32–19–7'
SELECT "Score" FROM "table_70288" WHERE "Record" = '32–19–7'
0.058594
CREATE TABLE player (player_id DECIMAL, player TEXT, years_played TEXT, total_wl TEXT, singles_wl TEXT, doubles_wl TEXT, team DECIMAL) CREATE TABLE team (team_id DECIMAL, name TEXT) CREATE TABLE match_season (season DECIMAL, player TEXT, position TEXT, country DECIMAL, team DECIMAL, draft_pick_number DECIMAL, draft_class TEXT, college TEXT) CREATE TABLE country (country_id DECIMAL, country_name TEXT, capital TEXT, official_native_language TEXT)
Show the players and years played for players from team 'Columbus Crew'.
SELECT T1.player, T1.years_played FROM player AS T1 JOIN team AS T2 ON T1.team = T2.team_id WHERE T2.name = "Columbus Crew"
SELECT "T1"."player", "T1"."years_played" FROM "player" AS "T1" JOIN "team" AS "T2" ON "Columbus Crew" = "T2"."name" AND "T1"."team" = "T2"."team_id"
0.145508
CREATE TABLE table_203_482 (id DECIMAL, "year" DECIMAL, "award" TEXT, "result" TEXT, "category" TEXT, "series" TEXT)
how many nominations were received in all ?
SELECT COUNT("award") FROM table_203_482
SELECT COUNT("award") FROM "table_203_482"
0.041016
CREATE TABLE WINE (Name VARCHAR)
List the names of all distinct wines in alphabetical order.
SELECT DISTINCT Name FROM WINE ORDER BY Name
SELECT DISTINCT "Name" FROM "WINE" ORDER BY "Name" NULLS FIRST
0.060547
CREATE TABLE table_19990 ("Condition/Parameter" TEXT, "Coordinate velocity v dx/dt in units of c" TEXT, "Velocity angle \\u03b7 in i-radians" TEXT, "Proper velocity w dx/d\\u03c4 in units of c" TEXT, "Lorentz factor \\u03b3 dt/d\\u03c4 = E/mc 2" TEXT)
If the the condition/parameter is rapidity of 2 hyperbolic radians, what is the coordinate velocity v dx/dt in units of c?
SELECT "Coordinate velocity v dx/dt in units of c" FROM table_19990 WHERE "Condition/Parameter" = 'Rapidity of 2 hyperbolic radians'
SELECT "Coordinate velocity v dx/dt in units of c" FROM "table_19990" WHERE "Condition/Parameter" = 'Rapidity of 2 hyperbolic radians'
0.130859
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) 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) 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)
provide the number of patients whose gender is f and drug name is ondansetron?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "F" AND prescriptions.drug = "Ondansetron"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "Ondansetron" = "prescriptions"."drug" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "F" = "demographic"."gender"
0.216797
CREATE TABLE table_203_356 (id DECIMAL, "type" TEXT, "diagonal ( mm ) " TEXT, "width ( mm ) " TEXT, "height ( mm ) " TEXT, "area ( mm2 ) " TEXT, "stops ( area ) " DECIMAL, "crop factor" TEXT)
what is the different in area between the 1/10 and the 1/8 ?
SELECT ABS((SELECT "area (mm2)" FROM table_203_356 WHERE "type" = '1/10"') - (SELECT "area (mm2)" FROM table_203_356 WHERE "type" = '1/8"'))
SELECT ABS((SELECT "area (mm2)" FROM "table_203_356" WHERE "type" = '1/10"') - (SELECT "area (mm2)" FROM "table_203_356" WHERE "type" = '1/8"'))
0.140625
CREATE TABLE table_204_207 (id DECIMAL, "week" DECIMAL, "date" TEXT, "opponent" TEXT, "result" TEXT, "attendance" DECIMAL, "bye" TEXT)
what was the next opponent after the detroit lions ?
SELECT "opponent" FROM table_204_207 WHERE "date" > (SELECT "date" FROM table_204_207 WHERE "opponent" = 'detroit lions') ORDER BY "date" LIMIT 1
SELECT "opponent" FROM "table_204_207" WHERE "date" > (SELECT "date" FROM "table_204_207" WHERE "opponent" = 'detroit lions') ORDER BY "date" NULLS FIRST LIMIT 1
0.157227
CREATE TABLE table_name_65 (bronze INT, total VARCHAR, rank VARCHAR)
What is the average number of bronze medals won among nations that won at least 1 medal and are not ranked 1st?
SELECT AVG(bronze) FROM table_name_65 WHERE total > 1 AND rank > 1
SELECT AVG("bronze") FROM "table_name_65" WHERE "rank" > 1 AND "total" > 1
0.072266
CREATE TABLE table_8709 ("Developer ( s ) " TEXT, "Release date" TEXT, "Required OS" TEXT, "Payment" TEXT, "Type" TEXT)
Which Type has a Release date of november 30, 1997?
SELECT "Type" FROM table_8709 WHERE "Release date" = 'november 30, 1997'
SELECT "Type" FROM "table_8709" WHERE "Release date" = 'november 30, 1997'
0.072266
CREATE TABLE table_32847 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
What away team did Carlton play?
SELECT "Away team" FROM table_32847 WHERE "Home team" = 'carlton'
SELECT "Away team" FROM "table_32847" WHERE "Home team" = 'carlton'
0.06543
CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE employees (EMPLOYEE_ID DECIMAL, FIRST_NAME VARCHAR, LAST_NAME VARCHAR, EMAIL VARCHAR, PHONE_NUMBER VARCHAR, HIRE_DATE DATE, JOB_ID VARCHAR, SALARY DECIMAL, COMMISSION_PCT DECIMAL, MANAGER_ID DECIMAL, DEPARTMENT_ID DECIMAL)
For those employees who was hired before 2002-06-21, visualize a bar chart about the distribution of job_id and the average of department_id , and group by attribute job_id, and display in desc by the Y.
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(DEPARTMENT_ID) DESC
SELECT "JOB_ID", AVG("DEPARTMENT_ID") FROM "employees" WHERE "HIRE_DATE" < '2002-06-21' GROUP BY "JOB_ID" ORDER BY AVG("DEPARTMENT_ID") DESC NULLS LAST
0.147461
CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR)
does YX serve INDIANAPOLIS
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((flight.to_airport = AIRPORT_SERVICE_0.airport_code AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'INDIANAPOLIS') OR (flight.from_airport = AIRPORT_SERVICE_1.airport_code AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'INDIANAPOLIS')) AND flight.airline_code = 'YX'
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" CROSS JOIN "city" AS "CITY_1" JOIN "city" AS "CITY_0" ON ("AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" OR "CITY_1"."city_name" = 'INDIANAPOLIS') AND ("CITY_0"."city_name" = 'INDIANAPOLIS' OR "CITY_1"."city_name" = 'INDIANAPOLIS') JOIN "flight" ON ("AIRPORT_SERVICE_0"."airport_code" = "flight"."to_airport" OR "CITY_1"."city_name" = 'INDIANAPOLIS') AND "flight"."airline_code" = 'YX' JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON ("AIRPORT_SERVICE_0"."airport_code" = "flight"."to_airport" OR "AIRPORT_SERVICE_1"."airport_code" = "flight"."from_airport") AND ("AIRPORT_SERVICE_0"."airport_code" = "flight"."to_airport" OR "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code") AND ("AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" OR "AIRPORT_SERVICE_1"."airport_code" = "flight"."from_airport") AND ("AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" OR "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code") AND ("AIRPORT_SERVICE_1"."airport_code" = "flight"."from_airport" OR "CITY_0"."city_name" = 'INDIANAPOLIS') AND ("AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" OR "CITY_0"."city_name" = 'INDIANAPOLIS')
1.198242
CREATE TABLE table_name_56 (crowd INT, away_team VARCHAR)
What were the Away team Kangaroos Crowd totals?
SELECT SUM(crowd) FROM table_name_56 WHERE away_team = "kangaroos"
SELECT SUM("crowd") FROM "table_name_56" WHERE "away_team" = "kangaroos"
0.070313
CREATE TABLE table_14342367_15 (player VARCHAR, total_points VARCHAR)
How many player with total points of 75
SELECT COUNT(player) FROM table_14342367_15 WHERE total_points = 75
SELECT COUNT("player") FROM "table_14342367_15" WHERE "total_points" = 75
0.071289
CREATE TABLE table_name_35 (losing_bonus VARCHAR, tries_against VARCHAR, lost VARCHAR)
What is the losing bonus for the team that has 33 tries against and 5 lost?
SELECT losing_bonus FROM table_name_35 WHERE tries_against = "33" AND lost = "5"
SELECT "losing_bonus" FROM "table_name_35" WHERE "33" = "tries_against" AND "5" = "lost"
0.085938
CREATE TABLE table_1585 ("Year" FLOAT, "Starts" FLOAT, "Wins" FLOAT, "Top 5" FLOAT, "Top 10" FLOAT, "Poles" FLOAT, "Avg. Start" TEXT, "Avg. Finish" TEXT, "Winnings" TEXT, "Position" TEXT, "Team ( s ) " TEXT)
Name the total number when avg start is 2000
SELECT COUNT("Avg. Start") FROM table_1585 WHERE "Year" = '2000'
SELECT COUNT("Avg. Start") FROM "table_1585" WHERE "Year" = '2000'
0.064453
CREATE TABLE table_28211988_1 (womens_singles VARCHAR, season VARCHAR)
How many people are women's singles in the season of 2000/01?
SELECT COUNT(womens_singles) FROM table_28211988_1 WHERE season = "2000/01"
SELECT COUNT("womens_singles") FROM "table_28211988_1" WHERE "2000/01" = "season"
0.079102
CREATE TABLE table_69686 ("Year" FLOAT, "Award" TEXT, "Work" TEXT, "Cole" TEXT, "Dylan" TEXT)
Name the Cole for years before 2009 where Dylan was nominated for big daddy at mtv movie awards
SELECT "Cole" FROM table_69686 WHERE "Year" < '2009' AND "Dylan" = 'nominated' AND "Work" = 'big daddy' AND "Award" = 'mtv movie awards'
SELECT "Cole" FROM "table_69686" WHERE "Award" = 'mtv movie awards' AND "Dylan" = 'nominated' AND "Work" = 'big daddy' AND "Year" < '2009'
0.134766
CREATE TABLE table_name_2 (draws INT, against VARCHAR, byes VARCHAR)
What is the average value for Draws, when Against is '2177', and when Byes is less than 4?
SELECT AVG(draws) FROM table_name_2 WHERE against = 2177 AND byes < 4
SELECT AVG("draws") FROM "table_name_2" WHERE "against" = 2177 AND "byes" < 4
0.075195
CREATE TABLE table_39117 ("Games" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "Points difference" TEXT, "Points" FLOAT)
What is the sum of the points when there are fewer than 4 games?
SELECT SUM("Points") FROM table_39117 WHERE "Games" < '4'
SELECT SUM("Points") FROM "table_39117" WHERE "Games" < '4'
0.057617
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME)
calculate the three year survival rate among the patients who were prescribed oxycodone (immediate release) after being diagnosed with mal neo brain stem.
SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t4.charttime) > 3 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.subject_id, t2.charttime FROM (SELECT t1.subject_id, t1.charttime 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 = 'mal neo brain stem') GROUP BY admissions.subject_id HAVING MIN(diagnoses_icd.charttime) = diagnoses_icd.charttime) AS t1 WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', t1.charttime) > 3 * 365) AS t2 JOIN (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'oxycodone (immediate release)') AS t3 ON t2.subject_id = t3.subject_id WHERE t2.charttime < t3.startdate) AS t4 JOIN patients ON t4.subject_id = patients.subject_id
WITH "t1" AS (SELECT "admissions"."subject_id", "diagnoses_icd"."charttime" FROM "diagnoses_icd" JOIN "d_icd_diagnoses" ON "d_icd_diagnoses"."icd9_code" = "diagnoses_icd"."icd9_code" AND "d_icd_diagnoses"."short_title" = 'mal neo brain stem' JOIN "admissions" ON "admissions"."hadm_id" = "diagnoses_icd"."hadm_id" GROUP BY "admissions"."subject_id" HAVING "diagnoses_icd"."charttime" = MIN("diagnoses_icd"."charttime")), "t3" AS (SELECT "admissions"."subject_id", "prescriptions"."startdate" FROM "prescriptions" JOIN "admissions" ON "admissions"."hadm_id" = "prescriptions"."hadm_id" WHERE "prescriptions"."drug" = 'oxycodone (immediate release)') SELECT SUM(CASE WHEN "patients"."dod" IS NULL THEN 1 WHEN STRFTIME('%j', "patients"."dod") - STRFTIME('%j', "t1"."charttime") > 1095 THEN 1 ELSE 0 END) * 100 / NULLIF(COUNT(*), 0) FROM "t1" AS "t1" JOIN "t3" AS "t3" ON "t1"."charttime" < "t3"."startdate" AND "t1"."subject_id" = "t3"."subject_id" JOIN "patients" ON "patients"."subject_id" = "t1"."subject_id" WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "t1"."charttime") > 1095
1.061523
CREATE TABLE table_59341 ("Res." TEXT, "Record" TEXT, "Opponent" TEXT, "Method" TEXT, "Event" TEXT, "Round" FLOAT, "Time" TEXT, "Location" TEXT)
Where was the location when the record was 12-5?
SELECT "Location" FROM table_59341 WHERE "Record" = '12-5'
SELECT "Location" FROM "table_59341" WHERE "Record" = '12-5'
0.058594
CREATE TABLE table_name_57 (result VARCHAR, rank__number VARCHAR, attendance VARCHAR)
What is the result of the game played when 22,555 were in attendance and the Buckeyes were ranked #1?
SELECT result FROM table_name_57 WHERE rank__number = "1" AND attendance = "22,555"
SELECT "result" FROM "table_name_57" WHERE "1" = "rank__number" AND "22,555" = "attendance"
0.088867
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
what were the hospital hospital admission times of patient 006-157753 this year?
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '006-157753' AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
SELECT "patient"."hospitaladmittime" FROM "patient" WHERE "patient"."uniquepid" = '006-157753' AND DATETIME("patient"."hospitaladmittime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
0.205078
CREATE TABLE table_3919 ("Episode #" FLOAT, "Series #" FLOAT, "Title" TEXT, "Director" TEXT, "Writer" TEXT, "Original airdate" TEXT, "Viewers ( millions ) " TEXT)
Who wrote the episode that had 5.93 million viewers?
SELECT "Writer" FROM table_3919 WHERE "Viewers (millions)" = '5.93'
SELECT "Writer" FROM "table_3919" WHERE "Viewers (millions)" = '5.93'
0.067383
CREATE TABLE table_name_24 (grid INT, bike VARCHAR, rider VARCHAR)
Name the lowest Grid which has a Bike of ducati 1098 rs 08 and a Rider of max biaggi?
SELECT MIN(grid) FROM table_name_24 WHERE bike = "ducati 1098 rs 08" AND rider = "max biaggi"
SELECT MIN("grid") FROM "table_name_24" WHERE "bike" = "ducati 1098 rs 08" AND "max biaggi" = "rider"
0.098633
CREATE TABLE table_name_43 (date VARCHAR, edition VARCHAR)
On what date was the 48th Edition raced?
SELECT date FROM table_name_43 WHERE edition = "48th"
SELECT "date" FROM "table_name_43" WHERE "48th" = "edition"
0.057617
CREATE TABLE table_name_39 (winning_score VARCHAR, runner_s__up VARCHAR)
What was the winning score when Damien McGrane was runner-up?
SELECT winning_score FROM table_name_39 WHERE runner_s__up = "damien mcgrane"
SELECT "winning_score" FROM "table_name_39" WHERE "damien mcgrane" = "runner_s__up"
0.081055
CREATE TABLE table_202_43 (id DECIMAL, "year" DECIMAL, "publisher" TEXT, "country" TEXT, "accolade" TEXT, "rank" DECIMAL)
from where did ` stayin ' alive ' receive the most accolades ?
SELECT "publisher" FROM table_202_43 GROUP BY "publisher" ORDER BY COUNT("accolade") DESC LIMIT 1
SELECT "publisher" FROM "table_202_43" GROUP BY "publisher" ORDER BY COUNT("accolade") DESC NULLS LAST LIMIT 1
0.107422
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) 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) 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) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
what is the number of patients whose admission year is less than 2162 and procedure short title is int insert dual-cham dev?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2162" AND procedures.short_title = "Int insert dual-cham dev"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Int insert dual-cham dev" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "2162" > "demographic"."admityear"
0.233398
CREATE TABLE table_40170 ("Name" TEXT, "League" TEXT, "FA Cup" TEXT, "League Cup" TEXT, "Football League Trophy" TEXT, "Watney Cup" TEXT, "Welsh Cup" TEXT, "Total" TEXT)
What is Total, when FA Cup is 1 0 (3)?
SELECT "Total" FROM table_40170 WHERE "FA Cup" = '1 0 (3)'
SELECT "Total" FROM "table_40170" WHERE "FA Cup" = '1 0 (3)'
0.058594
CREATE TABLE table_9844 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Record" TEXT)
What was the score on october 23?
SELECT "Score" FROM table_9844 WHERE "Date" = 'october 23'
SELECT "Score" FROM "table_9844" WHERE "Date" = 'october 23'
0.058594
CREATE TABLE table_name_6 (total_apps VARCHAR, fa_cup_goals VARCHAR, fa_cup_apps VARCHAR)
It has a FA Cup Goals smaller than 4, and a FA Cup Apps larger than 7, what is the total number of total apps?
SELECT COUNT(total_apps) FROM table_name_6 WHERE fa_cup_goals < 4 AND fa_cup_apps > 7
SELECT COUNT("total_apps") FROM "table_name_6" WHERE "fa_cup_apps" > 7 AND "fa_cup_goals" < 4
0.09082
CREATE TABLE tweets (text VARCHAR, createdate VARCHAR)
List the text of all tweets in the order of date.
SELECT text FROM tweets ORDER BY createdate
SELECT "text" FROM "tweets" ORDER BY "createdate" NULLS FIRST
0.05957
CREATE TABLE table_4435 ("Pick #" FLOAT, "MLS team" TEXT, "Player" TEXT, "Position" TEXT, "Affiliation" TEXT)
Tell me the lowest pick number for new england revolution
SELECT MIN("Pick #") FROM table_4435 WHERE "MLS team" = 'new england revolution'
SELECT MIN("Pick #") FROM "table_4435" WHERE "MLS team" = 'new england revolution'
0.080078
CREATE TABLE table_name_13 (site VARCHAR, opponent VARCHAR)
What is Site, when Opponent is 'All times are in eastern.'?
SELECT site FROM table_name_13 WHERE opponent = "all times are in eastern."
SELECT "site" FROM "table_name_13" WHERE "all times are in eastern." = "opponent"
0.079102
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME)
how did patient 016-13544 first be admitted since 3 years ago to the hospital?
SELECT patient.hospitaladmitsource FROM patient WHERE patient.uniquepid = '016-13544' AND DATETIME(patient.hospitaladmittime) >= DATETIME(CURRENT_TIME(), '-3 year') ORDER BY patient.hospitaladmittime LIMIT 1
SELECT "patient"."hospitaladmitsource" FROM "patient" WHERE "patient"."uniquepid" = '016-13544' AND DATETIME("patient"."hospitaladmittime") >= DATETIME(CURRENT_TIME(), '-3 year') ORDER BY "patient"."hospitaladmittime" NULLS FIRST LIMIT 1
0.231445
CREATE TABLE table_201_48 (id DECIMAL, "title" TEXT, "year" DECIMAL, "peak chart positions\ us" DECIMAL, "peak chart positions\ us\ alt." DECIMAL, "peak chart positions\ us\ main. rock" DECIMAL, "peak chart positions\ aus" DECIMAL, "peak chart positions\ aut" DECIMAL, "peak chart positions\ fin" DECIMAL, "peak chart positions\ ger" DECIMAL, "peak chart positions\ nld" DECIMAL, "peak chart positions\ swi" DECIMAL, "peak chart positions\ uk" DECIMAL, "album" TEXT)
how many singles have a ranking of 1 under ger ?
SELECT COUNT("title") FROM table_201_48 WHERE "peak chart positions\nger" = 1
SELECT COUNT("title") FROM "table_201_48" WHERE "peak chart positions\nger" = 1
0.077148
CREATE TABLE table_18029 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Game site" TEXT, "Record" TEXT, "Attendance" TEXT)
During what weak of the season was the game played on october 4, 1987?
SELECT MAX("Week") FROM table_18029 WHERE "Date" = 'October 4, 1987'
SELECT MAX("Week") FROM "table_18029" WHERE "Date" = 'October 4, 1987'
0.068359
CREATE TABLE table_name_67 (circuit VARCHAR, winning_team VARCHAR, fastest_lap VARCHAR)
What circuit did marlboro team penske win with an unknown fastest lap?
SELECT circuit FROM table_name_67 WHERE winning_team = "marlboro team penske" AND fastest_lap = "unknown"
SELECT "circuit" FROM "table_name_67" WHERE "fastest_lap" = "unknown" AND "marlboro team penske" = "winning_team"
0.110352
CREATE TABLE table_203_486 (id DECIMAL, "place" DECIMAL, "team" TEXT, "matches" DECIMAL, "won" DECIMAL, "drawn" DECIMAL, "lost" DECIMAL, "difference" TEXT, "points" DECIMAL)
which country finished below the united states ?
SELECT "team" FROM table_203_486 WHERE "place" > (SELECT "place" FROM table_203_486 WHERE "team" = 'united states') ORDER BY "place" DESC LIMIT 1
SELECT "team" FROM "table_203_486" WHERE "place" > (SELECT "place" FROM "table_203_486" WHERE "team" = 'united states') ORDER BY "place" DESC NULLS LAST LIMIT 1
0.15625
CREATE TABLE area (course_id INT, area VARCHAR) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE gsi (course_offering_id INT, student_id INT) 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) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) 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) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) 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) 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) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) 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) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT)
How long has MEDEDUC 883 been up for offer ?
SELECT DISTINCT semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'MEDEDUC' AND course.number = 883 AND semester.semester_id = course_offering.semester ORDER BY semester.year LIMIT 1
SELECT DISTINCT "semester"."year" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" WHERE "course"."department" = 'MEDEDUC' AND "course"."number" = 883 ORDER BY "semester"."year" NULLS FIRST LIMIT 1
0.308594
CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT)
show me nonstop flights from TORONTO to ST. PETERSBURG
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'TORONTO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ST. PETERSBURG' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.stops = 0
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'TORONTO' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "flight"."stops" = 0 JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'ST. PETERSBURG'
0.525391
CREATE TABLE table_204_146 (id DECIMAL, "tie" DECIMAL, "home team" TEXT, "score" TEXT, "away team" TEXT, "attendance" DECIMAL)
who is the first away team on the list ?
SELECT "away team" FROM table_204_146 WHERE id = 1
SELECT "away team" FROM "table_204_146" WHERE "id" = 1
0.052734
CREATE TABLE Ref_Transaction_Types (transaction_type_description VARCHAR, transaction_type_code VARCHAR)
Show the description of transaction type with code 'PUR'.
SELECT transaction_type_description FROM Ref_Transaction_Types WHERE transaction_type_code = "PUR"
SELECT "transaction_type_description" FROM "Ref_Transaction_Types" WHERE "PUR" = "transaction_type_code"
0.101563
CREATE TABLE table_26964 ("Name" TEXT, "Position" TEXT, "Period" TEXT, "Appearances\\u00b9" FLOAT, "Goals\\u00b9" FLOAT, "Nationality\\u00b2" TEXT)
What is the nationality of Louis floch
SELECT "Nationality\u00b2" FROM table_26964 WHERE "Name" = 'Louis Floch'
SELECT "Nationality\u00b2" FROM "table_26964" WHERE "Name" = 'Louis Floch'
0.072266
CREATE TABLE Lessons (lesson_time INT, customer_id VARCHAR) CREATE TABLE Customers (customer_id VARCHAR, first_name VARCHAR, last_name VARCHAR)
How long is the total lesson time took by customer with first name as Rylan and last name as Goodwin?
SELECT SUM(T1.lesson_time) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin"
SELECT SUM("T1"."lesson_time") FROM "Lessons" AS "T1" JOIN "Customers" AS "T2" ON "Goodwin" = "T2"."last_name" AND "Rylan" = "T2"."first_name" AND "T1"."customer_id" = "T2"."customer_id"
0.181641
CREATE TABLE table_1341930_40 (candidates VARCHAR, incumbent VARCHAR)
Name the candidates for l. mendel rivers
SELECT COUNT(candidates) FROM table_1341930_40 WHERE incumbent = "L. Mendel Rivers"
SELECT COUNT("candidates") FROM "table_1341930_40" WHERE "L. Mendel Rivers" = "incumbent"
0.086914
CREATE TABLE table_52603 ("Race" TEXT, "Circuit" TEXT, "Date" TEXT, "Pole position" TEXT, "Fastest lap" TEXT, "Winning driver" TEXT, "Constructor" TEXT, "Tyre" TEXT, "Report" TEXT)
What's the report for the mosport park circuit?
SELECT "Report" FROM table_52603 WHERE "Circuit" = 'mosport park'
SELECT "Report" FROM "table_52603" WHERE "Circuit" = 'mosport park'
0.06543
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) 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) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) 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)
count the number of patients whose item id is 51256?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51256"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "51256" = "lab"."itemid" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.149414
CREATE TABLE table_204_966 (id DECIMAL, "region" TEXT, "date" TEXT, "label" TEXT, "format" TEXT, "catalog" TEXT)
what region is above australia ?
SELECT "region" FROM table_204_966 WHERE id = (SELECT id FROM table_204_966 WHERE "region" = 'australia') - 1
SELECT "region" FROM "table_204_966" WHERE "id" = (SELECT "id" FROM "table_204_966" WHERE "region" = 'australia') - 1
0.114258
CREATE TABLE table_32416 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Attendance" TEXT)
What was date of the bye week 11?
SELECT "Date" FROM table_32416 WHERE "Attendance" = 'bye' AND "Week" = '11'
SELECT "Date" FROM "table_32416" WHERE "Attendance" = 'bye' AND "Week" = '11'
0.075195
CREATE TABLE table_20804 ("Institution" TEXT, "Location" TEXT, "Nickname" TEXT, "Enrollment" FLOAT, "Established" FLOAT)
Location of the school with the nickname Mountaineers
SELECT "Location" FROM table_20804 WHERE "Nickname" = 'Mountaineers'
SELECT "Location" FROM "table_20804" WHERE "Nickname" = 'Mountaineers'
0.068359
CREATE TABLE table_14418812_1 (date VARCHAR, game_site VARCHAR)
Name the number of date for shea stadium
SELECT COUNT(date) FROM table_14418812_1 WHERE game_site = "Shea Stadium"
SELECT COUNT("date") FROM "table_14418812_1" WHERE "Shea Stadium" = "game_site"
0.077148
CREATE TABLE table_203_834 (id DECIMAL, "rank" DECIMAL, "census subdivision" TEXT, "province" TEXT, "type" TEXT, "land area\ ( km2 , 2011 ) " DECIMAL, "population 2011" DECIMAL, "population 2006" DECIMAL, "population 2001" DECIMAL, "population 1996" DECIMAL, "change in % 2006-2011" DECIMAL, "change in % 1996-2011" DECIMAL)
which subdivision is at the top of the list ?
SELECT "census subdivision" FROM table_203_834 WHERE id = 1
SELECT "census subdivision" FROM "table_203_834" WHERE "id" = 1
0.061523
CREATE TABLE table_name_79 (location VARCHAR, game VARCHAR, date VARCHAR)
Which Location has a Game greater than 20 and a Date of Wed. Dec. 26?
SELECT location FROM table_name_79 WHERE game > 20 AND date = "wed. dec. 26"
SELECT "location" FROM "table_name_79" WHERE "date" = "wed. dec. 26" AND "game" > 20
0.082031
CREATE TABLE Document_Drafts (draft_details VARCHAR, document_id VARCHAR)
What is draft detail of the document with id 7?
SELECT draft_details FROM Document_Drafts WHERE document_id = 7
SELECT "draft_details" FROM "Document_Drafts" WHERE "document_id" = 7
0.067383
CREATE TABLE table_19111 ("Club" TEXT, "Played" TEXT, "Won" TEXT, "Drawn" TEXT, "Lost" TEXT, "Points for" TEXT, "Points against" TEXT, "Tries for" TEXT, "Tries against" TEXT, "Try bonus" TEXT, "Losing bonus" TEXT, "Points" TEXT)
what's the drawn with points for being 350
SELECT "Drawn" FROM table_19111 WHERE "Points for" = '350'
SELECT "Drawn" FROM "table_19111" WHERE "Points for" = '350'
0.058594
CREATE TABLE table_15128839_22 (tfl_yds VARCHAR, no_yds VARCHAR)
Name the tfl-yds for no-yds 1-0
SELECT tfl_yds FROM table_15128839_22 WHERE no_yds = "1-0"
SELECT "tfl_yds" FROM "table_15128839_22" WHERE "1-0" = "no_yds"
0.0625
CREATE TABLE table_60207 ("Benalla DFL" TEXT, "Wins" FLOAT, "Losses" FLOAT, "Draws" FLOAT, "Byes" FLOAT, "Against" FLOAT)
What is the highest value for Byes, when Against is less than 1794, when Losses is '6', and when Draws is less than 0?
SELECT MAX("Byes") FROM table_60207 WHERE "Against" < '1794' AND "Losses" = '6' AND "Draws" < '0'
SELECT MAX("Byes") FROM "table_60207" WHERE "Against" < '1794' AND "Draws" < '0' AND "Losses" = '6'
0.09668
CREATE TABLE table_44979 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Attendance" TEXT)
Who was the Opponent of the Game with a Result of l 23-41?
SELECT "Opponent" FROM table_44979 WHERE "Result" = 'l 23-41'
SELECT "Opponent" FROM "table_44979" WHERE "Result" = 'l 23-41'
0.061523
CREATE TABLE table_name_3 (stadium VARCHAR, club VARCHAR)
Which stadium had the club Kuwait?
SELECT stadium FROM table_name_3 WHERE club = "kuwait"
SELECT "stadium" FROM "table_name_3" WHERE "club" = "kuwait"
0.058594
CREATE TABLE table_name_85 (length_duration VARCHAR, date VARCHAR)
What is the length and duration of the race on April 19?
SELECT length_duration FROM table_name_85 WHERE date = "april 19"
SELECT "length_duration" FROM "table_name_85" WHERE "april 19" = "date"
0.069336
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) 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) 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)
count the number of patients who were admitted before 2124 and had hematology lab test category.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2124" AND lab."CATEGORY" = "Hematology"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Hematology" = "lab"."CATEGORY" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "2124" > "demographic"."admityear"
0.196289
CREATE TABLE table_63879 ("Monday" TEXT, "Tuesday" TEXT, "Wednesday" TEXT, "Thursday" TEXT, "Friday" TEXT)
What is shown on Friday when Tuesday is Jay Mohr Sports?
SELECT "Friday" FROM table_63879 WHERE "Tuesday" = 'jay mohr sports'
SELECT "Friday" FROM "table_63879" WHERE "Tuesday" = 'jay mohr sports'
0.068359
CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) 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) 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) 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) CREATE TABLE area (course_id INT, area VARCHAR) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE gsi (course_offering_id INT, student_id INT) 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) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) 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) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT)
After 10:00 , is there a section for PHYSICS 522 ?
SELECT DISTINCT course_offering.end_time, course_offering.section_number, course_offering.start_time FROM course, course_offering, semester WHERE course_offering.start_time > '10:00' AND course.course_id = course_offering.course_id AND course.department = 'PHYSICS' AND course.number = 522 AND semester.semester = 'WN' AND semester.semester_id = course_offering.semester AND semester.year = 2016
SELECT DISTINCT "course_offering"."end_time", "course_offering"."section_number", "course_offering"."start_time" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" AND "course_offering"."start_time" > '10:00' JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" AND "semester"."semester" = 'WN' AND "semester"."year" = 2016 WHERE "course"."department" = 'PHYSICS' AND "course"."number" = 522
0.444336
CREATE TABLE table_203_812 (id DECIMAL, "rank" DECIMAL, "nation" TEXT, "gold" DECIMAL, "silver" DECIMAL, "bronze" DECIMAL, "total" DECIMAL)
how many combined gold medals did japan and france win ?
SELECT SUM("gold") FROM table_203_812 WHERE "nation" IN ('japan', 'france')
SELECT SUM("gold") FROM "table_203_812" WHERE "nation" IN ('japan', 'france')
0.075195
CREATE TABLE table_41256 ("Place ( Posici\\u00f3n ) " FLOAT, "Team ( Equipo ) " TEXT, "Played ( PJ ) " FLOAT, "Won ( PG ) " FLOAT, "Draw ( PE ) " FLOAT, "Lost ( PP ) " FLOAT, "Goals Scored ( GF ) " FLOAT, "Goals Conceded ( GC ) " FLOAT, "+/- ( Dif. ) " FLOAT, "Points ( Pts. ) " FLOAT)
Goals Conceded (GC) that has a Draw (PE) larger than 2, and a Goals Scored (GF) larger than 19?
SELECT MAX("Goals Conceded (GC)") FROM table_41256 WHERE "Draw (PE)" > '2' AND "Goals Scored (GF)" > '19'
SELECT MAX("Goals Conceded (GC)") FROM "table_41256" WHERE "Draw (PE)" > '2' AND "Goals Scored (GF)" > '19'
0.104492