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 table_21631 ("Series #" FLOAT, "Season #" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT)
| Which episodes did Nelson McCormick direct? | SELECT "Written by" FROM table_21631 WHERE "Directed by" = 'Nelson McCormick' | SELECT "Written by" FROM "table_21631" WHERE "Directed by" = 'Nelson McCormick' | 0.077148 |
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)
CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime 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 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 lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME)
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
| was there a microbiological test that was done to patient 031-3355 during this month? | SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355')) AND DATETIME(microlab.culturetakentime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') | WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '031-3355' 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 COUNT(*) > 0 FROM "microlab" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "microlab"."patientunitstayid" WHERE DATETIME("microlab"."culturetakentime", 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') AND NOT "_u_1"."" IS NULL | 0.597656 |
CREATE TABLE table_15346009_1 (date VARCHAR, location VARCHAR)
| On what day was the tournament in Alabama? | SELECT date FROM table_15346009_1 WHERE location = "Alabama" | SELECT "date" FROM "table_15346009_1" WHERE "Alabama" = "location" | 0.064453 |
CREATE TABLE table_16989 ("Institution" TEXT, "Location" TEXT, "Founded" FLOAT, "Type" TEXT, "Enrollment" FLOAT, "Joined" TEXT, "Nickname" TEXT)
| What is the minimum enrollment at barton college | SELECT MIN("Enrollment") FROM table_16989 WHERE "Institution" = 'Barton College' | SELECT MIN("Enrollment") FROM "table_16989" WHERE "Institution" = 'Barton College' | 0.080078 |
CREATE TABLE table_name_18 (rank VARCHAR, laps VARCHAR)
| Name the rank for 151 Laps | SELECT rank FROM table_name_18 WHERE laps = 151 | SELECT "rank" FROM "table_name_18" WHERE "laps" = 151 | 0.051758 |
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 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 inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL)
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT)
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime 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 labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label 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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
CREATE TABLE diagnoses_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 patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME)
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT)
CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
| what's the name of the procedure that patient 42757 was given two or more times in 11/2102? | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 42757) AND STRFTIME('%y-%m', procedures_icd.charttime) = '2102-11' GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 >= 2) | WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 42757 GROUP BY "hadm_id"), "t1" AS (SELECT "procedures_icd"."icd9_code", COUNT("procedures_icd"."charttime") AS "c1" FROM "procedures_icd" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "procedures_icd"."hadm_id" WHERE NOT "_u_0"."" IS NULL AND STRFTIME('%y-%m', "procedures_icd"."charttime") = '2102-11' GROUP BY "procedures_icd"."icd9_code"), "_u_1" AS (SELECT "t1"."icd9_code" FROM "t1" AS "t1" WHERE "t1"."c1" >= 2 GROUP BY "icd9_code") SELECT "d_icd_procedures"."short_title" FROM "d_icd_procedures" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "d_icd_procedures"."icd9_code" WHERE NOT "_u_1"."" IS NULL | 0.681641 |
CREATE TABLE record (ID INT, Result TEXT, Swimmer_ID INT, Event_ID INT)
CREATE TABLE stadium (ID INT, name TEXT, Capacity INT, City TEXT, Country TEXT, Opening_year INT)
CREATE TABLE swimmer (ID INT, name TEXT, Nationality TEXT, meter_100 FLOAT, meter_200 TEXT, meter_300 TEXT, meter_400 TEXT, meter_500 TEXT, meter_600 TEXT, meter_700 TEXT, Time TEXT)
CREATE TABLE event (ID INT, Name TEXT, Stadium_ID INT, Year TEXT)
| Show me about the distribution of meter_200 and the sum of meter_100 , and group by attribute meter_200 in a bar chart, and show by the x axis in desc. | SELECT meter_200, SUM(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 DESC | SELECT "meter_200", SUM("meter_100") FROM "swimmer" GROUP BY "meter_200" ORDER BY "meter_200" DESC NULLS LAST | 0.106445 |
CREATE TABLE table_11326124_3 (result VARCHAR, round VARCHAR)
| How many rounds were 2r? | SELECT COUNT(result) FROM table_11326124_3 WHERE round = "2R" | SELECT COUNT("result") FROM "table_11326124_3" WHERE "2R" = "round" | 0.06543 |
CREATE TABLE table_name_67 (election INT, outcome_of_election VARCHAR, seats VARCHAR)
| What is the earliest election with 2 seats and the outcome of the election of minority in parliament? | SELECT MIN(election) FROM table_name_67 WHERE outcome_of_election = "minority in parliament" AND seats = "2" | SELECT MIN("election") FROM "table_name_67" WHERE "2" = "seats" AND "minority in parliament" = "outcome_of_election" | 0.113281 |
CREATE TABLE table_204_385 (id DECIMAL, "round" DECIMAL, "pick" DECIMAL, "player" TEXT, "nationality" TEXT, "college/junior/club team" TEXT)
| in the 1974-75 golden seals hockey season , how many draft picks were canadian ? | SELECT COUNT("pick") FROM table_204_385 WHERE "nationality" = 'canada' | SELECT COUNT("pick") FROM "table_204_385" WHERE "nationality" = 'canada' | 0.070313 |
CREATE TABLE table_53512 ("Player" TEXT, "Car." FLOAT, "Yards" TEXT, "Avg." TEXT, "TD's" FLOAT, "Long" TEXT)
| What was the total number of TD's for Player Lashaun Ward while also having a Long of 2? | SELECT COUNT("TD's") FROM table_53512 WHERE "Long" = '2' AND "Player" = 'lashaun ward' | SELECT COUNT("TD's") FROM "table_53512" WHERE "Long" = '2' AND "Player" = 'lashaun ward' | 0.085938 |
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)
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 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)
| what is average age of patients whose insurance is private and days of hospital stay is 7? | SELECT AVG(demographic.age) FROM demographic WHERE demographic.insurance = "Private" AND demographic.days_stay = "7" | SELECT AVG("demographic"."age") FROM "demographic" WHERE "7" = "demographic"."days_stay" AND "Private" = "demographic"."insurance" | 0.126953 |
CREATE TABLE table_name_23 (time VARCHAR, set_3 VARCHAR)
| What is the time when the set 3 score is 31 29? | SELECT time FROM table_name_23 WHERE set_3 = "31β29" | SELECT "time" FROM "table_name_23" WHERE "31β29" = "set_3" | 0.056641 |
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 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 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 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 microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME)
CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME)
| list the top three most frequent diagnoses that the patients were diagnosed with within the same hospital visit after being diagnosed with extremity compartment syndrome - left lower extremity since 2104. | SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'extremity compartment syndrome - left lower extremity' AND STRFTIME('%y', diagnosis.diagnosistime) >= '2104') AS t1 JOIN (SELECT patient.uniquepid, diagnosis.diagnosisname, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE STRFTIME('%y', diagnosis.diagnosistime) >= '2104') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.diagnosistime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid GROUP BY t2.diagnosisname) AS t3 WHERE t3.c1 <= 3 | WITH "t2" AS (SELECT "patient"."uniquepid", "diagnosis"."diagnosisname", "diagnosis"."diagnosistime", "patient"."patienthealthsystemstayid" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" WHERE STRFTIME('%y', "diagnosis"."diagnosistime") >= '2104'), "t3" AS (SELECT "t2"."diagnosisname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" JOIN "t2" AS "t2" ON "diagnosis"."diagnosistime" < "t2"."diagnosistime" AND "patient"."patienthealthsystemstayid" = "t2"."patienthealthsystemstayid" AND "patient"."uniquepid" = "t2"."uniquepid" WHERE "diagnosis"."diagnosisname" = 'extremity compartment syndrome - left lower extremity' AND STRFTIME('%y', "diagnosis"."diagnosistime") >= '2104' GROUP BY "t2"."diagnosisname") SELECT "t3"."diagnosisname" FROM "t3" AS "t3" WHERE "t3"."c1" <= 3 | 0.918945 |
CREATE TABLE table_13430 ("Non-dictatorship" TEXT, "Pareto efficiency" TEXT, "Majority" TEXT, "Monotone" TEXT, "Consistency & Participation" TEXT, "Condorcet" TEXT, "Condorcet loser" TEXT, "Clone independence" TEXT, "Reversal symmetry" TEXT)
| what is the consistency & participation when pareto efficiency is yes and condorcet is no? | SELECT "Consistency & Participation" FROM table_13430 WHERE "Pareto efficiency" = 'yes' AND "Condorcet" = 'no' | SELECT "Consistency & Participation" FROM "table_13430" WHERE "Condorcet" = 'no' AND "Pareto efficiency" = 'yes' | 0.109375 |
CREATE TABLE table_59547 ("Tie no" TEXT, "Home team" TEXT, "Score" TEXT, "Away team" TEXT, "Date" TEXT)
| What is the Tie No with a Score of 2 2? | SELECT "Tie no" FROM table_59547 WHERE "Score" = '2β2' | SELECT "Tie no" FROM "table_59547" WHERE "Score" = '2β2' | 0.054688 |
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)
CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime 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 vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME)
CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME)
CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME)
| how many patients until 4 years ago were staying at ward 1104? | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.wardid = 1104 AND DATETIME(patient.unitadmittime) <= DATETIME(CURRENT_TIME(), '-4 year') | SELECT COUNT(DISTINCT "patient"."uniquepid") FROM "patient" WHERE "patient"."wardid" = 1104 AND DATETIME("patient"."unitadmittime") <= DATETIME(CURRENT_TIME(), '-4 year') | 0.166016 |
CREATE TABLE table_9517 ("Party" TEXT, "Leader" TEXT, "Seats" TEXT, "% of seats" TEXT, "First Pref votes" TEXT, "% FPv" TEXT)
| What is the First Pref Votes where the Leader is n/a and the Party is Independent? | SELECT "First Pref votes" FROM table_9517 WHERE "Leader" = 'n/a' AND "Party" = 'independent' | SELECT "First Pref votes" FROM "table_9517" WHERE "Leader" = 'n/a' AND "Party" = 'independent' | 0.091797 |
CREATE TABLE table_2076595_1 (school VARCHAR, founded VARCHAR)
| What school was founded in 1791? | SELECT school FROM table_2076595_1 WHERE founded = 1791 | SELECT "school" FROM "table_2076595_1" WHERE "founded" = 1791 | 0.05957 |
CREATE TABLE table_203_27 (id DECIMAL, "number" DECIMAL, "serial no" DECIMAL, "entered service" TEXT, "withdrawn" TEXT, "kilometres travelled" DECIMAL)
| what was the most kilometres traveled ? | SELECT MAX("kilometres travelled") FROM table_203_27 | SELECT MAX("kilometres travelled") FROM "table_203_27" | 0.052734 |
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 microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME)
CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime 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 medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime 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)
| how many days has it been since patient 012-20116 was prescribed sodium chloride 0.9 % bolus the last time during their current hospital encounter? | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', medication.drugstarttime)) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-20116') AND patient.hospitaldischargetime IS NULL) AND medication.drugname = 'sodium chloride 0.9 % bolus' ORDER BY medication.drugstarttime DESC LIMIT 1 | WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '012-20116' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE "patient"."hospitaldischargetime" IS NULL AND NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "medication"."drugstarttime")) FROM "medication" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "medication"."patientunitstayid" WHERE "medication"."drugname" = 'sodium chloride 0.9 % bolus' AND NOT "_u_1"."" IS NULL ORDER BY "medication"."drugstarttime" DESC NULLS LAST LIMIT 1 | 0.719727 |
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)
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)
| let me know the number of emergency hospital admission patients who have docusate sodium prescription. | 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 = "Docusate Sodium" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "Docusate Sodium" = "prescriptions"."drug" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "EMERGENCY" = "demographic"."admission_type" | 0.236328 |
CREATE TABLE table_67487 ("Film" TEXT, "Director ( s ) " TEXT, "Writer ( s ) " TEXT, "Recipient" TEXT, "Date" TEXT, "Award" TEXT)
| Name the award for candida scott knight | SELECT "Award" FROM table_67487 WHERE "Director(s)" = 'candida scott knight' | SELECT "Award" FROM "table_67487" WHERE "Director(s)" = 'candida scott knight' | 0.076172 |
CREATE TABLE table_75402 ("Game" TEXT, "Date" TEXT, "Home Team" TEXT, "Result" TEXT, "Road Team" TEXT)
| Home Team of chicago bulls, and a Result of 81-83 (3-2) involved what game? | SELECT "Game" FROM table_75402 WHERE "Home Team" = 'chicago bulls' AND "Result" = '81-83 (3-2)' | SELECT "Game" FROM "table_75402" WHERE "Home Team" = 'chicago bulls' AND "Result" = '81-83 (3-2)' | 0.094727 |
CREATE TABLE student (stuid DECIMAL, lname TEXT, fname TEXT, age DECIMAL, sex TEXT, major DECIMAL, advisor DECIMAL, city_code TEXT)
CREATE TABLE faculty_participates_in (facid DECIMAL, actid DECIMAL)
CREATE TABLE activity (actid DECIMAL, activity_name TEXT)
CREATE TABLE faculty (facid DECIMAL, lname TEXT, fname TEXT, rank TEXT, sex TEXT, phone DECIMAL, room TEXT, building TEXT)
CREATE TABLE participates_in (stuid DECIMAL, actid DECIMAL)
| Show the ids of the faculty who don't participate in any activity. | SELECT facid FROM faculty EXCEPT SELECT facid FROM faculty_participates_in | SELECT "facid" FROM "faculty" EXCEPT SELECT "facid" FROM "faculty_participates_in" | 0.080078 |
CREATE TABLE table_51740 ("Driver" TEXT, "Constructor" TEXT, "Laps" FLOAT, "Time/Retired" TEXT, "Grid" FLOAT)
| Which Driver has Laps larger than 78, and a Time/Retired of + 1:09.4? | SELECT "Driver" FROM table_51740 WHERE "Laps" > '78' AND "Time/Retired" = '+ 1:09.4' | SELECT "Driver" FROM "table_51740" WHERE "Laps" > '78' AND "Time/Retired" = '+ 1:09.4' | 0.083984 |
CREATE TABLE Timed_Status_of_Things (thing_id INT, Date_and_Date DATETIME, Status_of_Thing_Code CHAR)
CREATE TABLE Services (service_id INT, organization_id INT, service_type_code CHAR, service_details VARCHAR)
CREATE TABLE Customers (customer_id INT, customer_details VARCHAR)
CREATE TABLE Properties (property_id INT, property_type_code CHAR, property_address VARCHAR, other_details VARCHAR)
CREATE TABLE Residents (resident_id INT, property_id INT, date_moved_in DATETIME, date_moved_out DATETIME, other_details VARCHAR)
CREATE TABLE Customer_Events (Customer_Event_ID INT, customer_id INT, date_moved_in DATETIME, property_id INT, resident_id INT, thing_id INT)
CREATE TABLE Customer_Event_Notes (Customer_Event_Note_ID INT, Customer_Event_ID INT, service_type_code CHAR, resident_id INT, property_id INT, date_moved_in DATETIME)
CREATE TABLE Timed_Locations_of_Things (thing_id INT, Date_and_Time DATETIME, Location_Code CHAR)
CREATE TABLE Residents_Services (resident_id INT, service_id INT, date_moved_in DATETIME, property_id INT, date_requested DATETIME, date_provided DATETIME, other_details VARCHAR)
CREATE TABLE Things (thing_id INT, organization_id INT, Type_of_Thing_Code CHAR, service_type_code CHAR, service_details VARCHAR)
CREATE TABLE Organizations (organization_id INT, parent_organization_id INT, organization_details VARCHAR)
| What is the proportion of each customer's move in date? Show me the bar chart. | SELECT date_moved_in, COUNT(date_moved_in) FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id GROUP BY date_moved_in | SELECT "date_moved_in", COUNT("date_moved_in") FROM "Customers" AS "T1" JOIN "Customer_Events" AS "T2" ON "T1"."customer_id" = "T2"."customer_id" GROUP BY "date_moved_in" | 0.166016 |
CREATE TABLE table_name_93 (site VARCHAR, superintendent VARCHAR)
| What is the site when the superintendent was James Sever? | SELECT site FROM table_name_93 WHERE superintendent = "james sever" | SELECT "site" FROM "table_name_93" WHERE "james sever" = "superintendent" | 0.071289 |
CREATE TABLE table_25438110_5 (casinos VARCHAR, fy09_$millions VARCHAR)
| How many casinos are associated with a FY2009 $mil value of exactly $279? | SELECT COUNT(casinos) FROM table_25438110_5 WHERE fy09_$millions = "$279" | SELECT COUNT("casinos") FROM "table_25438110_5" WHERE "$279" = "fy09_$millions" | 0.077148 |
CREATE TABLE Manufacturers (Code INT, Name VARCHAR, Headquarter VARCHAR, Founder VARCHAR, Revenue FLOAT)
CREATE TABLE Products (Code INT, Name VARCHAR, Price DECIMAL, Manufacturer INT)
| For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of name and manufacturer , and group by attribute name, could you sort by the X-axis in desc? | SELECT T1.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name, T1.Name ORDER BY T1.Name DESC | SELECT "T1"."Name", "T1"."Manufacturer" FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "T1"."Name", "T1"."Name" ORDER BY "T1"."Name" DESC NULLS LAST | 0.195313 |
CREATE TABLE table_name_11 (year INT, date VARCHAR)
| Which Year has a Date of 14 February? | SELECT MIN(year) FROM table_name_11 WHERE date = "14 february" | SELECT MIN("year") FROM "table_name_11" WHERE "14 february" = "date" | 0.066406 |
CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR)
CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT)
CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT)
CREATE TABLE days (days_code VARCHAR, day_name VARCHAR)
CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_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 ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT)
CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR)
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 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 compartment_class (compartment VARCHAR, class_type VARCHAR)
CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT)
CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT)
CREATE TABLE month (month_number INT, month_name TEXT)
CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT)
CREATE TABLE code_description (code VARCHAR, description 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 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 class_of_service (booking_class VARCHAR, rank INT, class_description TEXT)
CREATE TABLE state (state_code TEXT, state_name TEXT, country_name 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 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)
| show me all flights from PITTSBURGH to BALTIMORE tomorrow | 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, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND date_day.day_number = 20 AND date_day.month_number = 1 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code | SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "date_day" ON "date_day"."day_number" = 20 AND "date_day"."month_number" = 1 AND "date_day"."year" = 1991 JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'PITTSBURGH' JOIN "days" ON "date_day"."day_name" = "days"."day_name" JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "days"."days_code" = "flight"."flight_days" 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" = 'BALTIMORE' | 0.709961 |
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT)
CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other)
CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT)
CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT)
CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT)
CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL)
CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL)
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT)
CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL)
CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL)
CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN)
CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT)
CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL)
CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME)
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL)
CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
CREATE TABLE PostTypes (Id DECIMAL, Name TEXT)
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME)
CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL)
| Upvotes and downvotes on HNQ questions. | SELECT HNQed.PostId AS "post_link", HNQed.CreationDate AS HNQedDate, COUNT(CASE WHEN questionVotes.VoteTypeId = 2 THEN 1 ELSE NULL END) AS UpVotes, COUNT(CASE WHEN questionVotes.VoteTypeId = 3 THEN 1 ELSE NULL END) AS DownVotes, COUNT(*) AS TotalVotes, ROUND(CAST(COUNT(CASE WHEN questionVotes.VoteTypeId = 3 THEN 1 ELSE NULL END) AS FLOAT) / CAST(COUNT(*) AS FLOAT), 2) AS FractionDownvotes FROM PostHistory AS HNQed JOIN Votes AS questionVotes ON HNQed.PostId = questionVotes.PostId WHERE HNQed.PostHistoryTypeId = 52 AND questionVotes.VoteTypeId IN (2, 3) GROUP BY HNQed.PostId, HNQed.CreationDate ORDER BY HNQedDate DESC | SELECT "HNQed"."PostId" AS "post_link", "HNQed"."CreationDate" AS "HNQedDate", COUNT(CASE WHEN "questionVotes"."VoteTypeId" = 2 THEN 1 ELSE NULL END) AS "UpVotes", COUNT(CASE WHEN "questionVotes"."VoteTypeId" = 3 THEN 1 ELSE NULL END) AS "DownVotes", COUNT(*) AS "TotalVotes", ROUND(CAST(COUNT(CASE WHEN "questionVotes"."VoteTypeId" = 3 THEN 1 ELSE NULL END) AS FLOAT) / NULLIF(CAST(COUNT(*) AS FLOAT), 0), 2) AS "FractionDownvotes" FROM "PostHistory" AS "HNQed" JOIN "Votes" AS "questionVotes" ON "HNQed"."PostId" = "questionVotes"."PostId" AND "questionVotes"."VoteTypeId" IN (2, 3) WHERE "HNQed"."PostHistoryTypeId" = 52 GROUP BY "HNQed"."PostId", "HNQed"."CreationDate" ORDER BY "HNQedDate" DESC NULLS LAST | 0.693359 |
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL)
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 d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT)
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
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 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 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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value 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)
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
| tell me the top five most common output events that were in this year? | SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT outputevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM outputevents WHERE DATETIME(outputevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY outputevents.itemid) AS t1 WHERE t1.c1 <= 5) | WITH "t1" AS (SELECT "outputevents"."itemid", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "outputevents" WHERE DATETIME("outputevents"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY "outputevents"."itemid"), "_u_0" AS (SELECT "t1"."itemid" FROM "t1" AS "t1" WHERE "t1"."c1" <= 5 GROUP BY "itemid") SELECT "d_items"."label" FROM "d_items" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "d_items"."itemid" WHERE NOT "_u_0"."" IS NULL | 0.484375 |
CREATE TABLE table_name_5 (school_club_team VARCHAR, player VARCHAR)
| What School/Club Team is Player Aaron Williams from? | SELECT school_club_team FROM table_name_5 WHERE player = "aaron williams" | SELECT "school_club_team" FROM "table_name_5" WHERE "aaron williams" = "player" | 0.077148 |
CREATE TABLE flight_fare (flight_id INT, fare_id INT)
CREATE TABLE days (days_code VARCHAR, day_name VARCHAR)
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 date_day (month_number INT, day_number INT, year INT, day_name VARCHAR)
CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT)
CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR)
CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT)
CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT)
CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt 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 food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR)
CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_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 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 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 (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 ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT)
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 month (month_number INT, month_name TEXT)
CREATE TABLE code_description (code VARCHAR, description TEXT)
CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description 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 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 time_interval (period TEXT, begin_time INT, end_time INT)
| could you please tell me the cheapest flight from BOSTON to SAN FRANCISCO | 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, fare, flight, flight_fare WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND fare.one_direction_cost = (SELECT MIN(FAREalias1.one_direction_cost) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, fare AS FAREalias1, flight AS FLIGHTalias1, flight_fare AS FLIGHT_FAREalias1 WHERE CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'BOSTON' AND CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'SAN FRANCISCO' AND FLIGHT_FAREalias1.fare_id = FAREalias1.fare_id AND FLIGHTalias1.flight_id = FLIGHT_FAREalias1.flight_id AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code) AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id | WITH "_u_0" AS (SELECT MIN("FAREalias1"."one_direction_cost") FROM "airport_service" AS "AIRPORT_SERVICEalias2" JOIN "city" AS "CITYalias2" ON "AIRPORT_SERVICEalias2"."city_code" = "CITYalias2"."city_code" AND "CITYalias2"."city_name" = 'BOSTON' JOIN "flight" AS "FLIGHTalias1" ON "AIRPORT_SERVICEalias2"."airport_code" = "FLIGHTalias1"."from_airport" JOIN "airport_service" AS "AIRPORT_SERVICEalias3" ON "AIRPORT_SERVICEalias3"."airport_code" = "FLIGHTalias1"."to_airport" JOIN "flight_fare" AS "FLIGHT_FAREalias1" ON "FLIGHT_FAREalias1"."flight_id" = "FLIGHTalias1"."flight_id" JOIN "city" AS "CITYalias3" ON "AIRPORT_SERVICEalias3"."city_code" = "CITYalias3"."city_code" AND "CITYalias3"."city_name" = 'SAN FRANCISCO' JOIN "fare" AS "FAREalias1" ON "FAREalias1"."fare_id" = "FLIGHT_FAREalias1"."fare_id") 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" = 'BOSTON' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "flight_fare" ON "flight"."flight_id" = "flight_fare"."flight_id" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'SAN FRANCISCO' JOIN "fare" ON "fare"."fare_id" = "flight_fare"."fare_id" JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "fare"."one_direction_cost" | 1.477539 |
CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL)
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 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 treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime 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)
CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
| had the heartrate in patient 009-11591 been ever less than 88.0 on 10/10/2105? | SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-11591')) AND vitalperiodic.heartrate < 88.0 AND NOT vitalperiodic.heartrate IS NULL AND STRFTIME('%y-%m-%d', vitalperiodic.observationtime) = '2105-10-10' | WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '009-11591' 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 COUNT(*) > 0 FROM "vitalperiodic" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "vitalperiodic"."patientunitstayid" WHERE "vitalperiodic"."heartrate" < 88.0 AND NOT "_u_1"."" IS NULL AND NOT "vitalperiodic"."heartrate" IS NULL AND STRFTIME('%y-%m-%d', "vitalperiodic"."observationtime") = '2105-10-10' | 0.646484 |
CREATE TABLE table_10523 ("Date" TEXT, "Visitor" TEXT, "Score" TEXT, "Home" TEXT, "Record" TEXT)
| When was the home game for the NY Islanders? | SELECT "Date" FROM table_10523 WHERE "Home" = 'ny islanders' | SELECT "Date" FROM "table_10523" WHERE "Home" = 'ny islanders' | 0.060547 |
CREATE TABLE table_71517 ("Date" TEXT, "Tournament" TEXT, "Winning score" TEXT, "Margin of victory" TEXT, "Runner-up" TEXT)
| Which runner-up has a 10 strokes margin of victory? | SELECT "Runner-up" FROM table_71517 WHERE "Margin of victory" = '10 strokes' | SELECT "Runner-up" FROM "table_71517" WHERE "Margin of victory" = '10 strokes' | 0.076172 |
CREATE TABLE table_name_66 (wins INT, tournament VARCHAR, top_25 VARCHAR)
| Which totals tournament has the lowest wins and top-25 less than 4? | SELECT MIN(wins) FROM table_name_66 WHERE tournament = "totals" AND top_25 < 4 | SELECT MIN("wins") FROM "table_name_66" WHERE "top_25" < 4 AND "totals" = "tournament" | 0.083984 |
CREATE TABLE CLASS (CLASS_CODE VARCHAR, CRS_CODE VARCHAR, CLASS_SECTION VARCHAR, CLASS_TIME VARCHAR, CLASS_ROOM VARCHAR, PROF_NUM INT)
CREATE TABLE PROFESSOR (EMP_NUM INT, DEPT_CODE VARCHAR, PROF_OFFICE VARCHAR, PROF_EXTENSION VARCHAR, PROF_HIGH_DEGREE VARCHAR)
CREATE TABLE STUDENT (STU_NUM INT, STU_LNAME VARCHAR, STU_FNAME VARCHAR, STU_INIT VARCHAR, STU_DOB DATETIME, STU_HRS INT, STU_CLASS VARCHAR, STU_GPA FLOAT, STU_TRANSFER DECIMAL, DEPT_CODE VARCHAR, STU_PHONE VARCHAR, PROF_NUM INT)
CREATE TABLE DEPARTMENT (DEPT_CODE VARCHAR, DEPT_NAME VARCHAR, SCHOOL_CODE VARCHAR, EMP_NUM INT, DEPT_ADDRESS VARCHAR, DEPT_EXTENSION VARCHAR)
CREATE TABLE ENROLL (CLASS_CODE VARCHAR, STU_NUM INT, ENROLL_GRADE VARCHAR)
CREATE TABLE EMPLOYEE (EMP_NUM INT, EMP_LNAME VARCHAR, EMP_FNAME VARCHAR, EMP_INITIAL VARCHAR, EMP_JOBCODE VARCHAR, EMP_HIREDATE DATETIME, EMP_DOB DATETIME)
CREATE TABLE COURSE (CRS_CODE VARCHAR, DEPT_CODE VARCHAR, CRS_DESCRIPTION VARCHAR, CRS_CREDIT FLOAT)
| Scatter plot to show max(stu gpa) on x axis and minimal stu gpa on y axis. | SELECT MAX(STU_GPA), MIN(STU_GPA) FROM STUDENT | SELECT MAX("STU_GPA"), MIN("STU_GPA") FROM "STUDENT" | 0.050781 |
CREATE TABLE table_60624 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" FLOAT, "Money ( $ ) " FLOAT)
| WHAT IS THE LOWEST MONEY WITH TO PAR LARGER THAN 26? | SELECT MIN("Money ( $ )") FROM table_60624 WHERE "To par" > '26' | SELECT MIN("Money ( $ )") FROM "table_60624" WHERE "To par" > '26' | 0.064453 |
CREATE TABLE table_38213 ("Year" FLOAT, "Country/Territory" TEXT, "Miss World" TEXT, "National title" TEXT, "Location" TEXT)
| At what Location was Miss World 2009? | SELECT "Location" FROM table_38213 WHERE "Year" = '2009' | SELECT "Location" FROM "table_38213" WHERE "Year" = '2009' | 0.056641 |
CREATE TABLE tryout (cName VARCHAR, pPos VARCHAR)
| Find the names of schools that have some students playing in goalie and mid positions. | SELECT cName FROM tryout WHERE pPos = 'goalie' INTERSECT SELECT cName FROM tryout WHERE pPos = 'mid' | SELECT "cName" FROM "tryout" WHERE "pPos" = 'goalie' INTERSECT SELECT "cName" FROM "tryout" WHERE "pPos" = 'mid' | 0.109375 |
CREATE TABLE record (ID INT, Result TEXT, Swimmer_ID INT, Event_ID INT)
CREATE TABLE stadium (ID INT, name TEXT, Capacity INT, City TEXT, Country TEXT, Opening_year INT)
CREATE TABLE event (ID INT, Name TEXT, Stadium_ID INT, Year TEXT)
CREATE TABLE swimmer (ID INT, name TEXT, Nationality TEXT, meter_100 FLOAT, meter_200 TEXT, meter_300 TEXT, meter_400 TEXT, meter_500 TEXT, meter_600 TEXT, meter_700 TEXT, Time TEXT)
| Visualize a bar chart about the distribution of Nationality and the amount of Nationality , and group by attribute Nationality, and display by the bars in descending. | SELECT Nationality, COUNT(Nationality) FROM swimmer GROUP BY Nationality ORDER BY Nationality DESC | SELECT "Nationality", COUNT("Nationality") FROM "swimmer" GROUP BY "Nationality" ORDER BY "Nationality" DESC NULLS LAST | 0.116211 |
CREATE TABLE table_34530 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Ground" TEXT, "Crowd" FLOAT, "Date" TEXT, "Report" TEXT)
| what report was in geelong | SELECT "Report" FROM table_34530 WHERE "Home team" = 'geelong' | SELECT "Report" FROM "table_34530" WHERE "Home team" = 'geelong' | 0.0625 |
CREATE TABLE table_43609 ("Rank" FLOAT, "Title" TEXT, "Studio" TEXT, "Director" TEXT, "Worldwide Gross" TEXT)
| what is the title for director p.j. hogan? | SELECT "Title" FROM table_43609 WHERE "Director" = 'p.j. hogan' | SELECT "Title" FROM "table_43609" WHERE "Director" = 'p.j. hogan' | 0.063477 |
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 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 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)
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 cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
| what was the yearly average value of weight for patient 007-13494 until 02/2105? | SELECT AVG(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-13494') AND NOT patient.admissionweight IS NULL AND STRFTIME('%y-%m', patient.unitadmittime) <= '2105-02' GROUP BY STRFTIME('%y', patient.unitadmittime) | WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '007-13494' GROUP BY "patienthealthsystemstayid") SELECT AVG("patient"."admissionweight") FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL AND NOT "patient"."admissionweight" IS NULL AND STRFTIME('%y-%m', "patient"."unitadmittime") <= '2105-02' GROUP BY STRFTIME('%y', "patient"."unitadmittime") | 0.463867 |
CREATE TABLE activity (actid DECIMAL, activity_name TEXT)
CREATE TABLE participates_in (stuid DECIMAL, actid DECIMAL)
CREATE TABLE student (stuid DECIMAL, lname TEXT, fname TEXT, age DECIMAL, sex TEXT, major DECIMAL, advisor DECIMAL, city_code TEXT)
CREATE TABLE faculty (facid DECIMAL, lname TEXT, fname TEXT, rank TEXT, sex TEXT, phone DECIMAL, room TEXT, building TEXT)
CREATE TABLE faculty_participates_in (facid DECIMAL, actid DECIMAL)
| Find the number of activities Mark Giuliano is involved in. | SELECT COUNT(*) FROM faculty AS T1 JOIN faculty_participates_in AS T2 ON T1.facid = T2.facid WHERE T1.fname = "Mark" AND T1.lname = "Giuliano" | SELECT COUNT(*) FROM "faculty" AS "T1" JOIN "faculty_participates_in" AS "T2" ON "T1"."facid" = "T2"."facid" WHERE "Giuliano" = "T1"."lname" AND "Mark" = "T1"."fname" | 0.162109 |
CREATE TABLE table_name_54 (player VARCHAR, span VARCHAR)
| What player has a span of 1997-2009? | SELECT player FROM table_name_54 WHERE span = "1997-2009" | SELECT "player" FROM "table_name_54" WHERE "1997-2009" = "span" | 0.061523 |
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)
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)
| let me know the age and religion of patient with patient id 29961. | SELECT demographic.age, demographic.religion FROM demographic WHERE demographic.subject_id = "29961" | SELECT "demographic"."age", "demographic"."religion" FROM "demographic" WHERE "29961" = "demographic"."subject_id" | 0.111328 |
CREATE TABLE table_72793 ("Player" TEXT, "No." FLOAT, "Nationality" TEXT, "Position" TEXT, "Years for Grizzlies" TEXT, "School/Club Team" TEXT)
| what's the highest player number from the list from 2000-2001 | SELECT MAX("No.") FROM table_72793 WHERE "Years for Grizzlies" = '2000-2001' | SELECT MAX("No.") FROM "table_72793" WHERE "Years for Grizzlies" = '2000-2001' | 0.076172 |
CREATE TABLE table_16494599_1 (player VARCHAR, years_for_grizzlies VARCHAR)
| What player was on the Grizzlies from 2009-2013? | SELECT player FROM table_16494599_1 WHERE years_for_grizzlies = "2009-2013" | SELECT "player" FROM "table_16494599_1" WHERE "2009-2013" = "years_for_grizzlies" | 0.079102 |
CREATE TABLE table_46322 ("Club" TEXT, "Played" TEXT, "Drawn" TEXT, "Lost" TEXT, "Points for" TEXT, "Points against" TEXT, "Points difference" TEXT, "Bonus Points" TEXT, "Points" TEXT)
| What is Points, when Points is 60, and when Club is Bedwas RFC? | SELECT "Points for" FROM table_46322 WHERE "Points" = '60' AND "Club" = 'bedwas rfc' | SELECT "Points for" FROM "table_46322" WHERE "Club" = 'bedwas rfc' AND "Points" = '60' | 0.083984 |
CREATE TABLE Dorm_amenity (amenid INT, amenity_name VARCHAR)
CREATE TABLE Dorm (dormid INT, dorm_name VARCHAR, student_capacity INT, gender VARCHAR)
CREATE TABLE Has_amenity (dormid INT, amenid INT)
CREATE TABLE Student (StuID INT, LName VARCHAR, Fname VARCHAR, Age INT, Sex VARCHAR, Major INT, Advisor INT, city_code VARCHAR)
CREATE TABLE Lives_in (stuid INT, dormid INT, room_number INT)
| Find the number of students living in each city with a bar chart, and display in ascending by the Y. | SELECT city_code, COUNT(*) FROM Student GROUP BY city_code ORDER BY COUNT(*) | SELECT "city_code", COUNT(*) FROM "Student" GROUP BY "city_code" ORDER BY COUNT(*) NULLS FIRST | 0.091797 |
CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN)
CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT)
CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL)
CREATE TABLE PostTypes (Id DECIMAL, Name TEXT)
CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL)
CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other)
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL)
CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL)
CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT)
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT)
CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME)
CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL)
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME)
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT)
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL)
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT)
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT)
CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL)
| Top 10 users Ahmedabad India. | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%Ahmedabad%' OR UPPER(Location) LIKE '%Ahmedabad%' OR Location LIKE '%Ahmedabad%' AND Reputation >= 1000 ORDER BY Reputation DESC | SELECT ROW_NUMBER() OVER (ORDER BY "Reputation" DESC NULLS LAST) AS "#", "Id" AS "user_link", "Reputation" FROM "Users" WHERE ("Location" LIKE '%Ahmedabad%' OR LOWER("Location") LIKE '%Ahmedabad%' OR UPPER("Location") LIKE '%Ahmedabad%') AND "Reputation" >= 1000 ORDER BY "Reputation" DESC NULLS LAST | 0.292969 |
CREATE TABLE table_171748_3 (period VARCHAR, _percentage_trains_arriving_within_5_mins_of_scheduled_time_moving_annual_average__maa_ VARCHAR)
| When was the percentage of trains arriving within 5 minutes of scheduled time 89.6%? | SELECT period FROM table_171748_3 WHERE _percentage_trains_arriving_within_5_mins_of_scheduled_time_moving_annual_average__maa_ = "89.6%" | SELECT "period" FROM "table_171748_3" WHERE "89.6%" = "_percentage_trains_arriving_within_5_mins_of_scheduled_time_moving_annual_average__maa_" | 0.139648 |
CREATE TABLE table_18989 ("Country/Region" TEXT, "Local title" TEXT, "Television network" TEXT, "Seasons and winners" TEXT, "Judges" TEXT, "Presenters" TEXT)
| how many local title with televbeingion network being tv nova website | SELECT COUNT("Local title") FROM table_18989 WHERE "Television network" = 'TV Nova Website' | SELECT COUNT("Local title") FROM "table_18989" WHERE "Television network" = 'TV Nova Website' | 0.09082 |
CREATE TABLE table_203_340 (id DECIMAL, "rank" DECIMAL, "airport" TEXT, "passengers handled" DECIMAL, "% change 2011 / 12" DECIMAL)
| how many airports in spain are among the 10 busiest routes to and from london southend airport in 2012 ? | SELECT COUNT("airport") FROM table_203_340 WHERE "airport" = 'spain' | SELECT COUNT("airport") FROM "table_203_340" WHERE "airport" = 'spain' | 0.068359 |
CREATE TABLE table_name_10 (record VARCHAR, score VARCHAR)
| What is the record for the game with a score of 7 5? | SELECT record FROM table_name_10 WHERE score = "7β5" | SELECT "record" FROM "table_name_10" WHERE "7β5" = "score" | 0.056641 |
CREATE TABLE table_name_56 (year INT, role VARCHAR, director VARCHAR)
| What year was the role nan taylor, alias of nan ellis, aka mrs. andrews and directed by William keighley? | SELECT SUM(year) FROM table_name_56 WHERE role = "nan taylor, alias of nan ellis, aka mrs. andrews" AND director = "william keighley" | SELECT SUM("year") FROM "table_name_56" WHERE "director" = "william keighley" AND "nan taylor, alias of nan ellis, aka mrs. andrews" = "role" | 0.137695 |
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 diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT)
CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime 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 treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME)
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 medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME)
| patient 004-44470 has had oral diuretic - thiazides in other hospitals during this year? | SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '004-44470' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '004-44470' AND patient.hospitaldischargetime IS NULL)) AND treatment.treatmentname = 'oral diuretic - thiazides' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') | WITH "_u_0" AS (SELECT DISTINCT "patient"."hospitalid" FROM "patient" WHERE "patient"."hospitaldischargetime" IS NULL AND "patient"."uniquepid" = '004-44470'), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" JOIN "_u_0" AS "_u_0" ON "_u_0"."hospitalid" <> "patient"."hospitalid" WHERE "patient"."uniquepid" = '004-44470' GROUP BY "patientunitstayid") SELECT COUNT(*) > 0 FROM "treatment" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "treatment"."patientunitstayid" WHERE "treatment"."treatmentname" = 'oral diuretic - thiazides' AND DATETIME("treatment"."treatmenttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND NOT "_u_1"."" IS NULL | 0.664063 |
CREATE TABLE customer_orders (order_id DECIMAL, customer_id DECIMAL, order_status_code TEXT, shipping_method_code TEXT, order_placed_datetime TIME, order_delivered_datetime TIME, order_shipping_charges TEXT)
CREATE TABLE customers (customer_id DECIMAL, payment_method TEXT, customer_name TEXT, customer_phone TEXT, customer_email TEXT, customer_address TEXT, customer_login TEXT, customer_password TEXT)
CREATE TABLE customer_addresses (customer_id DECIMAL, premise_id DECIMAL, date_address_from TIME, address_type_code TEXT, date_address_to TIME)
CREATE TABLE premises (premise_id DECIMAL, premises_type TEXT, premise_details TEXT)
CREATE TABLE order_items (item_id DECIMAL, order_item_status_code TEXT, order_id DECIMAL, product_id DECIMAL, item_status_code TEXT, item_delivered_datetime TIME, item_order_quantity TEXT)
CREATE TABLE mailshot_campaigns (mailshot_id DECIMAL, product_category TEXT, mailshot_name TEXT, mailshot_start_date TIME, mailshot_end_date TIME)
CREATE TABLE mailshot_customers (mailshot_id DECIMAL, customer_id DECIMAL, outcome_code TEXT, mailshot_customer_date TIME)
CREATE TABLE products (product_id DECIMAL, product_category TEXT, product_name TEXT)
| Show the names of customers having an order with shipping method FedEx and order status Paid. | SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE shipping_method_code = 'FedEx' AND order_status_code = 'Paid' | SELECT "T1"."customer_name" FROM "customers" AS "T1" JOIN "customer_orders" AS "T2" ON "T1"."customer_id" = "T2"."customer_id" WHERE "order_status_code" = 'Paid' AND "shipping_method_code" = 'FedEx' | 0.193359 |
CREATE TABLE table_name_73 (result VARCHAR, home_away VARCHAR, opponent VARCHAR)
| What is the result when you play at home against Pride | SELECT result FROM table_name_73 WHERE home_away = "home" AND opponent = "pride" | SELECT "result" FROM "table_name_73" WHERE "home" = "home_away" AND "opponent" = "pride" | 0.085938 |
CREATE TABLE table_name_18 (away_team VARCHAR)
| What was Fitzroy's score when they were the away team? | SELECT away_team AS score FROM table_name_18 WHERE away_team = "fitzroy" | SELECT "away_team" AS "score" FROM "table_name_18" WHERE "away_team" = "fitzroy" | 0.078125 |
CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR)
CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT)
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 month (month_number INT, month_name TEXT)
CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT)
CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant 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 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 time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT)
CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR)
CREATE TABLE code_description (code VARCHAR, description TEXT)
CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT)
CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT)
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 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 ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT)
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 date_day (month_number INT, day_number INT, year INT, day_name VARCHAR)
CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT)
CREATE TABLE flight_fare (flight_id INT, fare_id INT)
CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR)
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 days (days_code VARCHAR, day_name VARCHAR)
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)
| is there an AA flight in the evening from DALLAS to SAN FRANCISCO | 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.departure_time <= 1800 AND flight.departure_time >= 2200) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.airline_code = 'AA' | 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" = 'SAN FRANCISCO' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "flight"."airline_code" = 'AA' AND "flight"."departure_time" <= 1800 AND "flight"."departure_time" >= 2200 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" = 'DALLAS' | 0.607422 |
CREATE TABLE table_80259 ("Date" TEXT, "Opponent" TEXT, "Score" TEXT, "Loss" TEXT, "Attendance" TEXT, "Record" TEXT)
| What team did they lose to when they had a 28-22 record? | SELECT "Loss" FROM table_80259 WHERE "Record" = '28-22' | SELECT "Loss" FROM "table_80259" WHERE "Record" = '28-22' | 0.055664 |
CREATE TABLE table_name_35 (points VARCHAR, podiums VARCHAR)
| What were the points in the year when his Podiums were 5? | SELECT points FROM table_name_35 WHERE podiums = "5" | SELECT "points" FROM "table_name_35" WHERE "5" = "podiums" | 0.056641 |
CREATE TABLE table_49241 ("Call sign" TEXT, "Frequency MHz" FLOAT, "City of license" TEXT, "ERP W" FLOAT, "Class" TEXT, "FCC info" TEXT)
| Which City of license has a Frequency MHz larger than 89.5, and a Call sign of k213el? | SELECT "City of license" FROM table_49241 WHERE "Frequency MHz" > '89.5' AND "Call sign" = 'k213el' | SELECT "City of license" FROM "table_49241" WHERE "Call sign" = 'k213el' AND "Frequency MHz" > '89.5' | 0.098633 |
CREATE TABLE club (club_id DECIMAL, name TEXT, region TEXT, start_year TEXT)
CREATE TABLE competition (competition_id DECIMAL, year DECIMAL, competition_type TEXT, country TEXT)
CREATE TABLE player (player_id DECIMAL, name TEXT, position TEXT, club_id DECIMAL, apps DECIMAL, tries DECIMAL, goals TEXT, points DECIMAL)
CREATE TABLE competition_result (competition_id DECIMAL, club_id_1 DECIMAL, club_id_2 DECIMAL, score TEXT)
CREATE TABLE club_rank (rank DECIMAL, club_id DECIMAL, gold DECIMAL, silver DECIMAL, bronze DECIMAL, total DECIMAL)
| What is the average number of points for players from the 'AIB' club? | SELECT AVG(T2.points) FROM club AS T1 JOIN player AS T2 ON T1.club_id = T2.club_id WHERE T1.name = "AIB" | SELECT AVG("T2"."points") FROM "club" AS "T1" JOIN "player" AS "T2" ON "T1"."club_id" = "T2"."club_id" WHERE "AIB" = "T1"."name" | 0.125 |
CREATE TABLE table_204_139 (id DECIMAL, "community" TEXT, "airport name" TEXT, "type" TEXT, "coordinates" TEXT)
| which airport is above tarampa airfield ? | SELECT "airport name" FROM table_204_139 WHERE id = (SELECT id FROM table_204_139 WHERE "airport name" = 'tarampa airfield') - 1 | SELECT "airport name" FROM "table_204_139" WHERE "id" = (SELECT "id" FROM "table_204_139" WHERE "airport name" = 'tarampa airfield') - 1 | 0.132813 |
CREATE TABLE table_19704392_1 (modified_speed__6th_gear_ VARCHAR, standard_torque__lb_ft_ VARCHAR, modified_torque__lb_ft_ VARCHAR)
| What is the modified speed (6th gear) when standard torque (lb/ft) is 10.3 and modified torque (lb/ft) is 8.75? | SELECT modified_speed__6th_gear_ FROM table_19704392_1 WHERE standard_torque__lb_ft_ = "10.3" AND modified_torque__lb_ft_ = "8.75" | SELECT "modified_speed__6th_gear_" FROM "table_19704392_1" WHERE "10.3" = "standard_torque__lb_ft_" AND "8.75" = "modified_torque__lb_ft_" | 0.134766 |
CREATE TABLE table_name_47 (nationality VARCHAR, position VARCHAR, school_club_team VARCHAR)
| What is the nationality for the guard position from Bowling Green? | SELECT nationality FROM table_name_47 WHERE position = "guard" AND school_club_team = "bowling green" | SELECT "nationality" FROM "table_name_47" WHERE "bowling green" = "school_club_team" AND "guard" = "position" | 0.106445 |
CREATE TABLE table_name_58 (year VARCHAR, score VARCHAR)
| What year had a score of 6 2, 2 6, 5 7, 7 6, 8 6? | SELECT year FROM table_name_58 WHERE score = "6β2, 2β6, 5β7, 7β6, 8β6" | SELECT "year" FROM "table_name_58" WHERE "6β2, 2β6, 5β7, 7β6, 8β6" = "score" | 0.074219 |
CREATE TABLE table_33445 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
| Who is the away side at junction oval? | SELECT "Away team" FROM table_33445 WHERE "Venue" = 'junction oval' | SELECT "Away team" FROM "table_33445" WHERE "Venue" = 'junction oval' | 0.067383 |
CREATE TABLE table_40641 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Attendance" TEXT)
| Name the Result on october 15, 1995? | SELECT "Result" FROM table_40641 WHERE "Date" = 'october 15, 1995' | SELECT "Result" FROM "table_40641" WHERE "Date" = 'october 15, 1995' | 0.066406 |
CREATE TABLE table_20011 ("Position" FLOAT, "Team" TEXT, "Points" FLOAT, "Played" FLOAT, "Won" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "For" FLOAT, "Against" FLOAT, "Difference" TEXT)
| Name the number of lost for against being 46 | SELECT COUNT("Lost") FROM table_20011 WHERE "Against" = '46' | SELECT COUNT("Lost") FROM "table_20011" WHERE "Against" = '46' | 0.060547 |
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 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 cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL)
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_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 diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT)
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME)
CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title 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 chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom 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)
| how much is the amyloidosis nec diagnostic cost? | SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'diagnoses_icd' AND cost.event_id IN (SELECT diagnoses_icd.row_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 = 'amyloidosis nec')) | WITH "_u_1" AS (SELECT "diagnoses_icd"."row_id" FROM "diagnoses_icd" JOIN "d_icd_diagnoses" ON "d_icd_diagnoses"."icd9_code" = "diagnoses_icd"."icd9_code" AND "d_icd_diagnoses"."short_title" = 'amyloidosis nec' GROUP BY "row_id") SELECT DISTINCT "cost"."cost" FROM "cost" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "cost"."event_id" WHERE "cost"."event_type" = 'diagnoses_icd' AND NOT "_u_1"."" IS NULL | 0.391602 |
CREATE TABLE table_18134 ("District" TEXT, "Incumbent" TEXT, "Party" TEXT, "First elected" FLOAT, "Results" TEXT, "Candidates" TEXT)
| When was the first election in the district whose incumbent is Ron Kind? | SELECT MIN("First elected") FROM table_18134 WHERE "Incumbent" = 'Ron Kind' | SELECT MIN("First elected") FROM "table_18134" WHERE "Incumbent" = 'Ron Kind' | 0.075195 |
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 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)
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 me with the number of inpatient hospital admission patients who have posterior communicating aneurysm/sda as their primary disease. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.diagnosis = "POSTERIOR COMMUNICATING ANEURYSM/SDA" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "POSTERIOR COMMUNICATING ANEURYSM/SDA" = "demographic"."diagnosis" AND "TRANSFER FROM HOSP/EXTRAM" = "demographic"."admission_location" | 0.205078 |
CREATE TABLE table_57146 ("Number & Name" TEXT, "Description" TEXT, "Livery" TEXT, "Owner ( s ) " TEXT, "Date" FLOAT)
| Which owner has a description of Mark 1 CK and is dated 1953? | SELECT "Owner(s)" FROM table_57146 WHERE "Date" = '1953' AND "Description" = 'mark 1 ck' | SELECT "Owner(s)" FROM "table_57146" WHERE "Date" = '1953' AND "Description" = 'mark 1 ck' | 0.087891 |
CREATE TABLE table_59617 ("Combined" TEXT, "50 yard Freestyle" TEXT, "100 yard Freestyle" TEXT, "200 yard Freestyle" TEXT, "500 yard Freestyle" TEXT, "100 yard Backstroke" TEXT, "100 yard Butterfly" TEXT)
| What 100 yard Butterfly has a 100 yard Freestyle of cody miller (palo verde)? | SELECT "100 yard Butterfly" FROM table_59617 WHERE "100 yard Freestyle" = 'cody miller (palo verde)' | SELECT "100 yard Butterfly" FROM "table_59617" WHERE "100 yard Freestyle" = 'cody miller (palo verde)' | 0.099609 |
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL)
CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL)
CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN)
CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL)
CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME)
CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other)
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT)
CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL)
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT)
CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT)
CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL)
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME)
CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT)
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT)
CREATE TABLE PostTypes (Id DECIMAL, Name TEXT)
CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL)
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT)
CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL)
CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
| Scores of users in tags. | WITH scorestags_cte AS (SELECT pt.TagId AS TagId, p.OwnerUserId AS uid, p.OwnerDisplayName AS udn, SUM(p.Score) AS sco, COUNT(p.Id) AS num FROM Posts AS p INNER JOIN Posts AS q ON q.Id = p.ParentId INNER JOIN PostTags AS pt ON q.Id = pt.PostId WHERE (p.CommunityOwnedDate IS NULL) GROUP BY pt.TagId, p.OwnerUserId, p.OwnerDisplayName) SELECT t.TagName, s.uid AS "user_link", s.udn, s.sco AS "score", s.num AS "count" FROM scorestags_cte AS s INNER JOIN Tags AS t ON s.TagId = t.Id WHERE t.TagName = '##TagName##' ORDER BY s.sco DESC | WITH "scorestags_cte" AS (SELECT "pt"."TagId" AS "TagId", "p"."OwnerUserId" AS "uid", "p"."OwnerDisplayName" AS "udn", SUM("p"."Score") AS "sco", COUNT("p"."Id") AS "num" FROM "Posts" AS "p" JOIN "Posts" AS "q" ON "p"."ParentId" = "q"."Id" JOIN "PostTags" AS "pt" ON "pt"."PostId" = "q"."Id" WHERE "p"."CommunityOwnedDate" IS NULL GROUP BY "pt"."TagId", "p"."OwnerUserId", "p"."OwnerDisplayName") SELECT "t"."TagName", "s"."uid" AS "user_link", "s"."udn", "s"."sco" AS "score", "s"."num" AS "count" FROM "scorestags_cte" AS "s" JOIN "Tags" AS "t" ON "s"."TagId" = "t"."Id" AND "t"."TagName" = '##TagName##' ORDER BY "s"."sco" DESC NULLS LAST | 0.625977 |
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 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)
| among patients tested for joint fluid, how many of them had acute nephritis nec? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Acute nephritis NEC" AND lab.fluid = "Joint Fluid" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Acute nephritis NEC" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "Joint Fluid" = "lab"."fluid" AND "demographic"."hadm_id" = "lab"."hadm_id" | 0.273438 |
CREATE TABLE table_26608 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "U.S. viewers ( millions ) " TEXT)
| Who directed 'go your own way'? | SELECT "Directed by" FROM table_26608 WHERE "Title" = 'Go Your Own Way' | SELECT "Directed by" FROM "table_26608" WHERE "Title" = 'Go Your Own Way' | 0.071289 |
CREATE TABLE table_name_95 (home VARCHAR, date VARCHAR)
| What is the home team of the game on April 20? | SELECT home FROM table_name_95 WHERE date = "april 20" | SELECT "home" FROM "table_name_95" WHERE "april 20" = "date" | 0.058594 |
CREATE TABLE table_name_97 (opponent VARCHAR, score VARCHAR)
| Who was the opponent with a score of 141 102? | SELECT opponent FROM table_name_97 WHERE score = "141β102" | SELECT "opponent" FROM "table_name_97" WHERE "141β102" = "score" | 0.0625 |
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 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)
| how many patients were diagnosed with stomatits & mucosits nec? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Stomatits & mucosits NEC" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Stomatits & mucosits NEC" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" | 0.19043 |
CREATE TABLE table_name_31 (opponent_in_the_final VARCHAR, score_in_the_final VARCHAR)
| What Opponent in the final had a match with a Score in the final of 7 5, 6 2? | SELECT opponent_in_the_final FROM table_name_31 WHERE score_in_the_final = "7β5, 6β2" | SELECT "opponent_in_the_final" FROM "table_name_31" WHERE "7β5, 6β2" = "score_in_the_final" | 0.088867 |
CREATE TABLE table_72060 ("Player" TEXT, "Solo" FLOAT, "Total" FLOAT, "Sacks" TEXT, "Fumble force" FLOAT, "Fumble rec" FLOAT)
| How many fumble recoveries for scott gajos with 0 forced fubmles, 0 sacks, and under 2 solo tackles? | SELECT SUM("Fumble rec") FROM table_72060 WHERE "Sacks" = '0' AND "Fumble force" = '0' AND "Player" = 'scott gajos' AND "Solo" < '2' | SELECT SUM("Fumble rec") FROM "table_72060" WHERE "Fumble force" = '0' AND "Player" = 'scott gajos' AND "Sacks" = '0' AND "Solo" < '2' | 0.130859 |
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 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 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 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 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)
| what is five year survival rate of patients diagnosed with pleural effusion? | SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 5 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'pleural effusion' GROUP BY patient.uniquepid HAVING MIN(diagnosis.diagnosistime) = diagnosis.diagnosistime) AS t1 WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', t1.diagnosistime) > 5 * 365) AS t2 JOIN patient ON t2.uniquepid = patient.uniquepid | WITH "t1" AS (SELECT "patient"."uniquepid", "diagnosis"."diagnosistime" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" WHERE "diagnosis"."diagnosisname" = 'pleural effusion' GROUP BY "patient"."uniquepid" HAVING "diagnosis"."diagnosistime" = MIN("diagnosis"."diagnosistime")) SELECT SUM(CASE WHEN "patient"."hospitaldischargestatus" = 'alive' THEN 1 WHEN STRFTIME('%j', "patient"."hospitaldischargetime") - STRFTIME('%j', "t1"."diagnosistime") > 1825 THEN 1 ELSE 0 END) * 100 / NULLIF(COUNT(*), 0) FROM "t1" AS "t1" JOIN "patient" ON "patient"."uniquepid" = "t1"."uniquepid" WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "t1"."diagnosistime") > 1825 | 0.692383 |
CREATE TABLE table_name_92 (cardinalatial_order_and_title VARCHAR, elector VARCHAR)
| What is the cardinalatial order and title of bosone? | SELECT cardinalatial_order_and_title FROM table_name_92 WHERE elector = "bosone" | SELECT "cardinalatial_order_and_title" FROM "table_name_92" WHERE "bosone" = "elector" | 0.083984 |
CREATE TABLE table_name_48 (Id VARCHAR)
| What is the highest 1987 value with a 1995 value less than 1995 and a 1999 less than 9? | SELECT MAX(1987) FROM table_name_48 WHERE 1995 < 1995 AND 1999 < 9 | SELECT MAX(1987) FROM "table_name_48" WHERE FALSE | 0.047852 |
CREATE TABLE table_58795 ("Name" TEXT, "Position" TEXT, "League Apps" TEXT, "League Goals" FLOAT, "FA Cup Apps" TEXT, "FA Cup Goals" FLOAT, "League Cup Apps" TEXT, "League Cup Goals" FLOAT, "Total Apps" TEXT, "Total Goals" FLOAT)
| How many League Cup Goals have 0 as the total goals, with delroy facey as the name? | SELECT COUNT("League Cup Goals") FROM table_58795 WHERE "Total Goals" = '0' AND "Name" = 'delroy facey' | SELECT COUNT("League Cup Goals") FROM "table_58795" WHERE "Name" = 'delroy facey' AND "Total Goals" = '0' | 0.102539 |
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME)
CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT)
CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL)
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT)
CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT)
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT)
CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE PostTypes (Id DECIMAL, Name TEXT)
CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT)
CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL)
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL)
CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL)
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL)
CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN)
CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL)
CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other)
CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME)
CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT)
CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL)
| active users by calendar year. | SELECT COUNT(UserId) AS usercount, period FROM (SELECT UserId, YEAR(CreationDate) AS period FROM Comments UNION SELECT UserId, YEAR(CreationDate) AS period FROM PostHistory UNION SELECT OwnerUserId, YEAR(CreationDate) AS period FROM Posts) AS t GROUP BY period ORDER BY period | WITH "t" AS (SELECT "UserId", YEAR("CreationDate") AS "period" FROM "Comments" UNION SELECT "UserId", YEAR("CreationDate") AS "period" FROM "PostHistory" UNION SELECT "OwnerUserId", YEAR("CreationDate") AS "period" FROM "Posts") SELECT COUNT("UserId") AS "usercount", "period" FROM "t" AS "t" GROUP BY "period" ORDER BY "period" NULLS FIRST | 0.332031 |
CREATE TABLE table_204_756 (id DECIMAL, "year" DECIMAL, "team" TEXT, "games" DECIMAL, "combined tackles" DECIMAL, "tackles" DECIMAL, "assisted tackles" DECIMAL, "sacks" DECIMAL, "forced fumbles" DECIMAL, "fumble recoveries" DECIMAL, "fumble return yards" DECIMAL, "interceptions" DECIMAL, "interception return yards" DECIMAL, "yards per interception return" DECIMAL, "longest interception return" DECIMAL, "interceptions returned for touchdown" DECIMAL, "passes defended" DECIMAL)
| what was the number of combined tackles in 2010 ? | SELECT "combined tackles" FROM table_204_756 WHERE "year" = 2010 | SELECT "combined tackles" FROM "table_204_756" WHERE "year" = 2010 | 0.064453 |
CREATE TABLE table_19184 ("Cast" TEXT, "1951 ( BBC ) " TEXT, "1957 ( BBC ) " TEXT, "1968 ( BBC ) " TEXT, "1970 ( film ) " TEXT, "2000 ( Carlton Television ) " TEXT)
| Name the 1968 bbc for 1957 bbc anneke wills | SELECT "1968 (BBC)" FROM table_19184 WHERE "1957 (BBC)" = 'Anneke Wills' | SELECT "1968 (BBC)" FROM "table_19184" WHERE "1957 (BBC)" = 'Anneke Wills' | 0.072266 |
CREATE TABLE table_name_69 (date VARCHAR, location VARCHAR)
| What is the date of the match located in Madrid, Esp? | SELECT date FROM table_name_69 WHERE location = "madrid, esp" | SELECT "date" FROM "table_name_69" WHERE "location" = "madrid, esp" | 0.06543 |
CREATE TABLE table_35252 ("Pick #" TEXT, "Player" TEXT, "Position" TEXT, "Nationality" TEXT, "NHL team" TEXT, "College/junior/club team" TEXT)
| Who plays goaltender for the Vancouver Canucks? | SELECT "Player" FROM table_35252 WHERE "Position" = 'goaltender' AND "NHL team" = 'vancouver canucks' | SELECT "Player" FROM "table_35252" WHERE "NHL team" = 'vancouver canucks' AND "Position" = 'goaltender' | 0.100586 |
CREATE TABLE table_44681 ("Game" FLOAT, "Date" TEXT, "Opponent" TEXT, "Score" TEXT, "Location" TEXT, "Attendance" FLOAT, "Record" TEXT, "Points" FLOAT)
| What is the total number of Game, when Attendance is '18,568'? | SELECT COUNT("Game") FROM table_44681 WHERE "Attendance" = '18,568' | SELECT COUNT("Game") FROM "table_44681" WHERE "Attendance" = '18,568' | 0.067383 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.