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_name_90 (race_name VARCHAR, constructor VARCHAR)
Which race was Matra the constructor?
SELECT race_name FROM table_name_90 WHERE constructor = "matra"
SELECT "race_name" FROM "table_name_90" WHERE "constructor" = "matra"
0.067383
CREATE TABLE table_68492 ("Circuit" TEXT, "Location / State" TEXT, "Date" TEXT, "Winning driver" TEXT, "Team" TEXT)
what date was mallala motor sport park the circuit?
SELECT "Date" FROM table_68492 WHERE "Circuit" = 'mallala motor sport park'
SELECT "Date" FROM "table_68492" WHERE "Circuit" = 'mallala motor sport park'
0.075195
CREATE TABLE table_62825 ("Rank" FLOAT, "Lane" FLOAT, "Athlete" TEXT, "Nationality" TEXT, "Time" FLOAT, "React" FLOAT)
Which lane did the swimmer who had a Reaction time of 0.185 and a time of 20.9 swim in?
SELECT SUM("Lane") FROM table_62825 WHERE "React" = '0.185' AND "Time" < '20.9'
SELECT SUM("Lane") FROM "table_62825" WHERE "React" = '0.185' AND "Time" < '20.9'
0.079102
CREATE TABLE table_18143210_2 (number_of_seasons_in_top_division INT, first_season_in_top_division VARCHAR)
How many 'number of seasons in top division' were played if the 'first season in top division' games is in 1990-91?
SELECT MAX(number_of_seasons_in_top_division) FROM table_18143210_2 WHERE first_season_in_top_division = "1990-91"
SELECT MAX("number_of_seasons_in_top_division") FROM "table_18143210_2" WHERE "1990-91" = "first_season_in_top_division"
0.117188
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) 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 diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
what is age and icu stay id of subject id 2560?
SELECT demographic.age, prescriptions.icustay_id FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "2560"
SELECT "demographic"."age", "prescriptions"."icustay_id" FROM "demographic" JOIN "prescriptions" ON "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "2560" = "demographic"."subject_id"
0.188477
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 the average age of patients who have government insurance policy and got admitted in or after the year 2176?
SELECT AVG(demographic.age) FROM demographic WHERE demographic.insurance = "Government" AND demographic.admityear >= "2176"
SELECT AVG("demographic"."age") FROM "demographic" WHERE "2176" <= "demographic"."admityear" AND "Government" = "demographic"."insurance"
0.133789
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
tell me the icu stay id for patient stephanie suchan.
SELECT prescriptions.icustay_id FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.name = "Stephanie Suchan"
SELECT "prescriptions"."icustay_id" FROM "demographic" JOIN "prescriptions" ON "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "Stephanie Suchan" = "demographic"."name"
0.173828
CREATE TABLE table_2004733_2 (barangay VARCHAR, area__in_km_2__ VARCHAR)
What's the name of the barangay whose area is 3.6787 km ?
SELECT barangay FROM table_2004733_2 WHERE area__in_km_2__ = "3.6787"
SELECT "barangay" FROM "table_2004733_2" WHERE "3.6787" = "area__in_km_2__"
0.073242
CREATE TABLE table_name_82 (tournament VARCHAR, date VARCHAR)
What is Tournament, when Date is '6 October 2008'?
SELECT tournament FROM table_name_82 WHERE date = "6 october 2008"
SELECT "tournament" FROM "table_name_82" WHERE "6 october 2008" = "date"
0.070313
CREATE TABLE table_18270 ("District" TEXT, "Incumbent" TEXT, "Party" TEXT, "First elected" FLOAT, "Result" TEXT, "Candidates" TEXT)
Who is the candidate in election where the incumbent was first elected in 1980?
SELECT "Candidates" FROM table_18270 WHERE "First elected" = '1980'
SELECT "Candidates" FROM "table_18270" WHERE "First elected" = '1980'
0.067383
CREATE TABLE table_34097 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Game site" TEXT, "Record" TEXT, "Attendance" TEXT)
What game site had a result at l 21 13?
SELECT "Game site" FROM table_34097 WHERE "Result" = 'l 21–13'
SELECT "Game site" FROM "table_34097" WHERE "Result" = 'l 21–13'
0.0625
CREATE TABLE table_name_55 (away_team VARCHAR, home_team VARCHAR)
Who is the away team when the home team was Fitzroy?
SELECT away_team FROM table_name_55 WHERE home_team = "fitzroy"
SELECT "away_team" FROM "table_name_55" WHERE "fitzroy" = "home_team"
0.067383
CREATE TABLE table_47885 ("Name" TEXT, "Height ( m ) " FLOAT, "Height ( ft ) " FLOAT, "Location" TEXT, "Year built" FLOAT)
What is the lowest height in feet for the building located in platz der einheit 1, gallus, that was built after 1961 with a height less than 130 meters?
SELECT MIN("Height (ft)") FROM table_47885 WHERE "Year built" > '1961' AND "Location" = 'platz der einheit 1, gallus' AND "Height (m)" < '130'
SELECT MIN("Height (ft)") FROM "table_47885" WHERE "Height (m)" < '130' AND "Location" = 'platz der einheit 1, gallus' AND "Year built" > '1961'
0.140625
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 d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto 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 labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime 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 patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) 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 microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT)
had any tube feeding been given to patient 30509 until 11/2105?
SELECT COUNT(*) > 0 FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 30509)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'tube feeding' AND d_items.linksto = 'inputevents_cv') AND STRFTIME('%y-%m', inputevents_cv.charttime) <= '2105-11'
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 30509 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'tube feeding' AND "d_items"."linksto" = 'inputevents_cv' GROUP BY "itemid") SELECT COUNT(*) > 0 FROM "inputevents_cv" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "inputevents_cv"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "inputevents_cv"."itemid" WHERE NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL AND STRFTIME('%y-%m', "inputevents_cv"."charttime") <= '2105-11'
0.735352
CREATE TABLE table_59861 ("Team" TEXT, "Average" FLOAT, "Points" FLOAT, "Played" FLOAT, "1991-92" TEXT, "1992-93" TEXT, "1993-94" FLOAT)
Which 1991-92 has a 1993-94 of 43?
SELECT "1991-92" FROM table_59861 WHERE "1993-94" = '43'
SELECT "1991-92" FROM "table_59861" WHERE "1993-94" = '43'
0.056641
CREATE TABLE table_29106 ("Series #" FLOAT, "Season #" FLOAT, "Title" TEXT, "Director" TEXT, "Writer" TEXT, "Original air date" TEXT)
Who wrote 'Monica's bad day'?
SELECT "Writer" FROM table_29106 WHERE "Title" = 'Monica''s Bad Day'
SELECT "Writer" FROM "table_29106" WHERE "Title" = 'Monica\'s Bad Day'
0.068359
CREATE TABLE table_74099 ("Institution" TEXT, "Location" TEXT, "Founded" FLOAT, "Affiliation" TEXT, "Enrollment" FLOAT, "Team Nickname" TEXT, "Primary conference" TEXT)
Where is Robert Morris University-Illinois held?
SELECT "Location" FROM table_74099 WHERE "Institution" = 'Robert Morris University-Illinois'
SELECT "Location" FROM "table_74099" WHERE "Institution" = 'Robert Morris University-Illinois'
0.091797
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) 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 diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE 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) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
what is the name of the drug that was prescribed during the same hospital encounter to patient 007-1517 after having received a therapeutic antibacterials - vancomycin procedure until 70 months ago?
SELECT t2.drugname FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-1517') AND treatment.treatmentname = 'therapeutic antibacterials - vancomycin' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-70 month')) AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime, patient.patienthealthsystemstayid FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-1517') AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-70 month')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.treatmenttime < t2.drugstarttime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '007-1517' GROUP BY "patienthealthsystemstayid"), "t2" AS (SELECT "patient"."uniquepid", "medication"."drugname", "medication"."drugstarttime", "patient"."patienthealthsystemstayid" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" LEFT JOIN "_u_0" AS "_u_1" ON "_u_1"."" = "patient"."patienthealthsystemstayid" WHERE DATETIME("medication"."drugstarttime") <= DATETIME(CURRENT_TIME(), '-70 month') AND NOT "_u_1"."" IS NULL) SELECT "t2"."drugname" FROM "treatment" JOIN "patient" ON "patient"."patientunitstayid" = "treatment"."patientunitstayid" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" JOIN "t2" AS "t2" ON "patient"."patienthealthsystemstayid" = "t2"."patienthealthsystemstayid" AND "patient"."uniquepid" = "t2"."uniquepid" AND "t2"."drugstarttime" > "treatment"."treatmenttime" WHERE "treatment"."treatmentname" = 'therapeutic antibacterials - vancomycin' AND DATETIME("treatment"."treatmenttime") <= DATETIME(CURRENT_TIME(), '-70 month') AND NOT "_u_0"."" IS NULL
1.136719
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 microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime 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 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 treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL)
what number of patients have been diagnosed with lower urinary tract infection - likely bacterial in 2104?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'lower urinary tract infection - likely bacterial' AND STRFTIME('%y', diagnosis.diagnosistime) = '2104')
WITH "_u_0" AS (SELECT "diagnosis"."patientunitstayid" FROM "diagnosis" WHERE "diagnosis"."diagnosisname" = 'lower urinary tract infection - likely bacterial' AND STRFTIME('%y', "diagnosis"."diagnosistime") = '2104' GROUP BY "patientunitstayid") SELECT COUNT(DISTINCT "patient"."uniquepid") FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patientunitstayid" WHERE NOT "_u_0"."" IS NULL
0.395508
CREATE TABLE table_7165 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Record" TEXT)
What is High Assists, when High Points is Keon Clark (19)?
SELECT "High assists" FROM table_7165 WHERE "High points" = 'keon clark (19)'
SELECT "High assists" FROM "table_7165" WHERE "High points" = 'keon clark (19)'
0.077148
CREATE TABLE club (clublocation VARCHAR, clubname VARCHAR)
Where is the club 'Hopkins Student Enterprises' located?
SELECT clublocation FROM club WHERE clubname = "Hopkins Student Enterprises"
SELECT "clublocation" FROM "club" WHERE "Hopkins Student Enterprises" = "clubname"
0.080078
CREATE TABLE table_942 ("Year" FLOAT, "Domestic freight" FLOAT, "Domestic mail" FLOAT, "International freight" FLOAT, "International mail" FLOAT, "Total freight and mail" FLOAT, "Change" TEXT)
what is the maximum international mail with total freight and mail being 145044
SELECT MAX("International mail") FROM table_942 WHERE "Total freight and mail" = '145044'
SELECT MAX("International mail") FROM "table_942" WHERE "Total freight and mail" = '145044'
0.088867
CREATE TABLE table_60238 ("Commercial balance" TEXT, "2003" FLOAT, "2004" FLOAT, "2005" FLOAT, "2006" FLOAT)
Which 2005 has a 2003 of -13,25, and a 2004 smaller than -8,37?
SELECT MIN("2005") FROM table_60238 WHERE "2003" = '-13,25' AND "2004" < '-8,37'
SELECT MIN("2005") FROM "table_60238" WHERE "2003" = '-13,25' AND "2004" < '-8,37'
0.080078
CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) 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 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 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)
what is patient 013-38992's age on this hospital visit?
SELECT patient.age FROM patient WHERE patient.uniquepid = '013-38992' AND patient.hospitaldischargetime IS NULL
SELECT "patient"."age" FROM "patient" WHERE "patient"."hospitaldischargetime" IS NULL AND "patient"."uniquepid" = '013-38992'
0.12207
CREATE TABLE employees (EMPLOYEE_ID DECIMAL, FIRST_NAME VARCHAR, LAST_NAME VARCHAR, EMAIL VARCHAR, PHONE_NUMBER VARCHAR, HIRE_DATE DATE, JOB_ID VARCHAR, SALARY DECIMAL, COMMISSION_PCT DECIMAL, MANAGER_ID DECIMAL, DEPARTMENT_ID DECIMAL) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL)
For those employees who did not have any job in the past, show me the trend about commission_pct over hire_date with a line chart.
SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
SELECT "HIRE_DATE", "COMMISSION_PCT" FROM "employees" WHERE NOT "EMPLOYEE_ID" IN (SELECT "EMPLOYEE_ID" FROM "job_history")
0.119141
CREATE TABLE table_48985 ("Position" FLOAT, "Team" TEXT, "Played" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "Goals For" FLOAT, "Goals Against" FLOAT, "Goal Difference" TEXT, "Points 1" FLOAT)
What is the highest played that has a position less than 17, and 63 as the goals for?
SELECT MAX("Played") FROM table_48985 WHERE "Position" < '17' AND "Goals For" = '63'
SELECT MAX("Played") FROM "table_48985" WHERE "Goals For" = '63' AND "Position" < '17'
0.083984
CREATE TABLE county (County_Id INT, County_name TEXT, Population FLOAT, Zip_code TEXT) CREATE TABLE election (Election_ID INT, Counties_Represented TEXT, District INT, Delegate TEXT, Party INT, First_Elected FLOAT, Committee TEXT) CREATE TABLE party (Party_ID INT, Year FLOAT, Party TEXT, Governor TEXT, Lieutenant_Governor TEXT, Comptroller TEXT, Attorney_General TEXT, US_Senate TEXT)
Show the county name and population of all counties with a bar chart, could you display by the y axis in asc?
SELECT County_name, Population FROM county ORDER BY Population
SELECT "County_name", "Population" FROM "county" ORDER BY "Population" NULLS FIRST
0.080078
CREATE TABLE table_name_42 (opponent VARCHAR, october VARCHAR, score VARCHAR)
Which Opponent has a October larger than 20 with a Score of 2 2?
SELECT opponent FROM table_name_42 WHERE october > 20 AND score = "2–2"
SELECT "opponent" FROM "table_name_42" WHERE "2–2" = "score" AND "october" > 20
0.077148
CREATE TABLE table_10321124_1 (COUNT VARCHAR, escherichia VARCHAR)
how many function / genus with escherichia being espd
SELECT COUNT AS ↓_function___genus_β†’ FROM table_10321124_1 WHERE escherichia = "EspD"
SELECT "COUNT" AS "↓_function___genus_β†’" FROM "table_10321124_1" WHERE "EspD" = "escherichia"
0.09082
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 Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) 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 SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description 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 PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description 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 PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId 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 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 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 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 ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT)
All of a user's edits of other users' posts.
SELECT a.UserId AS "user_link", a.PostId AS "post_link", Comment, * FROM PostHistory AS a INNER JOIN Posts AS b ON a.PostId = b.Id WHERE a.PostHistoryTypeId = 5 AND b.CreationDate < '2014-01-01' AND a.CreationDate >= '2017-01-01' AND a.UserId = '##UserId##'
SELECT "a"."UserId" AS "user_link", "a"."PostId" AS "post_link", "Comment", * FROM "PostHistory" AS "a" JOIN "Posts" AS "b" ON "a"."PostId" = "b"."Id" AND "b"."CreationDate" < '2014-01-01' WHERE "a"."CreationDate" >= '2017-01-01' AND "a"."PostHistoryTypeId" = 5 AND "a"."UserId" = '##UserId##'
0.286133
CREATE TABLE table_29454 ("University" TEXT, "Varsity Name" TEXT, "City" TEXT, "Province" TEXT, "Founded" FLOAT, "Soccer Stadium" TEXT, "Stadium Capacity" FLOAT)
What is the province where the soccer statium is terrain #2 of complexe sportif claude-robillard?
SELECT "Province" FROM table_29454 WHERE "Soccer Stadium" = 'terrain #2 of Complexe sportif Claude-Robillard'
SELECT "Province" FROM "table_29454" WHERE "Soccer Stadium" = 'terrain #2 of Complexe sportif Claude-Robillard'
0.108398
CREATE TABLE table_22665117_1 (county VARCHAR, district_name VARCHAR)
If the name of the district is the Charyl Stockwell Academy, what is the county name?
SELECT county FROM table_22665117_1 WHERE district_name = "Charyl Stockwell Academy"
SELECT "county" FROM "table_22665117_1" WHERE "Charyl Stockwell Academy" = "district_name"
0.087891
CREATE TABLE table_204_690 (id DECIMAL, "election" DECIMAL, "party name" TEXT, "total votes" DECIMAL, "share of votes" TEXT, "seats" DECIMAL, "share of seats" TEXT, "party leader ( s ) " TEXT, "notes" TEXT)
how many times was jan steytler the party leader ?
SELECT COUNT(*) FROM table_204_690 WHERE "party leader(s)" = 'jan steytler'
SELECT COUNT(*) FROM "table_204_690" WHERE "party leader(s)" = 'jan steytler'
0.075195
CREATE TABLE table_204_132 (id DECIMAL, "year" DECIMAL, "location" TEXT, "men's individual" TEXT, "women's individual" TEXT, "men's team" TEXT, "women's team" TEXT, "mixed team" TEXT, "ref" DECIMAL)
what are the number of times the location was in madrid ?
SELECT COUNT(*) FROM table_204_132 WHERE "location" = 'madrid'
SELECT COUNT(*) FROM "table_204_132" WHERE "location" = 'madrid'
0.0625
CREATE TABLE table_name_40 (date VARCHAR, format VARCHAR)
What date has the format of cd?
SELECT date FROM table_name_40 WHERE format = "cd"
SELECT "date" FROM "table_name_40" WHERE "cd" = "format"
0.054688
CREATE TABLE table_name_38 (erp_w INT, frequency_mhz VARCHAR)
What is the highest erp w with a 90.5 frequency mhz?
SELECT MAX(erp_w) FROM table_name_38 WHERE frequency_mhz = 90.5
SELECT MAX("erp_w") FROM "table_name_38" WHERE "frequency_mhz" = 90.5
0.067383
CREATE TABLE table_23831 ("Series #" FLOAT, "Season #" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "U.S. viewers ( in millions ) " TEXT)
How many millions of people in the US saw the episode titled 'The Reunion Job'?
SELECT "U.S. viewers (in millions)" FROM table_23831 WHERE "Title" = 'The Reunion Job'
SELECT "U.S. viewers (in millions)" FROM "table_23831" WHERE "Title" = 'The Reunion Job'
0.085938
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
give me the number of patients whose death status is 1 and primary disease is aortic valve insuffiency\aortic valve replacement /sda?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "1" AND demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "1" = "demographic"."expire_flag" AND "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" = "demographic"."diagnosis"
0.192383
CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE employees (EMPLOYEE_ID DECIMAL, FIRST_NAME VARCHAR, LAST_NAME VARCHAR, EMAIL VARCHAR, PHONE_NUMBER VARCHAR, HIRE_DATE DATE, JOB_ID VARCHAR, SALARY DECIMAL, COMMISSION_PCT DECIMAL, MANAGER_ID DECIMAL, DEPARTMENT_ID DECIMAL) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR)
For those employees who did not have any job in the past, give me the comparison about the average of employee_id over the job_id , and group by attribute job_id by a bar chart.
SELECT JOB_ID, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID
SELECT "JOB_ID", AVG("EMPLOYEE_ID") FROM "employees" WHERE NOT "EMPLOYEE_ID" IN (SELECT "EMPLOYEE_ID" FROM "job_history") GROUP BY "JOB_ID"
0.135742
CREATE TABLE table_name_75 (streak VARCHAR, location_attendance VARCHAR, record VARCHAR)
Which Streak is in new orleans arena and a Record of 31 33?
SELECT streak FROM table_name_75 WHERE location_attendance = "new orleans arena" AND record = "31–33"
SELECT "streak" FROM "table_name_75" WHERE "31–33" = "record" AND "location_attendance" = "new orleans arena"
0.106445
CREATE TABLE table_24731 ("Date" TEXT, "Event #" TEXT, "Event" TEXT, "Winner" TEXT, "Prize" TEXT, "Entries" TEXT, "Prize Pool" TEXT, "Elapsed Time" TEXT)
Which event had 25,883 entries?
SELECT "Event" FROM table_24731 WHERE "Entries" = '25,883'
SELECT "Event" FROM "table_24731" WHERE "Entries" = '25,883'
0.058594
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 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 procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE 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 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 patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) 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 chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto 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_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT)
calculate the number of times that patient 3229 had urine out foley discharge since 12/2101.
SELECT COUNT(*) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3229)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urine out foley' AND d_items.linksto = 'outputevents') AND STRFTIME('%y-%m', outputevents.charttime) >= '2101-12'
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 3229 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'urine out foley' AND "d_items"."linksto" = 'outputevents' GROUP BY "itemid") SELECT COUNT(*) FROM "outputevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "outputevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "outputevents"."itemid" WHERE NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL AND STRFTIME('%y-%m', "outputevents"."charttime") >= '2101-12'
0.723633
CREATE TABLE table_name_16 (increase_in_net_assets VARCHAR, total_expenses VARCHAR)
What increase in net assets also has $5,617,236 as the total expenses?
SELECT increase_in_net_assets FROM table_name_16 WHERE total_expenses = "$5,617,236"
SELECT "increase_in_net_assets" FROM "table_name_16" WHERE "$5,617,236" = "total_expenses"
0.087891
CREATE TABLE status (station_id INT, bikes_available INT, docks_available INT, time TEXT) CREATE TABLE weather (date TEXT, max_temperature_f INT, mean_temperature_f INT, min_temperature_f INT, max_dew_point_f INT, mean_dew_point_f INT, min_dew_point_f INT, max_humidity INT, mean_humidity INT, min_humidity INT, max_sea_level_pressure_inches DECIMAL, mean_sea_level_pressure_inches DECIMAL, min_sea_level_pressure_inches DECIMAL, max_visibility_miles INT, mean_visibility_miles INT, min_visibility_miles INT, max_wind_Speed_mph INT, mean_wind_speed_mph INT, max_gust_speed_mph INT, precipitation_inches INT, cloud_cover INT, events TEXT, wind_dir_degrees INT, zip_code INT) CREATE TABLE station (id INT, name TEXT, lat DECIMAL, long DECIMAL, dock_count INT, city TEXT, installation_date TEXT) CREATE TABLE trip (id INT, duration INT, start_date TEXT, start_station_name TEXT, start_station_id INT, end_date TEXT, end_station_name TEXT, end_station_id INT, bike_id INT, subscription_type TEXT, zip_code INT)
Visualize a bar chart for the date and mean humidity for the days with the 3 largest maximum gust speeds.
SELECT date, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3
SELECT "date", "mean_humidity" FROM "weather" ORDER BY "max_gust_speed_mph" DESC NULLS LAST LIMIT 3
0.09668
CREATE TABLE table_16192 ("Team" TEXT, "Outgoing manager" TEXT, "Manner of departure" TEXT, "Date of vacancy" TEXT, "Replaced by" TEXT, "Date of appointment" TEXT, "Position in table" TEXT)
What is the date of appointment when replaced by is roy hodgson?
SELECT "Date of appointment" FROM table_16192 WHERE "Replaced by" = 'Roy Hodgson'
SELECT "Date of appointment" FROM "table_16192" WHERE "Replaced by" = 'Roy Hodgson'
0.081055
CREATE TABLE Manufacturers (Code INT, Name VARCHAR, Headquarter VARCHAR, Founder VARCHAR, Revenue FLOAT) CREATE TABLE Products (Code INT, Name VARCHAR, Price DECIMAL, Manufacturer INT)
What are the names of the cheapest products in each category along with the cheapest price in a bar chart?, and list in ascending by the Y-axis.
SELECT Name, MIN(Price) FROM Products GROUP BY Name ORDER BY MIN(Price)
SELECT "Name", MIN("Price") FROM "Products" GROUP BY "Name" ORDER BY MIN("Price") NULLS FIRST
0.09082
CREATE TABLE table_name_93 (division_record VARCHAR, school VARCHAR)
For the Delmar school what is the division record?
SELECT division_record FROM table_name_93 WHERE school = "delmar"
SELECT "division_record" FROM "table_name_93" WHERE "delmar" = "school"
0.069336
CREATE TABLE table_43415 ("Date" TEXT, "Result" TEXT, "Score" TEXT, "Brazil scorers" TEXT, "Competition" TEXT)
Who were the Brazil scorers who scored 3-3?
SELECT "Brazil scorers" FROM table_43415 WHERE "Score" = '3-3'
SELECT "Brazil scorers" FROM "table_43415" WHERE "Score" = '3-3'
0.0625
CREATE TABLE table_37693 ("Rank" TEXT, "Urban sub-area" TEXT, "Population" TEXT, "Status" TEXT, "Council area" TEXT)
What is the council area for the Larkhall urban sub-area?
SELECT "Council area" FROM table_37693 WHERE "Urban sub-area" = 'larkhall'
SELECT "Council area" FROM "table_37693" WHERE "Urban sub-area" = 'larkhall'
0.074219
CREATE TABLE table_name_77 (ethnic_group VARCHAR, jewish VARCHAR)
Tell me the ethnic group for jewish of 0.47%
SELECT ethnic_group FROM table_name_77 WHERE jewish = "0.47%"
SELECT "ethnic_group" FROM "table_name_77" WHERE "0.47%" = "jewish"
0.06543
CREATE TABLE table_name_24 (record VARCHAR, visitor VARCHAR)
What was the Record of the game in which the Trail Blazers was the visiting team?
SELECT record FROM table_name_24 WHERE visitor = "trail blazers"
SELECT "record" FROM "table_name_24" WHERE "trail blazers" = "visitor"
0.068359
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 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 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 treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime 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 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)
the last year what were the three most frequent diagnoses that were given to patients within the same month after the diagnosis of respiratory arrest?
SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'respiratory arrest' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t1 JOIN (SELECT patient.uniquepid, diagnosis.diagnosisname, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.diagnosistime AND DATETIME(t1.diagnosistime, 'start of month') = DATETIME(t2.diagnosistime, 'start of month') GROUP BY t2.diagnosisname) AS t3 WHERE t3.c1 <= 3
WITH "t2" AS (SELECT "patient"."uniquepid", "diagnosis"."diagnosisname", "diagnosis"."diagnosistime" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" WHERE DATETIME("diagnosis"."diagnosistime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')), "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"."uniquepid" = "t2"."uniquepid" AND DATETIME("diagnosis"."diagnosistime", 'start of month') = DATETIME("t2"."diagnosistime", 'start of month') WHERE "diagnosis"."diagnosisname" = 'respiratory arrest' AND DATETIME("diagnosis"."diagnosistime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY "t2"."diagnosisname") SELECT "t3"."diagnosisname" FROM "t3" AS "t3" WHERE "t3"."c1" <= 3
0.989258
CREATE TABLE table_name_21 (height__cm_ INT, weight__kg_ VARCHAR, birthdate VARCHAR)
What is the height of the player born on June 24, 1964, with a weight over 84 kg?
SELECT AVG(height__cm_) FROM table_name_21 WHERE weight__kg_ > 84 AND birthdate = "june 24, 1964"
SELECT AVG("height__cm_") FROM "table_name_21" WHERE "birthdate" = "june 24, 1964" AND "weight__kg_" > 84
0.102539
CREATE TABLE table_name_85 (wins INT, byes VARCHAR, against VARCHAR, golden_rivers VARCHAR)
What is the sum of Wins, when Against is less than 1033, when Golden Rivers is 'Nullawil', and when Byes is less than 2?
SELECT SUM(wins) FROM table_name_85 WHERE against < 1033 AND golden_rivers = "nullawil" AND byes < 2
SELECT SUM("wins") FROM "table_name_85" WHERE "against" < 1033 AND "byes" < 2 AND "golden_rivers" = "nullawil"
0.107422
CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE 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_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 flight_fare (flight_id INT, fare_id INT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note 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 dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE 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 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)
i need flight information leaving ATLANTA and arriving in BALTIMORE for monday
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 = 21 AND date_day.month_number = 2 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 = 'ATLANTA' 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" = 21 AND "date_day"."month_number" = 2 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" = 'ATLANTA' 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.707031
CREATE TABLE Ship (Ship_ID INT, Name TEXT, Type TEXT, Built_Year FLOAT, Class TEXT, Flag TEXT) CREATE TABLE captain (Captain_ID INT, Name TEXT, Ship_ID INT, age TEXT, Class TEXT, Rank TEXT)
A bar chart about how many captains are in each rank?, show from low to high by the Rank.
SELECT Rank, COUNT(*) FROM captain GROUP BY Rank ORDER BY Rank
SELECT "Rank", COUNT(*) FROM "captain" GROUP BY "Rank" ORDER BY "Rank" NULLS FIRST
0.080078
CREATE TABLE table_name_33 (result VARCHAR, record VARCHAR)
Record of 0 8 had what result?
SELECT result FROM table_name_33 WHERE record = "0–8"
SELECT "result" FROM "table_name_33" WHERE "0–8" = "record"
0.057617
CREATE TABLE table_name_33 (uci_protour_points VARCHAR, cyclist VARCHAR)
What is Davide Rebellin' UCI ProTour Points?
SELECT uci_protour_points FROM table_name_33 WHERE cyclist = "davide rebellin"
SELECT "uci_protour_points" FROM "table_name_33" WHERE "cyclist" = "davide rebellin"
0.082031
CREATE TABLE table_204_3 (id DECIMAL, "rank" DECIMAL, "name" TEXT, "nationality" TEXT, "time" DECIMAL)
what was the number of competitors during the 1995 finals ?
SELECT COUNT("name") FROM table_204_3
SELECT COUNT("name") FROM "table_204_3"
0.038086
CREATE TABLE Faculty (FacID INT, Lname VARCHAR, Fname VARCHAR, Rank VARCHAR, Sex VARCHAR, Phone INT, Room VARCHAR, Building VARCHAR) CREATE TABLE Faculty_Participates_in (FacID INT, actid INT) CREATE TABLE Participates_in (stuid INT, actid INT) CREATE TABLE Activity (actid INT, activity_name VARCHAR) CREATE TABLE Student (StuID INT, LName VARCHAR, Fname VARCHAR, Age INT, Sex VARCHAR, Major INT, Advisor INT, city_code VARCHAR)
How many faculty members participate in each activity? Return the activity names and the number of faculty members. Show bar chart.
SELECT activity_name, COUNT(*) FROM Activity AS T1 JOIN Faculty_Participates_in AS T2 ON T1.actid = T2.actid GROUP BY T1.actid
SELECT "activity_name", COUNT(*) FROM "Activity" AS "T1" JOIN "Faculty_Participates_in" AS "T2" ON "T1"."actid" = "T2"."actid" GROUP BY "T1"."actid"
0.144531
CREATE TABLE table_name_67 (lane INT, nationality VARCHAR)
What is the highest Lane used by a racer from Malta?
SELECT MAX(lane) FROM table_name_67 WHERE nationality = "malta"
SELECT MAX("lane") FROM "table_name_67" WHERE "malta" = "nationality"
0.067383
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 lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid 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 on urgent admission were diagnosed with ostium secundum type atrial septal defect?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "URGENT" AND diagnoses.long_title = "Ostium secundum type atrial septal defect"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Ostium secundum type atrial septal defect" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "URGENT" = "demographic"."admission_type"
0.25293
CREATE TABLE table_5289 ("Rank" FLOAT, "Player" TEXT, "Country" TEXT, "Earnings ( $ ) " FLOAT, "Events" FLOAT, "Wins" FLOAT)
Add up all the events whose earnings is less than $530,808, have less than 2 wins and is ranked lower than 5.
SELECT SUM("Events") FROM table_5289 WHERE "Earnings ( $ )" < '530,808' AND "Wins" < '2' AND "Rank" < '5'
SELECT SUM("Events") FROM "table_5289" WHERE "Earnings ( $ )" < '530,808' AND "Rank" < '5' AND "Wins" < '2'
0.104492
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
count the number of patients with inpatient hospital admission who have lab test item id 51301.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND lab.itemid = "51301"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "51301" = "lab"."itemid" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "TRSF WITHIN THIS FACILITY" = "demographic"."admission_location"
0.21875
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom 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 prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name 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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value 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 chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_icd_diagnoses (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 procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME)
what is the percentile of 10.5 in a lab test of hemoglobin given the same age of patient 95968 when they came to the hospital first time?
SELECT DISTINCT t1.c1 FROM (SELECT labevents.valuenum, PERCENT_RANK() OVER (ORDER BY labevents.valuenum) AS c1 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'hemoglobin') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age = (SELECT admissions.age FROM admissions WHERE admissions.subject_id = 95968 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1))) AS t1 WHERE t1.valuenum = 10.5
WITH "_u_0" AS (SELECT "d_labitems"."itemid" FROM "d_labitems" WHERE "d_labitems"."label" = 'hemoglobin' GROUP BY "itemid"), "_u_1" AS (SELECT "admissions"."age" FROM "admissions" WHERE "admissions"."subject_id" = 95968 AND NOT "admissions"."dischtime" IS NULL ORDER BY "admissions"."admittime" NULLS FIRST LIMIT 1) SELECT DISTINCT PERCENT_RANK() OVER (ORDER BY "labevents"."valuenum" NULLS FIRST) FROM "labevents" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "labevents"."itemid" WHERE "labevents"."hadm_id" IN (SELECT "admissions"."hadm_id" FROM "admissions" JOIN "_u_1" AS "_u_1" ON "_u_1"."age" = "admissions"."age") AND "labevents"."valuenum" = 10.5 AND NOT "_u_0"."" IS NULL
0.661133
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) 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)
Get me the number of patients born before 2065 who had an unspecified colostomy.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2065" AND procedures.short_title = "Colostomy NOS"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Colostomy NOS" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "2065" > "demographic"."dob_year"
0.22168
CREATE TABLE table_72991 ("Year" FLOAT, "Date ( Opening ) " TEXT, "Date ( Closing ) " TEXT, "Opening Film" TEXT, "Number of Screening" TEXT, "Award-Winning Film" TEXT)
How many number of screenings have an opening film of the journey of vaan nguyen?
SELECT COUNT("Number of Screening") FROM table_72991 WHERE "Opening Film" = 'The Journey of Vaan Nguyen'
SELECT COUNT("Number of Screening") FROM "table_72991" WHERE "Opening Film" = 'The Journey of Vaan Nguyen'
0.103516
CREATE TABLE ref_locations (location_code TEXT, location_name TEXT, location_description TEXT) CREATE TABLE employees (employee_id DECIMAL, role_code TEXT, employee_name TEXT, gender_mfu TEXT, date_of_birth TIME, other_details TEXT) CREATE TABLE documents_to_be_destroyed (document_id DECIMAL, destruction_authorised_by_employee_id DECIMAL, destroyed_by_employee_id DECIMAL, planned_destruction_date TIME, actual_destruction_date TIME, other_details TEXT) CREATE TABLE ref_document_types (document_type_code TEXT, document_type_name TEXT, document_type_description TEXT) CREATE TABLE document_locations (document_id DECIMAL, location_code TEXT, date_in_location_from TIME, date_in_locaton_to TIME) CREATE TABLE all_documents (document_id DECIMAL, date_stored TIME, document_type_code TEXT, document_name TEXT, document_description TEXT, other_details TEXT) CREATE TABLE roles (role_code TEXT, role_name TEXT, role_description TEXT) CREATE TABLE ref_calendar (calendar_date TIME, day_number DECIMAL)
Show the location codes with at least 3 documents.
SELECT location_code FROM document_locations GROUP BY location_code HAVING COUNT(*) >= 3
SELECT "location_code" FROM "document_locations" GROUP BY "location_code" HAVING COUNT(*) >= 3
0.091797
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 labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto 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 procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE diagnoses_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) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_icd_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 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 patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT)
tell me the price of a procedure called insert infusion pump?
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'procedures_icd' AND cost.event_id IN (SELECT procedures_icd.row_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'insert infusion pump'))
WITH "_u_1" AS (SELECT "procedures_icd"."row_id" FROM "procedures_icd" JOIN "d_icd_procedures" ON "d_icd_procedures"."icd9_code" = "procedures_icd"."icd9_code" AND "d_icd_procedures"."short_title" = 'insert infusion pump' 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" = 'procedures_icd' AND NOT "_u_1"."" IS NULL
0.40332
CREATE TABLE Addresses (Address_ID VARCHAR, Line_1 VARCHAR, Line_2 VARCHAR, City_Town VARCHAR, State_County VARCHAR, Other_Details VARCHAR) CREATE TABLE Order_Items (Order_Item_ID INT, Order_ID INT, Product_ID INT, Order_Quantity VARCHAR, Other_Item_Details VARCHAR) CREATE TABLE Performers_in_Bookings (Order_ID INT, Performer_ID INT) CREATE TABLE Customers (Customer_ID VARCHAR, Address_ID INT, Customer_Name VARCHAR, Customer_Phone VARCHAR, Customer_Email_Address VARCHAR, Other_Details VARCHAR) CREATE TABLE Marketing_Regions (Marketing_Region_Code CHAR, Marketing_Region_Name VARCHAR, Marketing_Region_Descriptrion VARCHAR, Other_Details VARCHAR) CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID INT, Address_ID INT, Currency_Code CHAR, Marketing_Region_Code CHAR, Store_Name VARCHAR, Store_Phone VARCHAR, Store_Email_Address VARCHAR, Other_Details VARCHAR) CREATE TABLE Invoice_Items (Invoice_Item_ID INT, Invoice_ID INT, Order_ID INT, Order_Item_ID INT, Product_ID INT, Order_Quantity INT, Other_Item_Details VARCHAR) CREATE TABLE Invoices (Invoice_ID INT, Order_ID INT, payment_method_code CHAR, Product_ID INT, Order_Quantity VARCHAR, Other_Item_Details VARCHAR, Order_Item_ID INT) CREATE TABLE Ref_Payment_Methods (payment_method_code CHAR, payment_method_description VARCHAR) CREATE TABLE Bookings_Services (Order_ID INT, Product_ID INT) CREATE TABLE Bookings (Booking_ID INT, Customer_ID INT, Workshop_Group_ID VARCHAR, Status_Code CHAR, Store_ID INT, Order_Date DATETIME, Planned_Delivery_Date DATETIME, Actual_Delivery_Date DATETIME, Other_Order_Details VARCHAR) CREATE TABLE Ref_Service_Types (Service_Type_Code CHAR, Parent_Service_Type_Code CHAR, Service_Type_Description VARCHAR) CREATE TABLE Clients (Client_ID INT, Address_ID INT, Customer_Email_Address VARCHAR, Customer_Name VARCHAR, Customer_Phone VARCHAR, Other_Details VARCHAR) CREATE TABLE Stores (Store_ID VARCHAR, Address_ID INT, Marketing_Region_Code CHAR, Store_Name VARCHAR, Store_Phone VARCHAR, Store_Email_Address VARCHAR, Other_Details VARCHAR) CREATE TABLE Products (Product_ID VARCHAR, Product_Name VARCHAR, Product_Price DECIMAL, Product_Description VARCHAR, Other_Product_Service_Details VARCHAR) CREATE TABLE Customer_Orders (Order_ID INT, Customer_ID INT, Store_ID INT, Order_Date DATETIME, Planned_Delivery_Date DATETIME, Actual_Delivery_Date DATETIME, Other_Order_Details VARCHAR) CREATE TABLE Services (Service_ID INT, Service_Type_Code CHAR, Workshop_Group_ID INT, Product_Description VARCHAR, Product_Name VARCHAR, Product_Price DECIMAL, Other_Product_Service_Details VARCHAR) CREATE TABLE Performers (Performer_ID INT, Address_ID INT, Customer_Name VARCHAR, Customer_Phone VARCHAR, Customer_Email_Address VARCHAR, Other_Details VARCHAR)
Give me a bar chart for mean product price of each product name, I want to list in asc by the x-axis.
SELECT Product_Name, AVG(Product_Price) FROM Products GROUP BY Product_Name ORDER BY Product_Name
SELECT "Product_Name", AVG("Product_Price") FROM "Products" GROUP BY "Product_Name" ORDER BY "Product_Name" NULLS FIRST
0.116211
CREATE TABLE table_204_296 (id DECIMAL, "rank" DECIMAL, "athlete" TEXT, "qual" DECIMAL, "final" DECIMAL, "total" DECIMAL, "notes" TEXT)
what is the number of athletes from the us ?
SELECT COUNT("athlete") FROM table_204_296 WHERE "athlete" = 'usa'
SELECT COUNT("athlete") FROM "table_204_296" WHERE "athlete" = 'usa'
0.066406
CREATE TABLE table_26783 ("Railroad" TEXT, "Game Cost" TEXT, "Real-Life Years of Operation" TEXT, "Real-Life Eventual Outcome" TEXT, "Currently\\u00b9 Part Of..." TEXT)
Name the game cost for merged with new york central to form penn central
SELECT "Game Cost" FROM table_26783 WHERE "Real-Life Eventual Outcome" = 'Merged with New York Central to form Penn Central'
SELECT "Game Cost" FROM "table_26783" WHERE "Real-Life Eventual Outcome" = 'Merged with New York Central to form Penn Central'
0.123047
CREATE TABLE table_48306 ("Rank" FLOAT, "Company" TEXT, "Headquarters" TEXT, "Industry" TEXT, "Sales ( billion $ ) " FLOAT, "Profits ( billion $ ) " FLOAT, "Assets ( billion $ ) " FLOAT, "Market Value ( billion $ ) " FLOAT)
What is the highest profits in billions of the company headquartered in the USA with a market value of 194.87 billions and less than 76.66 billions in sales?
SELECT MAX("Profits (billion $)") FROM table_48306 WHERE "Headquarters" = 'usa' AND "Market Value (billion $)" = '194.87' AND "Sales (billion $)" < '76.66'
SELECT MAX("Profits (billion $)") FROM "table_48306" WHERE "Headquarters" = 'usa' AND "Market Value (billion $)" = '194.87' AND "Sales (billion $)" < '76.66'
0.15332
CREATE TABLE table_55767 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
What venue features collingwood as the home side?
SELECT "Venue" FROM table_55767 WHERE "Home team" = 'collingwood'
SELECT "Venue" FROM "table_55767" WHERE "Home team" = 'collingwood'
0.06543
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) 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)
give me the number of patients whose year of death is less than or equal to 2165 and procedure short title is heart countershock nec?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2165.0" AND procedures.short_title = "Heart countershock NEC"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Heart countershock NEC" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "2165.0" >= "demographic"."dod_year"
0.233398
CREATE TABLE table_76500 ("Minister" TEXT, "Party" TEXT, "Start date" TEXT, "End date" TEXT, "Prime Minister" TEXT)
Who was the minister for the CSV party with a present day end date?
SELECT "Minister" FROM table_76500 WHERE "Party" = 'csv' AND "End date" = 'present day'
SELECT "Minister" FROM "table_76500" WHERE "End date" = 'present day' AND "Party" = 'csv'
0.086914
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE 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 procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto 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 chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE 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 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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
had diltiazem, pantoprazole or isotonic sodium chloride been since 6 years ago prescribed for patient 26612?
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26612) AND prescriptions.drug IN ('diltiazem', 'pantoprazole', 'isotonic sodium chloride') AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-6 year')
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 26612 GROUP BY "hadm_id") SELECT COUNT(*) > 0 FROM "prescriptions" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "prescriptions"."hadm_id" WHERE "prescriptions"."drug" IN ('diltiazem', 'pantoprazole', 'isotonic sodium chloride') AND DATETIME("prescriptions"."startdate") >= DATETIME(CURRENT_TIME(), '-6 year') AND NOT "_u_0"."" IS NULL
0.418945
CREATE TABLE table_name_50 (finish VARCHAR, manager VARCHAR, record VARCHAR)
what is the finish when the manager is tom kotchman and the record is 40-36?
SELECT finish FROM table_name_50 WHERE manager = "tom kotchman" AND record = "40-36"
SELECT "finish" FROM "table_name_50" WHERE "40-36" = "record" AND "manager" = "tom kotchman"
0.089844
CREATE TABLE table_50281 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" TEXT)
Phil Mickelson has what To par?
SELECT "To par" FROM table_50281 WHERE "Player" = 'phil mickelson'
SELECT "To par" FROM "table_50281" WHERE "Player" = 'phil mickelson'
0.066406
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name 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_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 transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
when was the first time patient 56201 had a procedure of destruct ext ear les nec since 2 years ago?
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'destruct ext ear les nec') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 56201) AND DATETIME(procedures_icd.charttime) >= DATETIME(CURRENT_TIME(), '-2 year') ORDER BY procedures_icd.charttime LIMIT 1
WITH "_u_1" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 56201 GROUP BY "hadm_id") SELECT "procedures_icd"."charttime" FROM "procedures_icd" JOIN "d_icd_procedures" ON "d_icd_procedures"."icd9_code" = "procedures_icd"."icd9_code" AND "d_icd_procedures"."short_title" = 'destruct ext ear les nec' LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "procedures_icd"."hadm_id" WHERE DATETIME("procedures_icd"."charttime") >= DATETIME(CURRENT_TIME(), '-2 year') AND NOT "_u_1"."" IS NULL ORDER BY "procedures_icd"."charttime" NULLS FIRST LIMIT 1
0.55957
CREATE TABLE table_50056 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" TEXT)
Who is the player for Zimbabwe?
SELECT "Player" FROM table_50056 WHERE "Country" = 'zimbabwe'
SELECT "Player" FROM "table_50056" WHERE "Country" = 'zimbabwe'
0.061523
CREATE TABLE table_69364 ("Outcome" TEXT, "Year" FLOAT, "Tournament" TEXT, "Opponent" TEXT, "Score" TEXT)
What was the score of the player who played against Wong Choong Hann in the Dutch Open?
SELECT "Score" FROM table_69364 WHERE "Tournament" = 'dutch open' AND "Opponent" = 'wong choong hann'
SELECT "Score" FROM "table_69364" WHERE "Opponent" = 'wong choong hann' AND "Tournament" = 'dutch open'
0.100586
CREATE TABLE photos (id DECIMAL, camera_lens_id DECIMAL, mountain_id DECIMAL, color TEXT, name TEXT) CREATE TABLE mountain (id DECIMAL, name TEXT, height DECIMAL, prominence DECIMAL, range TEXT, country TEXT) CREATE TABLE camera_lens (id DECIMAL, brand TEXT, name TEXT, focal_length_mm DECIMAL, max_aperture DECIMAL)
List the id, color scheme, and name for all the photos.
SELECT id, color, name FROM photos
SELECT "id", "color", "name" FROM "photos"
0.041016
CREATE TABLE table_30889 ("Number" TEXT, "Serial Number" FLOAT, "Into Service" TEXT, "Withdrawn" TEXT, "Scrapped" TEXT)
Name the into service for dh1
SELECT "Into Service" FROM table_30889 WHERE "Number" = 'DH1'
SELECT "Into Service" FROM "table_30889" WHERE "Number" = 'DH1'
0.061523
CREATE TABLE Products (Code INT, Name VARCHAR, Price DECIMAL, Manufacturer INT) CREATE TABLE Manufacturers (Code INT, Name VARCHAR, Headquarter VARCHAR, Founder VARCHAR, Revenue FLOAT)
For those products with a price between 60 and 120, visualize a scatter chart about the correlation between code and price , and group by attribute name.
SELECT Code, Price FROM Products WHERE Price BETWEEN 60 AND 120 GROUP BY Name
SELECT "Code", "Price" FROM "Products" WHERE "Price" <= 120 AND "Price" >= 60 GROUP BY "Name"
0.09082
CREATE TABLE table_name_98 (model VARCHAR, specification VARCHAR)
Which model had a Specification of dl-718?
SELECT model FROM table_name_98 WHERE specification = "dl-718"
SELECT "model" FROM "table_name_98" WHERE "dl-718" = "specification"
0.066406
CREATE TABLE table_2187 ("Year" FLOAT, "Division" FLOAT, "League" TEXT, "Regular Season" TEXT, "Playoffs" TEXT, "Open Cup" TEXT)
What's the team's status in the Open Cup in 2006?
SELECT "Open Cup" FROM table_2187 WHERE "Year" = '2006'
SELECT "Open Cup" FROM "table_2187" WHERE "Year" = '2006'
0.055664
CREATE TABLE tracks (composer VARCHAR, name VARCHAR)
Who is the composer of track Fast As a Shark?
SELECT composer FROM tracks WHERE name = "Fast As a Shark"
SELECT "composer" FROM "tracks" WHERE "Fast As a Shark" = "name"
0.0625
CREATE TABLE university (School_ID INT, School TEXT, Location TEXT, Founded FLOAT, Affiliation TEXT, Enrollment FLOAT, Nickname TEXT, Primary_conference TEXT) CREATE TABLE basketball_match (Team_ID INT, School_ID INT, Team_Name TEXT, ACC_Regular_Season TEXT, ACC_Percent TEXT, ACC_Home TEXT, ACC_Road TEXT, All_Games TEXT, All_Games_Percent INT, All_Home TEXT, All_Road TEXT, All_Neutral TEXT)
Show me about the correlation between Team_ID and ACC_Percent , and group by attribute ACC_Home in a scatter chart.
SELECT Team_ID, ACC_Percent FROM basketball_match GROUP BY ACC_Home
SELECT "Team_ID", "ACC_Percent" FROM "basketball_match" GROUP BY "ACC_Home"
0.073242
CREATE TABLE table_name_78 (position VARCHAR, player VARCHAR)
What is the position for Jani Lajunen?
SELECT position FROM table_name_78 WHERE player = "jani lajunen"
SELECT "position" FROM "table_name_78" WHERE "jani lajunen" = "player"
0.068359
CREATE TABLE university (School_ID INT, School TEXT, Location TEXT, Founded FLOAT, Affiliation TEXT, Enrollment FLOAT, Nickname TEXT, Primary_conference TEXT) CREATE TABLE basketball_match (Team_ID INT, School_ID INT, Team_Name TEXT, ACC_Regular_Season TEXT, ACC_Percent TEXT, ACC_Home TEXT, ACC_Road TEXT, All_Games TEXT, All_Games_Percent INT, All_Home TEXT, All_Road TEXT, All_Neutral TEXT)
Visualize a pie chart about the proportion of All_Home and the amount of All_Home.
SELECT All_Home, COUNT(All_Home) FROM basketball_match GROUP BY All_Home
SELECT "All_Home", COUNT("All_Home") FROM "basketball_match" GROUP BY "All_Home"
0.078125
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 d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto 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 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 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_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE 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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
tell me the first careunit patient 11579 got since 2103?
SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 11579) AND NOT transfers.careunit IS NULL AND STRFTIME('%y', transfers.intime) >= '2103' ORDER BY transfers.intime LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 11579 GROUP BY "hadm_id") SELECT "transfers"."careunit" FROM "transfers" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "transfers"."hadm_id" WHERE NOT "_u_0"."" IS NULL AND NOT "transfers"."careunit" IS NULL AND STRFTIME('%y', "transfers"."intime") >= '2103' ORDER BY "transfers"."intime" NULLS FIRST LIMIT 1
0.392578
CREATE TABLE table_70381 ("Date" TEXT, "Opponent" TEXT, "Score" TEXT, "Loss" TEXT, "Record" TEXT)
On the date of June 8 what was the record?
SELECT "Record" FROM table_70381 WHERE "Date" = 'june 8'
SELECT "Record" FROM "table_70381" WHERE "Date" = 'june 8'
0.056641
CREATE TABLE table_33066 ("Rank" FLOAT, "Rider" TEXT, "Team" TEXT, "Speed" TEXT, "Time" TEXT)
Which team is John Williams a rider for?
SELECT "Team" FROM table_33066 WHERE "Rider" = 'john williams'
SELECT "Team" FROM "table_33066" WHERE "Rider" = 'john williams'
0.0625
CREATE TABLE table_name_90 (song VARCHAR, place VARCHAR, points VARCHAR, draw VARCHAR)
Which Song has Points smaller than 54, and a Draw smaller than 4, and a Place smaller than 10?
SELECT song FROM table_name_90 WHERE points < 54 AND draw < 4 AND place < 10
SELECT "song" FROM "table_name_90" WHERE "draw" < 4 AND "place" < 10 AND "points" < 54
0.083984
CREATE TABLE table_75429 ("Country" TEXT, "Skip" TEXT, "Third" TEXT, "Second" TEXT, "Lead" TEXT)
What skip has denmark as the country?
SELECT "Skip" FROM table_75429 WHERE "Country" = 'denmark'
SELECT "Skip" FROM "table_75429" WHERE "Country" = 'denmark'
0.058594
CREATE TABLE table_name_77 (loss VARCHAR, record VARCHAR)
What was the loss of the game when the record was 20-16?
SELECT loss FROM table_name_77 WHERE record = "20-16"
SELECT "loss" FROM "table_name_77" WHERE "20-16" = "record"
0.057617
CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) 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 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 airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) 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 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 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 date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE month (month_number INT, month_name 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 ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) 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 equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT)
on tuesday the twenty third flights from PHILADELPHIA to SAN FRANCISCO on AA
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 = 'SAN FRANCISCO' AND date_day.day_number = 22 AND date_day.month_number = 3 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 = 'PHILADELPHIA' 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 "date_day" ON "date_day"."day_number" = 22 AND "date_day"."month_number" = 3 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" = 'PHILADELPHIA' 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" AND "flight"."airline_code" = 'AA' 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" = 'SAN FRANCISCO'
0.75
CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE 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 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 allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
what is the minimum total cost of a hospital visit that includes antipyretics - acetaminophen?
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'antipyretics - acetaminophen')) GROUP BY cost.patienthealthsystemstayid) AS t1
WITH "_u_0" AS (SELECT "treatment"."patientunitstayid" FROM "treatment" WHERE "treatment"."treatmentname" = 'antipyretics - acetaminophen' GROUP BY "patientunitstayid"), "_u_1" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patientunitstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patienthealthsystemstayid"), "t1" AS (SELECT SUM("cost"."cost") AS "c1" FROM "cost" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "cost"."patienthealthsystemstayid" WHERE NOT "_u_1"."" IS NULL GROUP BY "cost"."patienthealthsystemstayid") SELECT MIN("t1"."c1") FROM "t1" AS "t1"
0.609375
CREATE TABLE table_name_98 (loss VARCHAR, record VARCHAR)
What was the loss of the Mariners game when they had a record of 21-34?
SELECT loss FROM table_name_98 WHERE record = "21-34"
SELECT "loss" FROM "table_name_98" WHERE "21-34" = "record"
0.057617