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_36771 ("Call sign" TEXT, "Frequency" TEXT, "City of license" TEXT, "Facility ID" FLOAT, "ERP / Power W" FLOAT, "Height m ( ft ) " TEXT, "Class" TEXT)
Which Facility ID has a City of license of springfield, ma, and a ERP / Power W smaller than 230?
SELECT MAX("Facility ID") FROM table_36771 WHERE "City of license" = 'springfield, ma' AND "ERP / Power W" < '230'
SELECT MAX("Facility ID") FROM "table_36771" WHERE "City of license" = 'springfield, ma' AND "ERP / Power W" < '230'
0.113281
CREATE TABLE table_50663 ("Team 1" TEXT, "Agg." TEXT, "Team 2" TEXT, "1st leg" TEXT, "2nd leg" TEXT)
WHAT IS THE 1ST LEG WITH TEAM 2 AS ATHLETIC?
SELECT "1st leg" FROM table_50663 WHERE "Team 2" = 'athletic'
SELECT "1st leg" FROM "table_50663" WHERE "Team 2" = 'athletic'
0.061523
CREATE TABLE basketball_match (Team_ID INT, School_ID INT, Team_Name TEXT, ACC_Regular_Season TEXT, ACC_Percent TEXT, ACC_Home TEXT, ACC_Road TEXT, All_Games TEXT, All_Games_Percent INT, All_Home TEXT, All_Road TEXT, All_Neutral TEXT) CREATE TABLE university (School_ID INT, School TEXT, Location TEXT, Founded FLOAT, Affiliation TEXT, Enrollment FLOAT, Nickname TEXT, Primary_conference TEXT)
Show me about the distribution of All_Road and All_Games_Percent in a bar chart.
SELECT All_Road, All_Games_Percent FROM basketball_match
SELECT "All_Road", "All_Games_Percent" FROM "basketball_match"
0.060547
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 records from the products and each product's manufacturer, show me about the correlation between code and revenue , and group by attribute name in a scatter chart.
SELECT T1.Code, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Name
SELECT "T1"."Code", "T2"."Revenue" FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "Name"
0.136719
CREATE TABLE table_24991 ("Year" FLOAT, "Date" TEXT, "Driver" TEXT, "Team" TEXT, "Manufacturer" TEXT, "Laps" TEXT, "Miles ( km ) " TEXT, "Race Time" TEXT, "Average Speed ( mph ) " TEXT, "Report" TEXT)
Name the total number of race time for kevin harvick
SELECT COUNT("Race Time") FROM table_24991 WHERE "Driver" = 'Kevin Harvick'
SELECT COUNT("Race Time") FROM "table_24991" WHERE "Driver" = 'Kevin Harvick'
0.075195
CREATE TABLE table_name_14 (result VARCHAR, date VARCHAR, opponent VARCHAR)
What was the result for the opponent being gerardi rinaldi in 2009?
SELECT result FROM table_name_14 WHERE date = 2009 AND opponent = "gerardi rinaldi"
SELECT "result" FROM "table_name_14" WHERE "date" = 2009 AND "gerardi rinaldi" = "opponent"
0.088867
CREATE TABLE table_1341586_19 (district VARCHAR, incumbent VARCHAR)
how many district with incumbent being lindy boggs
SELECT COUNT(district) FROM table_1341586_19 WHERE incumbent = "Lindy Boggs"
SELECT COUNT("district") FROM "table_1341586_19" WHERE "Lindy Boggs" = "incumbent"
0.080078
CREATE TABLE table_name_6 (opponent_in_the_final VARCHAR, outcome VARCHAR, date VARCHAR)
Which opponent was a runner-up on 2 march 1998?
SELECT opponent_in_the_final FROM table_name_6 WHERE outcome = "runner-up" AND date = "2 march 1998"
SELECT "opponent_in_the_final" FROM "table_name_6" WHERE "2 march 1998" = "date" AND "outcome" = "runner-up"
0.105469
CREATE TABLE book (Writer VARCHAR)
List the writers of the books in ascending alphabetical order.
SELECT Writer FROM book ORDER BY Writer
SELECT "Writer" FROM "book" ORDER BY "Writer" NULLS FIRST
0.055664
CREATE TABLE table_50659 ("Fin. Pos" TEXT, "Car No." TEXT, "Driver" TEXT, "Team" TEXT, "Laps" TEXT, "Time/Retired" TEXT, "Grid" TEXT, "Laps Led" TEXT, "Points" TEXT)
What is the grid of driver tomas scheckter from vision racing team?
SELECT "Grid" FROM table_50659 WHERE "Team" = 'vision racing' AND "Driver" = 'tomas scheckter'
SELECT "Grid" FROM "table_50659" WHERE "Driver" = 'tomas scheckter' AND "Team" = 'vision racing'
0.09375
CREATE TABLE table_name_69 (date VARCHAR, name VARCHAR)
What date did the International Gold Cup take place?
SELECT date FROM table_name_69 WHERE name = "international gold cup"
SELECT "date" FROM "table_name_69" WHERE "international gold cup" = "name"
0.072266
CREATE TABLE table_name_1 (tournament VARCHAR, score VARCHAR)
what is the tournament when the score is 2-6, 4-6?
SELECT tournament FROM table_name_1 WHERE score = "2-6, 4-6"
SELECT "tournament" FROM "table_name_1" WHERE "2-6, 4-6" = "score"
0.064453
CREATE TABLE table_18776 ("Serial & Branch" FLOAT, "Seaman" TEXT, "Mechanical" TEXT, "Secretariat" TEXT, "Supply" TEXT, "Electrical" TEXT, "Radio Electrical" TEXT, "Regulating" TEXT, "Medical" TEXT)
Who regulates radio electrical = lren?
SELECT "Regulating" FROM table_18776 WHERE "Radio Electrical" = 'LREN'
SELECT "Regulating" FROM "table_18776" WHERE "Radio Electrical" = 'LREN'
0.070313
CREATE TABLE table_19653 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "Production code" FLOAT)
What is the title for the episode written by Robert Carlock & Dana Klein Borkow?
SELECT "Title" FROM table_19653 WHERE "Written by" = 'Robert Carlock & Dana Klein Borkow'
SELECT "Title" FROM "table_19653" WHERE "Written by" = 'Robert Carlock & Dana Klein Borkow'
0.088867
CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
when was the last time patient 027-14712 had a foley cath output?
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-14712')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'foley cath' ORDER BY intakeoutput.intakeoutputtime DESC LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '027-14712' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT "intakeoutput"."intakeoutputtime" FROM "intakeoutput" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "intakeoutput"."patientunitstayid" WHERE "intakeoutput"."celllabel" = 'foley cath' AND "intakeoutput"."cellpath" LIKE '%output%' AND NOT "_u_1"."" IS NULL ORDER BY "intakeoutput"."intakeoutputtime" DESC NULLS LAST LIMIT 1
0.666016
CREATE TABLE table_70814 ("Heat" FLOAT, "Lane" FLOAT, "Name" TEXT, "Nationality" TEXT, "Time" TEXT)
What nationality has a lane larger than 4 and a Time of 2:00.37?
SELECT "Nationality" FROM table_70814 WHERE "Lane" > '4' AND "Time" = '2:00.37'
SELECT "Nationality" FROM "table_70814" WHERE "Lane" > '4' AND "Time" = '2:00.37'
0.079102
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE 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)
how many patients are below 50 years of age and diagnosed with coronary atherosclerosis of native coronary artery?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "50" AND diagnoses.long_title = "Coronary atherosclerosis of native coronary artery"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Coronary atherosclerosis of native coronary artery" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "50" > "demographic"."age"
0.24707
CREATE TABLE table_70853 ("Date" TEXT, "Tournament" TEXT, "Winning score" TEXT, "Margin of victory" TEXT, "Runner ( s ) -up" TEXT)
What is the Margin of victory on oct 5, 1997?
SELECT "Margin of victory" FROM table_70853 WHERE "Date" = 'oct 5, 1997'
SELECT "Margin of victory" FROM "table_70853" WHERE "Date" = 'oct 5, 1997'
0.072266
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
how many of the unmarried patients belonged to white ethnic origin?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.ethnicity = "WHITE"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "SINGLE" = "demographic"."marital_status" AND "WHITE" = "demographic"."ethnicity"
0.152344
CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime 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 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 cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME)
how much does it cost for -bands lab tests?
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'lab' AND cost.eventid IN (SELECT lab.labid FROM lab WHERE lab.labname = '-bands')
WITH "_u_0" AS (SELECT "lab"."labid" FROM "lab" WHERE "lab"."labname" = '-bands' GROUP BY "labid") SELECT DISTINCT "cost"."cost" FROM "cost" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "cost"."eventid" WHERE "cost"."eventtype" = 'lab' AND NOT "_u_0"."" IS NULL
0.251953
CREATE TABLE table_name_21 (lead VARCHAR, season VARCHAR, third VARCHAR, second VARCHAR)
Which Lead has a Third of randy ferbey (skip), a Second of scott pfeifer, and a Season of 2009 10?
SELECT lead FROM table_name_21 WHERE third = "randy ferbey (skip)" AND second = "scott pfeifer" AND season = "2009–10"
SELECT "lead" FROM "table_name_21" WHERE "2009–10" = "season" AND "randy ferbey (skip)" = "third" AND "scott pfeifer" = "second"
0.125
CREATE TABLE table_74097 ("Institution" TEXT, "Location" TEXT, "Founded" FLOAT, "Affiliation" TEXT, "Enrollment" FLOAT, "Team Nickname" TEXT, "Primary conference" TEXT)
What is the nickname of the Adrian, Michigan team?
SELECT "Team Nickname" FROM table_74097 WHERE "Location" = 'Adrian, Michigan'
SELECT "Team Nickname" FROM "table_74097" WHERE "Location" = 'Adrian, Michigan'
0.077148
CREATE TABLE table_66291 ("Proto-Germanic" TEXT, "West Germanic" TEXT, "Old English" TEXT, "German" TEXT, "Dutch" TEXT)
What's the Proto-Germanic when the German is /t/?
SELECT "Proto-Germanic" FROM table_66291 WHERE "German" = '/t/'
SELECT "Proto-Germanic" FROM "table_66291" WHERE "German" = '/t/'
0.063477
CREATE TABLE table_name_18 (goals_for INT, ties INT)
What is the largest Goals For by a team that has more than 0 ties?
SELECT MAX(goals_for) FROM table_name_18 WHERE ties > 0
SELECT MAX("goals_for") FROM "table_name_18" WHERE "ties" > 0
0.05957
CREATE TABLE Courses (course_id INT, author_id INT, subject_id INT, course_name VARCHAR, course_description VARCHAR) CREATE TABLE Students (student_id INT, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR, password VARCHAR, personal_name VARCHAR, middle_name VARCHAR, family_name VARCHAR) CREATE TABLE Student_Tests_Taken (registration_id INT, date_test_taken DATETIME, test_result VARCHAR) CREATE TABLE Subjects (subject_id INT, subject_name VARCHAR) CREATE TABLE Student_Course_Enrolment (registration_id INT, student_id INT, course_id INT, date_of_enrolment DATETIME, date_of_completion DATETIME) CREATE TABLE Course_Authors_and_Tutors (author_id INT, author_tutor_ATB VARCHAR, login_name VARCHAR, password VARCHAR, personal_name VARCHAR, middle_name VARCHAR, family_name VARCHAR, gender_mf VARCHAR, address_line_1 VARCHAR)
Return a bar chart about the distribution of login_name and author_id .
SELECT login_name, author_id FROM Course_Authors_and_Tutors ORDER BY personal_name
SELECT "login_name", "author_id" FROM "Course_Authors_and_Tutors" ORDER BY "personal_name" NULLS FIRST
0.099609
CREATE TABLE table_name_24 (drawn INT, position VARCHAR, lost VARCHAR)
Which Drawn has a Position of 2, and a Lost larger than 2?
SELECT MIN(drawn) FROM table_name_24 WHERE position = 2 AND lost > 2
SELECT MIN("drawn") FROM "table_name_24" WHERE "lost" > 2 AND "position" = 2
0.074219
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 diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
give me the number of patients whose gender is f and insurance is self pay?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.insurance = "Self Pay"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "F" = "demographic"."gender" AND "Self Pay" = "demographic"."insurance"
0.142578
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 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 regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) 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) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL)
For those employees who was hired before 2002-06-21, return a bar chart about the distribution of hire_date and the sum of department_id bin hire_date by weekday.
SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE HIRE_DATE < '2002-06-21'
SELECT "HIRE_DATE", SUM("DEPARTMENT_ID") FROM "employees" WHERE "HIRE_DATE" < '2002-06-21'
0.087891
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 treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime 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 intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) 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 diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT)
how many times since 12/28/2105 patient 007-15837 had produced a output amt-jackson pratt drain c output?
SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-15837')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'output amt-jackson pratt drain c' AND STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime) >= '2105-12-28'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '007-15837' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) FROM "intakeoutput" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "intakeoutput"."patientunitstayid" WHERE "intakeoutput"."celllabel" = 'output amt-jackson pratt drain c' AND "intakeoutput"."cellpath" LIKE '%output%' AND NOT "_u_1"."" IS NULL AND STRFTIME('%y-%m-%d', "intakeoutput"."intakeoutputtime") >= '2105-12-28'
0.671875
CREATE TABLE table_20068 ("Name" TEXT, "Year" FLOAT, "Landfall" TEXT, "NHC Advisory Number" TEXT, "V ( mph ) " FLOAT, "R ( miles ) " FLOAT, "Saffir-Simpson Category" FLOAT, "CHI" TEXT)
What is the maximum number of miles reached in a Texas landfall when the Saffir-Simpson category is smaller than 3.0?
SELECT MAX("R(miles)") FROM table_20068 WHERE "Landfall" = 'Texas' AND "Saffir-Simpson Category" < '3.0'
SELECT MAX("R(miles)") FROM "table_20068" WHERE "Landfall" = 'Texas' AND "Saffir-Simpson Category" < '3.0'
0.103516
CREATE TABLE table_16724844_1 (mens_u20 VARCHAR, womens_40 VARCHAR)
How many times was the mens u20 recorded when the Womens 40 were Sydney Scorpions def North Queensland Cyclones?
SELECT COUNT(mens_u20) FROM table_16724844_1 WHERE womens_40 = "Sydney Scorpions def North Queensland Cyclones"
SELECT COUNT("mens_u20") FROM "table_16724844_1" WHERE "Sydney Scorpions def North Queensland Cyclones" = "womens_40"
0.114258
CREATE TABLE table_43807 ("Release date" TEXT, "Album title" TEXT, "Record label" TEXT, "Disc number" TEXT, "Track number" TEXT, "Title" TEXT)
Name The Title which has a Track number of 07, and a Record label of emi on 21 april 2006?
SELECT "Title" FROM table_43807 WHERE "Track number" = '07' AND "Record label" = 'emi' AND "Release date" = '21 april 2006'
SELECT "Title" FROM "table_43807" WHERE "Record label" = 'emi' AND "Release date" = '21 april 2006' AND "Track number" = '07'
0.12207
CREATE TABLE Maintenance_Contracts (maintenance_contract_id INT, maintenance_contract_company_id INT, contract_start_date DATETIME, contract_end_date DATETIME, other_contract_details VARCHAR) CREATE TABLE Asset_Parts (asset_id INT, part_id INT) CREATE TABLE Engineer_Visits (engineer_visit_id INT, contact_staff_id INT, engineer_id INT, fault_log_entry_id INT, fault_status VARCHAR, visit_start_datetime DATETIME, visit_end_datetime DATETIME, other_visit_details VARCHAR) CREATE TABLE Maintenance_Engineers (engineer_id INT, company_id INT, first_name VARCHAR, last_name VARCHAR, other_details VARCHAR) CREATE TABLE Skills (skill_id INT, skill_code VARCHAR, skill_description VARCHAR) CREATE TABLE Part_Faults (part_fault_id INT, part_id INT, fault_short_name VARCHAR, fault_description VARCHAR, other_fault_details VARCHAR) CREATE TABLE Fault_Log_Parts (fault_log_entry_id INT, part_fault_id INT, fault_status VARCHAR) CREATE TABLE Fault_Log (fault_log_entry_id INT, asset_id INT, recorded_by_staff_id INT, fault_log_entry_datetime DATETIME, fault_description VARCHAR, other_fault_details VARCHAR) CREATE TABLE Engineer_Skills (engineer_id INT, skill_id INT) CREATE TABLE Staff (staff_id INT, staff_name VARCHAR, gender VARCHAR, other_staff_details VARCHAR) CREATE TABLE Third_Party_Companies (company_id INT, company_type VARCHAR, company_name VARCHAR, company_address VARCHAR, other_company_details VARCHAR) CREATE TABLE Assets (asset_id INT, maintenance_contract_id INT, supplier_company_id INT, asset_details VARCHAR, asset_make VARCHAR, asset_model VARCHAR, asset_acquired_date DATETIME, asset_disposed_date DATETIME, other_asset_details VARCHAR) CREATE TABLE Parts (part_id INT, part_name VARCHAR, chargeable_yn VARCHAR, chargeable_amount VARCHAR, other_part_details VARCHAR) CREATE TABLE Skills_Required_To_Fix (part_fault_id INT, skill_id INT)
Return a scatter on how many assets does each third party company supply? List the count and the company id.
SELECT COUNT(*), company_id FROM Third_Party_Companies AS T1 JOIN Assets AS T2 ON T1.company_id = T2.supplier_company_id GROUP BY T1.company_id
SELECT COUNT(*), "company_id" FROM "Third_Party_Companies" AS "T1" JOIN "Assets" AS "T2" ON "T1"."company_id" = "T2"."supplier_company_id" GROUP BY "T1"."company_id"
0.161133
CREATE TABLE table_name_94 (draw VARCHAR, team VARCHAR)
What is the Draw for the team tramwajarz d ?
SELECT draw FROM table_name_94 WHERE team = "tramwajarz łódź"
SELECT "draw" FROM "table_name_94" WHERE "team" = "tramwajarz łódź"
0.06543
CREATE TABLE table_name_24 (south VARCHAR, west VARCHAR, east VARCHAR)
What is the south with ev lindau as the west and svg burgkirchen as the east?
SELECT south FROM table_name_24 WHERE west = "ev lindau" AND east = "svg burgkirchen"
SELECT "south" FROM "table_name_24" WHERE "east" = "svg burgkirchen" AND "ev lindau" = "west"
0.09082
CREATE TABLE table_73975 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "U.S. viewers ( millions ) " TEXT)
What number(s) in the series was written by bo crese?
SELECT "No. in series" FROM table_73975 WHERE "Written by" = 'Bo Crese'
SELECT "No. in series" FROM "table_73975" WHERE "Written by" = 'Bo Crese'
0.071289
CREATE TABLE Products (Code INT, Name VARCHAR, Price DECIMAL, Manufacturer INT) CREATE TABLE Manufacturers (Code INT, Name VARCHAR, Headquarter VARCHAR, Founder VARCHAR, Revenue FLOAT)
Draw a bar chart for what are the names and average prices of products for manufacturers whose products cost on average 150 or more?
SELECT T2.Name, AVG(T1.Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name
SELECT "T2"."Name", AVG("T1"."Price") FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "T2"."Name"
0.144531
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 records from the products and each product's manufacturer, return a bar chart about the distribution of headquarter and the average of revenue , and group by attribute headquarter, and I want to list by the Y-axis in asc.
SELECT Headquarter, AVG(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY AVG(Revenue)
SELECT "Headquarter", AVG("Revenue") FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "Headquarter" ORDER BY AVG("Revenue") NULLS FIRST
0.180664
CREATE TABLE ship (ship_id DECIMAL, name TEXT, type TEXT, built_year DECIMAL, class TEXT, flag TEXT) CREATE TABLE captain (captain_id DECIMAL, name TEXT, ship_id DECIMAL, age TEXT, class TEXT, rank TEXT)
Find the name and flag of ships that are not steered by any captain with Midshipman rank.
SELECT name, flag FROM ship WHERE NOT ship_id IN (SELECT ship_id FROM captain WHERE rank = 'Midshipman')
SELECT "name", "flag" FROM "ship" WHERE NOT "ship_id" IN (SELECT "ship_id" FROM "captain" WHERE "rank" = 'Midshipman')
0.115234
CREATE TABLE table_50983 ("Poll Year" TEXT, "Winner" TEXT, "Second" TEXT, "Third" TEXT, "Fourth" TEXT, "Fifth" TEXT, "Sixth" TEXT, "Seventh" TEXT, "Eighth" TEXT, "Ninth" TEXT, "Tenth" TEXT)
WHAT IS THE SIXTH WITH A SECOND OF WHITE LIES?
SELECT "Sixth" FROM table_50983 WHERE "Second" = 'white lies'
SELECT "Sixth" FROM "table_50983" WHERE "Second" = 'white lies'
0.061523
CREATE TABLE table_203_598 (id DECIMAL, "date" TEXT, "time" TEXT, "opponent" TEXT, "site" TEXT, "tv" TEXT, "result" TEXT, "attendance" DECIMAL)
how many dates had an attendance of over 60,000 ?
SELECT COUNT("date") FROM table_203_598 WHERE "attendance" > 60000
SELECT COUNT("date") FROM "table_203_598" WHERE "attendance" > 60000
0.066406
CREATE TABLE table_75811 ("Member State sorted by GDP" TEXT, "GDP in s billion of USD ( 2012 ) " FLOAT, "GDP % of EU ( 2012 ) " TEXT, "Annual change % of GDP ( 2012 ) " TEXT, "GDP per capita in PPP US$ ( 2012 ) " FLOAT, "Public Debt % of GDP ( 2013 Q1 ) " FLOAT, "Deficit ( - ) / Surplus ( + ) % of GDP ( 2012 ) " TEXT, "Inflation % Annual ( 2012 ) " FLOAT, "Unemp. % 2013 M7" FLOAT)
What is the largest inflation % annual in 2012 of the country with a public debt % of GDP in 2013 Q1 greater than 88.2 and a GDP % of EU in 2012 of 2.9%?
SELECT MAX("Inflation % Annual (2012)") FROM table_75811 WHERE "Public Debt % of GDP (2013 Q1)" > '88.2' AND "GDP % of EU (2012)" = '2.9%'
SELECT MAX("Inflation % Annual (2012)") FROM "table_75811" WHERE "GDP % of EU (2012)" = '2.9%' AND "Public Debt % of GDP (2013 Q1)" > '88.2'
0.136719
CREATE TABLE table_name_17 (result VARCHAR, score VARCHAR, venue VARCHAR, date VARCHAR)
What was the result at dakar , senegal, on 3 september 2011, and with a Score of 2 0?
SELECT result FROM table_name_17 WHERE venue = "dakar , senegal" AND date = "3 september 2011" AND score = "2–0"
SELECT "result" FROM "table_name_17" WHERE "2–0" = "score" AND "3 september 2011" = "date" AND "dakar , senegal" = "venue"
0.119141
CREATE TABLE table_10584 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
Hawthorn played as an Away team in which venue?
SELECT "Venue" FROM table_10584 WHERE "Away team" = 'hawthorn'
SELECT "Venue" FROM "table_10584" WHERE "Away team" = 'hawthorn'
0.0625
CREATE TABLE table_name_62 (opponent_in_the_final VARCHAR, score_in_the_final VARCHAR)
Which Opponent in the final has a Score in the final of 6 2, 6 3, 2 6, 7 5?
SELECT opponent_in_the_final FROM table_name_62 WHERE score_in_the_final = "6–2, 6–3, 2–6, 7–5"
SELECT "opponent_in_the_final" FROM "table_name_62" WHERE "6–2, 6–3, 2–6, 7–5" = "score_in_the_final"
0.098633
CREATE TABLE table_33462 ("Network" TEXT, "Origin of Programming" TEXT, "Language" TEXT, "Genre" TEXT, "Service" TEXT)
Where does the network Star Cricket originate?
SELECT "Origin of Programming" FROM table_33462 WHERE "Genre" = 'cricket' AND "Network" = 'star cricket'
SELECT "Origin of Programming" FROM "table_33462" WHERE "Genre" = 'cricket' AND "Network" = 'star cricket'
0.103516
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) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE 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 medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL)
give me the length of stay of patient 022-89058's first stay in the icu.
SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-89058') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '022-89058' GROUP BY "patienthealthsystemstayid") SELECT STRFTIME('%j', "patient"."unitdischargetime") - STRFTIME('%j', "patient"."unitadmittime") FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL AND NOT "patient"."unitadmittime" IS NULL ORDER BY "patient"."unitadmittime" NULLS FIRST LIMIT 1
0.460938
CREATE TABLE table_1341718_14 (first_elected INT, party VARCHAR, candidates VARCHAR)
When was the first elected when the party was republican and the candidate were robert h. michel (r) 66.1% rosa lee fox (d) 33.9%?
SELECT MIN(first_elected) FROM table_1341718_14 WHERE party = "Republican" AND candidates = "Robert H. Michel (R) 66.1% Rosa Lee Fox (D) 33.9%"
SELECT MIN("first_elected") FROM "table_1341718_14" WHERE "Republican" = "party" AND "Robert H. Michel (R) 66.1% Rosa Lee Fox (D) 33.9%" = "candidates"
0.147461
CREATE TABLE table_169 ("#" FLOAT, "Episode" TEXT, "Air Date" TEXT, "Timeslot ( EST ) " TEXT, "Rating" TEXT, "Share" TEXT, "18\\u201349 Rating" TEXT, "Viewers ( millions ) " TEXT, "Rank" TEXT)
What was the # for the episode 'the wedding'?
SELECT MAX("#") FROM table_169 WHERE "Episode" = 'The Wedding'
SELECT MAX("#") FROM "table_169" WHERE "Episode" = 'The Wedding'
0.0625
CREATE TABLE table_78080 ("Airing date" TEXT, "Number of episodes" FLOAT, "HD format" TEXT, "Highest average point ratings" FLOAT, "Genre" TEXT, "Official website" TEXT)
What are the number of episodes when the genre is modern drama and the highest average ratings points are 28?
SELECT AVG("Number of episodes") FROM table_78080 WHERE "Genre" = 'modern drama' AND "Highest average point ratings" = '28'
SELECT AVG("Number of episodes") FROM "table_78080" WHERE "Genre" = 'modern drama' AND "Highest average point ratings" = '28'
0.12207
CREATE TABLE table_22834834_3 (outcome VARCHAR, score_in_the_final VARCHAR)
Which outcomes have a final score of 6 3, 6 2?
SELECT outcome FROM table_22834834_3 WHERE score_in_the_final = "6–3, 6–2"
SELECT "outcome" FROM "table_22834834_3" WHERE "6–3, 6–2" = "score_in_the_final"
0.078125
CREATE TABLE table_17988 ("No." FLOAT, "Air Date" TEXT, "Rating" TEXT, "Share" FLOAT, "18-49 ( Rating/Share ) " TEXT, "Viewers ( m ) " TEXT, "Night" FLOAT, "Timeslot" FLOAT, "Overall" TEXT)
what are all the overall with viewers (m) being 2.61
SELECT "Overall" FROM table_17988 WHERE "Viewers (m)" = '2.61'
SELECT "Overall" FROM "table_17988" WHERE "Viewers (m)" = '2.61'
0.0625
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 diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
what is the number of patients whose diagnoses short title is do not resusctate status and lab test category is hematology?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Do not resusctate status" AND lab."CATEGORY" = "Hematology"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Do not resusctate status" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "Hematology" = "lab"."CATEGORY" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.280273
CREATE TABLE table_name_68 (december INT, record VARCHAR, game VARCHAR)
Record of 15-12-4, and a Game larger than 31 involves what highest December?
SELECT MAX(december) FROM table_name_68 WHERE record = "15-12-4" AND game > 31
SELECT MAX("december") FROM "table_name_68" WHERE "15-12-4" = "record" AND "game" > 31
0.083984
CREATE TABLE table_name_42 (losses INT, against VARCHAR, wins VARCHAR)
Which Losses have an Against smaller than 1018, and Wins smaller than 14?
SELECT AVG(losses) FROM table_name_42 WHERE against < 1018 AND wins < 14
SELECT AVG("losses") FROM "table_name_42" WHERE "against" < 1018 AND "wins" < 14
0.078125
CREATE TABLE table_40396 ("Couple" TEXT, "Style" TEXT, "Music" TEXT, "Choreographer ( s ) " TEXT, "Results" TEXT)
Which couple participated in the Paso Doble style and were safe?
SELECT "Couple" FROM table_40396 WHERE "Results" = 'safe' AND "Style" = 'paso doble'
SELECT "Couple" FROM "table_40396" WHERE "Results" = 'safe' AND "Style" = 'paso doble'
0.083984
CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE area (course_id INT, area VARCHAR) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE course (course_id INT, name VARCHAR, department VARCHAR, number VARCHAR, credits VARCHAR, advisory_requirement VARCHAR, enforced_requirement VARCHAR, description VARCHAR, num_semesters INT, num_enrolled INT, has_discussion VARCHAR, has_lab VARCHAR, has_projects VARCHAR, has_exams VARCHAR, num_reviews INT, clarity_score INT, easiness_score INT, helpfulness_score INT) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE course_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR)
Between EECS 540 and EECS 628 ; which is the easiest ?
SELECT DISTINCT course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (course.number = 540 OR course.number = 628) AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 INNER JOIN course AS COURSEalias1 ON PROGRAM_COURSEalias1.course_id = COURSEalias1.course_id WHERE (COURSEalias1.number = 540 OR COURSEalias1.number = 628) AND COURSEalias1.department = 'EECS')
WITH "_u_0" AS (SELECT MIN("PROGRAM_COURSEalias1"."workload") FROM "program_course" AS "PROGRAM_COURSEalias1" JOIN "course" AS "COURSEalias1" ON "COURSEalias1"."course_id" = "PROGRAM_COURSEalias1"."course_id" AND "COURSEalias1"."department" = 'EECS' AND ("COURSEalias1"."number" = 540 OR "COURSEalias1"."number" = 628)) SELECT DISTINCT "course"."number" FROM "course" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "program_course"."workload" WHERE "course"."number" = 540 OR "course"."number" = 628
0.552734
CREATE TABLE table_name_31 (lost INT, goals_for VARCHAR, position VARCHAR)
How many lost when goals for is 43 and the position number is higher than 15?
SELECT AVG(lost) FROM table_name_31 WHERE goals_for = 43 AND position > 15
SELECT AVG("lost") FROM "table_name_31" WHERE "goals_for" = 43 AND "position" > 15
0.080078
CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) 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 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 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 days (days_code VARCHAR, day_name 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 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 fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) 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 city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE code_description (code VARCHAR, description TEXT)
flights from CINCINNATI to SALT LAKE CITY
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'CINCINNATI' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SALT LAKE CITY' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'CINCINNATI' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'SALT LAKE CITY'
0.503906
CREATE TABLE department_stores (dept_store_id DECIMAL, dept_store_chain_id DECIMAL, store_name TEXT, store_address TEXT, store_phone TEXT, store_email TEXT) CREATE TABLE products (product_id DECIMAL, product_type_code TEXT, product_name TEXT, product_price DECIMAL) CREATE TABLE staff (staff_id DECIMAL, staff_gender TEXT, staff_name TEXT) CREATE TABLE supplier_addresses (supplier_id DECIMAL, address_id DECIMAL, date_from TIME, date_to TIME) CREATE TABLE staff_department_assignments (staff_id DECIMAL, department_id DECIMAL, date_assigned_from TIME, job_title_code TEXT, date_assigned_to TIME) CREATE TABLE product_suppliers (product_id DECIMAL, supplier_id DECIMAL, date_supplied_from TIME, date_supplied_to TIME, total_amount_purchased TEXT, total_value_purchased DECIMAL) CREATE TABLE customer_orders (order_id DECIMAL, customer_id DECIMAL, order_status_code TEXT, order_date TIME) CREATE TABLE order_items (order_item_id DECIMAL, order_id DECIMAL, product_id DECIMAL) CREATE TABLE customer_addresses (customer_id DECIMAL, address_id DECIMAL, date_from TIME, date_to TIME) CREATE TABLE suppliers (supplier_id DECIMAL, supplier_name TEXT, supplier_phone TEXT) CREATE TABLE addresses (address_id DECIMAL, address_details TEXT) CREATE TABLE departments (department_id DECIMAL, dept_store_id DECIMAL, department_name TEXT) CREATE TABLE customers (customer_id DECIMAL, payment_method_code TEXT, customer_code TEXT, customer_name TEXT, customer_address TEXT, customer_phone TEXT, customer_email TEXT) CREATE TABLE department_store_chain (dept_store_chain_id DECIMAL, dept_store_chain_name TEXT)
What is the average price for each type of product?
SELECT product_type_code, AVG(product_price) FROM products GROUP BY product_type_code
SELECT "product_type_code", AVG("product_price") FROM "products" GROUP BY "product_type_code"
0.09082
CREATE TABLE table_73451 ("No." FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "Production code" TEXT, "Viewers ( in millions ) " TEXT)
How many millions of people viewed 'Father's Day'?
SELECT "Viewers (in millions)" FROM table_73451 WHERE "Title" = 'Father''s Day'
SELECT "Viewers (in millions)" FROM "table_73451" WHERE "Title" = 'Father\'s Day'
0.079102
CREATE TABLE table_58336 ("Player" TEXT, "Height" TEXT, "School" TEXT, "Hometown" TEXT, "College" TEXT, "NBA Draft" TEXT)
What is the Hometown for Villanova College?
SELECT "Hometown" FROM table_58336 WHERE "College" = 'villanova'
SELECT "Hometown" FROM "table_58336" WHERE "College" = 'villanova'
0.064453
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE 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)
count the number of married patients who underwent dx ultrasound heart.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "MARRIED" AND procedures.short_title = "Dx ultrasound-heart"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Dx ultrasound-heart" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "MARRIED" = "demographic"."marital_status"
0.236328
CREATE TABLE table_42694 ("Position" FLOAT, "Team" TEXT, "Points" FLOAT, "Played" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "Against" FLOAT, "Difference" TEXT)
How many positions have 15 for the points, with a drawn less than 3?
SELECT SUM("Position") FROM table_42694 WHERE "Points" = '15' AND "Drawn" < '3'
SELECT SUM("Position") FROM "table_42694" WHERE "Drawn" < '3' AND "Points" = '15'
0.079102
CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE flight_fare (flight_id INT, fare_id 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 month (month_number INT, month_name TEXT) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) 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 fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE 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 equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT)
okay can you tell me the earliest flight which leaves from PHILADELPHIA to DALLAS
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.departure_time = (SELECT MIN(FLIGHTalias1.departure_time) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, flight AS FLIGHTalias1 WHERE CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'PHILADELPHIA' AND CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'DALLAS' AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code)
WITH "_u_0" AS (SELECT MIN("FLIGHTalias1"."departure_time") FROM "airport_service" AS "AIRPORT_SERVICEalias2" JOIN "city" AS "CITYalias2" ON "AIRPORT_SERVICEalias2"."city_code" = "CITYalias2"."city_code" AND "CITYalias2"."city_name" = 'PHILADELPHIA' JOIN "flight" AS "FLIGHTalias1" ON "AIRPORT_SERVICEalias2"."airport_code" = "FLIGHTalias1"."from_airport" JOIN "airport_service" AS "AIRPORT_SERVICEalias3" ON "AIRPORT_SERVICEalias3"."airport_code" = "FLIGHTalias1"."to_airport" JOIN "city" AS "CITYalias3" ON "AIRPORT_SERVICEalias3"."city_code" = "CITYalias3"."city_code" AND "CITYalias3"."city_name" = 'DALLAS') SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'PHILADELPHIA' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "flight"."departure_time" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'DALLAS'
1.158203
CREATE TABLE table_69387 ("Year" TEXT, "Champion" TEXT, "Runner-Up" TEXT, "3rd Place" TEXT, "Location" TEXT)
Name the runner-up which has 3rd place of terry hollands
SELECT "Runner-Up" FROM table_69387 WHERE "3rd Place" = 'terry hollands'
SELECT "Runner-Up" FROM "table_69387" WHERE "3rd Place" = 'terry hollands'
0.072266
CREATE TABLE table_65356 ("Pick" FLOAT, "Player" TEXT, "Country of origin*" TEXT, "PBA team" TEXT, "College" TEXT)
What is the pba team for the player who went to santo tomas college?
SELECT "PBA team" FROM table_65356 WHERE "College" = 'santo tomas'
SELECT "PBA team" FROM "table_65356" WHERE "College" = 'santo tomas'
0.066406
CREATE TABLE table_51797 ("Year" TEXT, "Team" TEXT, "Comp" TEXT, "Long" TEXT, "Rate" TEXT, "RAtt" TEXT, "RYds" TEXT, "RAvg" TEXT)
Which team has a Ravg of 1.3?
SELECT "Team" FROM table_51797 WHERE "RAvg" = '1.3'
SELECT "Team" FROM "table_51797" WHERE "RAvg" = '1.3'
0.051758
CREATE TABLE table_train_189 ("id" INT, "alt" FLOAT, "hyperglycemia" BOOLEAN, "liver_disease" BOOLEAN, "smoking" BOOLEAN, "alcohol_abuse" BOOLEAN, "drug_abuse" BOOLEAN, "triglyceride_tg" FLOAT, "NOUSE" FLOAT)
uncontrolled hyperglycemia
SELECT * FROM table_train_189 WHERE hyperglycemia = 1
SELECT * FROM "table_train_189" WHERE "hyperglycemia" = 1
0.055664
CREATE TABLE table_dev_18 ("id" INT, "bleeding" INT, "chronic_anticoagulant_therapy" BOOLEAN, "renal_disease" BOOLEAN, "hyperlipidemia" BOOLEAN, "creatinine_clearance_cl" FLOAT, "chronic_hemostasis_disorders" BOOLEAN, "significant_proteinuria" BOOLEAN, "platelet_count" FLOAT, "total_cholesterol" INT, "albumin_excretion" INT, "ldl" INT, "serum_creatinine" FLOAT, "chronic_warfarin_therapy" BOOLEAN, "heparin" BOOLEAN, "renal_transplantation" BOOLEAN, "triglyceride_tg" FLOAT, "inr" FLOAT, "NOUSE" FLOAT)
increased risk of bleeding ( platelet count < 80000 ; inr > 1.5 ) , other chronic hemostasis disorders, or treatment with chronic anticoagulant therapy ( i.e., heparin or warfarin ) .
SELECT * FROM table_dev_18 WHERE bleeding = 1 OR (platelet_count < 80000 OR inr > 1.5) OR chronic_hemostasis_disorders = 1 OR chronic_anticoagulant_therapy = 1 OR (heparin = 1 OR chronic_warfarin_therapy = 1)
SELECT * FROM "table_dev_18" WHERE "bleeding" = 1 OR "chronic_anticoagulant_therapy" = 1 OR "chronic_hemostasis_disorders" = 1 OR "chronic_warfarin_therapy" = 1 OR "heparin" = 1 OR "inr" > 1.5 OR "platelet_count" < 80000
0.214844
CREATE TABLE table_31502 ("Townland" TEXT, "Area ( acres ) " FLOAT, "Barony" TEXT, "Civil parish" TEXT, "Poor law union" TEXT)
what is the barony and an area of 560?
SELECT "Barony" FROM table_31502 WHERE "Area( acres )" = '560'
SELECT "Barony" FROM "table_31502" WHERE "Area( acres )" = '560'
0.0625
CREATE TABLE table_name_41 (total INT, player VARCHAR, to_par VARCHAR)
What was Gary Player's highest total when his To par was over 15?
SELECT MAX(total) FROM table_name_41 WHERE player = "gary player" AND to_par > 15
SELECT MAX("total") FROM "table_name_41" WHERE "gary player" = "player" AND "to_par" > 15
0.086914
CREATE TABLE field (fieldid INT) CREATE TABLE paperfield (fieldid INT, paperid INT) CREATE TABLE journal (journalid INT, journalname VARCHAR) CREATE TABLE paperkeyphrase (paperid INT, keyphraseid INT) CREATE TABLE keyphrase (keyphraseid INT, keyphrasename VARCHAR) CREATE TABLE paperdataset (paperid INT, datasetid INT) CREATE TABLE paper (paperid INT, title VARCHAR, venueid INT, year INT, numciting INT, numcitedby INT, journalid INT) CREATE TABLE author (authorid INT, authorname VARCHAR) CREATE TABLE cite (citingpaperid INT, citedpaperid INT) CREATE TABLE writes (paperid INT, authorid INT) CREATE TABLE dataset (datasetid INT, datasetname VARCHAR) CREATE TABLE venue (venueid INT, venuename VARCHAR)
Decision Feedback authors using Multiuser Receiver
SELECT DISTINCT writes.authorid FROM keyphrase, paper, paperkeyphrase, writes WHERE keyphrase.keyphrasename IN ('Multiuser Receiver', 'Decision Feedback') AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND writes.paperid = paper.paperid GROUP BY writes.authorid HAVING COUNT(DISTINCT keyphrase.keyphrasename) > 1
SELECT DISTINCT "writes"."authorid" FROM "keyphrase" JOIN "paperkeyphrase" ON "keyphrase"."keyphraseid" = "paperkeyphrase"."keyphraseid" JOIN "paper" ON "paper"."paperid" = "paperkeyphrase"."paperid" JOIN "writes" ON "paper"."paperid" = "writes"."paperid" WHERE "keyphrase"."keyphrasename" IN ('Multiuser Receiver', 'Decision Feedback') GROUP BY "writes"."authorid" HAVING COUNT(DISTINCT "keyphrase"."keyphrasename") > 1
0.410156
CREATE TABLE table_17505751_5 (Champions VARCHAR, position VARCHAR, league VARCHAR)
In the Champions league is the forward position smaller than 6.0
SELECT COUNT(Champions) AS league FROM table_17505751_5 WHERE position = "Forward" AND league < 6.0
SELECT COUNT("Champions") AS "league" FROM "table_17505751_5" WHERE "Forward" = "position" AND "league" < 6.0
0.106445
CREATE TABLE table_69177 ("Position" FLOAT, "Club" TEXT, "Played" FLOAT, "Points" TEXT, "Wins" FLOAT, "Draws" FLOAT, "Losses" FLOAT, "Goals for" FLOAT, "Goals against" FLOAT, "Goal Difference" FLOAT)
For the team with 39+1 points and fewer than 7 draws, how many wins were scored?
SELECT COUNT("Wins") FROM table_69177 WHERE "Points" = '39+1' AND "Draws" < '7'
SELECT COUNT("Wins") FROM "table_69177" WHERE "Draws" < '7' AND "Points" = '39+1'
0.079102
CREATE TABLE table_21152 ("Season" FLOAT, "Class" TEXT, "Motorcycle" TEXT, "Team" TEXT, "Races" FLOAT, "Wins" FLOAT, "Podiums" FLOAT, "Poles" FLOAT, "FLaps" FLOAT, "Points" TEXT, "Placement" TEXT)
Name the motorcycle for season 2012
SELECT "Motorcycle" FROM table_21152 WHERE "Season" = '2012'
SELECT "Motorcycle" FROM "table_21152" WHERE "Season" = '2012'
0.060547
CREATE TABLE table_49389 ("Province" TEXT, "Population" FLOAT, "Region" TEXT, "Name of City" TEXT, "Districts" FLOAT)
Which district is in the province of Piura?
SELECT "Districts" FROM table_49389 WHERE "Province" = 'piura'
SELECT "Districts" FROM "table_49389" WHERE "Province" = 'piura'
0.0625
CREATE TABLE table_14656147_2 (attendance VARCHAR, opponent VARCHAR)
type the attendance for playing with tampa bay buccaneers?
SELECT attendance FROM table_14656147_2 WHERE opponent = "Tampa Bay Buccaneers"
SELECT "attendance" FROM "table_14656147_2" WHERE "Tampa Bay Buccaneers" = "opponent"
0.083008
CREATE TABLE table_54426 ("Driver" TEXT, "Constructor" TEXT, "Laps" FLOAT, "Time/Retired" TEXT, "Grid" FLOAT)
What is the total amount of grid when the laps amount was smaller than 68 and the time/retired was injection?
SELECT SUM("Grid") FROM table_54426 WHERE "Laps" < '68' AND "Time/Retired" = 'injection'
SELECT SUM("Grid") FROM "table_54426" WHERE "Laps" < '68' AND "Time/Retired" = 'injection'
0.087891
CREATE TABLE table_name_85 (place VARCHAR, to_par VARCHAR)
What is the place number for the player with a To Par score of 'E'?
SELECT place FROM table_name_85 WHERE to_par = "e"
SELECT "place" FROM "table_name_85" WHERE "e" = "to_par"
0.054688
CREATE TABLE table_45301 ("Type" TEXT, "Construction period" TEXT, "Cylinder" TEXT, "Capacity" TEXT, "Power" TEXT, "Vmax" TEXT)
What was the maximum speed for the P4-1 (24/36 ps)?
SELECT "Vmax" FROM table_45301 WHERE "Type" = 'p4-1 (24/36 ps)'
SELECT "Vmax" FROM "table_45301" WHERE "Type" = 'p4-1 (24/36 ps)'
0.063477
CREATE TABLE debate_people (Name VARCHAR, People_id VARCHAR, Affirmative VARCHAR) CREATE TABLE people (Name VARCHAR, People_id VARCHAR, Affirmative VARCHAR)
List the names of people that have not been on the affirmative side of debates.
SELECT Name FROM people WHERE NOT People_id IN (SELECT Affirmative FROM debate_people)
SELECT "Name" FROM "people" WHERE NOT "People_id" IN (SELECT "Affirmative" FROM "debate_people")
0.09375
CREATE TABLE table_19805130_3 (share VARCHAR, rank__night_ VARCHAR)
If the night rank is 9, what is the total share number?
SELECT COUNT(share) FROM table_19805130_3 WHERE rank__night_ = "9"
SELECT COUNT("share") FROM "table_19805130_3" WHERE "9" = "rank__night_"
0.070313
CREATE TABLE event (Event_ID INT, Date TEXT, Venue TEXT, Name TEXT, Event_Attendance INT) CREATE TABLE journalist (journalist_ID INT, Name TEXT, Nationality TEXT, Age TEXT, Years_working INT) CREATE TABLE news_report (journalist_ID INT, Event_ID INT, Work_Type TEXT)
What are the nationalities and their average ages of journalists Show me a bar chart, and list x-axis from low to high order.
SELECT Nationality, AVG(Age) FROM journalist GROUP BY Nationality ORDER BY Nationality
SELECT "Nationality", AVG("Age") FROM "journalist" GROUP BY "Nationality" ORDER BY "Nationality" NULLS FIRST
0.105469
CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description 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 time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE 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 dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT)
please list available flights for next saturday from PHILADELPHIA to DALLAS
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 = 'DALLAS' AND date_day.day_number = 26 AND date_day.month_number = 7 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
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "date_day" ON "date_day"."day_number" = 26 AND "date_day"."month_number" = 7 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" JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'DALLAS'
0.708984
CREATE TABLE table_name_33 (district VARCHAR, party VARCHAR, first_elected VARCHAR)
In which district is the incumbent a republican first elected in 1998?
SELECT district FROM table_name_33 WHERE party = "republican" AND first_elected = 1998
SELECT "district" FROM "table_name_33" WHERE "first_elected" = 1998 AND "party" = "republican"
0.091797
CREATE TABLE table_name_69 (year INT, venue VARCHAR)
When is the earliest year the venue is in gothenburg, sweden?
SELECT MIN(year) FROM table_name_69 WHERE venue = "gothenburg, sweden"
SELECT MIN("year") FROM "table_name_69" WHERE "gothenburg, sweden" = "venue"
0.074219
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE 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 prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
count the number of patients whose discharge location is snf and admission year is less than 2162?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "SNF" AND demographic.admityear < "2162"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "2162" > "demographic"."admityear" AND "SNF" = "demographic"."discharge_location"
0.152344
CREATE TABLE tourist_attraction_features (tourist_attraction_id DECIMAL, feature_id DECIMAL) CREATE TABLE visits (visit_id DECIMAL, tourist_attraction_id DECIMAL, tourist_id DECIMAL, visit_date TIME, visit_details TEXT) CREATE TABLE shops (shop_id DECIMAL, shop_details TEXT) CREATE TABLE theme_parks (theme_park_id DECIMAL, theme_park_details TEXT) CREATE TABLE tourist_attractions (tourist_attraction_id DECIMAL, attraction_type_code TEXT, location_id DECIMAL, how_to_get_there TEXT, name TEXT, description TEXT, opening_hours TEXT, other_details TEXT) CREATE TABLE hotels (hotel_id DECIMAL, star_rating_code TEXT, pets_allowed_yn TEXT, price_range DECIMAL, other_hotel_details TEXT) CREATE TABLE street_markets (market_id DECIMAL, market_details TEXT) CREATE TABLE ref_hotel_star_ratings (star_rating_code TEXT, star_rating_description TEXT) CREATE TABLE features (feature_id DECIMAL, feature_details TEXT) CREATE TABLE museums (museum_id DECIMAL, museum_details TEXT) CREATE TABLE ref_attraction_types (attraction_type_code TEXT, attraction_type_description TEXT) CREATE TABLE locations (location_id DECIMAL, location_name TEXT, address TEXT, other_details TEXT) CREATE TABLE photos (photo_id DECIMAL, tourist_attraction_id DECIMAL, name TEXT, description TEXT, filename TEXT, other_details TEXT) CREATE TABLE royal_family (royal_family_id DECIMAL, royal_family_details TEXT) CREATE TABLE staff (staff_id DECIMAL, tourist_attraction_id DECIMAL, name TEXT, other_details TEXT) CREATE TABLE visitors (tourist_id DECIMAL, tourist_details TEXT)
What are the details of the three most expensive hotels?
SELECT other_hotel_details FROM hotels ORDER BY price_range DESC LIMIT 3
SELECT "other_hotel_details" FROM "hotels" ORDER BY "price_range" DESC NULLS LAST LIMIT 3
0.086914
CREATE TABLE table_name_50 (year INT, play VARCHAR, recipient VARCHAR)
Name the average year for much ado about nothing and recipient of ray virta
SELECT AVG(year) FROM table_name_50 WHERE play = "much ado about nothing" AND recipient = "ray virta"
SELECT AVG("year") FROM "table_name_50" WHERE "much ado about nothing" = "play" AND "ray virta" = "recipient"
0.106445
CREATE TABLE table_72300 ("Election" FLOAT, "# of candidates nominated" FLOAT, "# of seats won" FLOAT, "# of total votes" FLOAT, "% of popular vote" TEXT)
What is the # of seats one for the election in 1974?
SELECT "# of seats won" FROM table_72300 WHERE "Election" = '1974'
SELECT "# of seats won" FROM "table_72300" WHERE "Election" = '1974'
0.066406
CREATE TABLE event (ID INT, Name TEXT, Stadium_ID INT, Year TEXT) CREATE TABLE swimmer (ID INT, name TEXT, Nationality TEXT, meter_100 FLOAT, meter_200 TEXT, meter_300 TEXT, meter_400 TEXT, meter_500 TEXT, meter_600 TEXT, meter_700 TEXT, Time TEXT) CREATE TABLE stadium (ID INT, name TEXT, Capacity INT, City TEXT, Country TEXT, Opening_year INT) CREATE TABLE record (ID INT, Result TEXT, Swimmer_ID INT, Event_ID INT)
Give me the comparison about the amount of Nationality over the Nationality , and group by attribute Nationality, and show in ascending by the X-axis.
SELECT Nationality, COUNT(Nationality) FROM swimmer GROUP BY Nationality ORDER BY Nationality
SELECT "Nationality", COUNT("Nationality") FROM "swimmer" GROUP BY "Nationality" ORDER BY "Nationality" NULLS FIRST
0.112305
CREATE TABLE table_25773915_11 (fumrec VARCHAR, player VARCHAR)
If the player is Reed Doughty, what isthe fumrec?
SELECT fumrec FROM table_25773915_11 WHERE player = "Reed Doughty"
SELECT "fumrec" FROM "table_25773915_11" WHERE "Reed Doughty" = "player"
0.070313
CREATE TABLE events (event_id DECIMAL, address_id DECIMAL, channel_id DECIMAL, event_type_code TEXT, finance_id DECIMAL, location_id DECIMAL) CREATE TABLE locations (location_id DECIMAL, other_details TEXT) CREATE TABLE finances (finance_id DECIMAL, other_details TEXT) CREATE TABLE channels (channel_id DECIMAL, other_details TEXT) CREATE TABLE parties_in_events (party_id DECIMAL, event_id DECIMAL, role_code TEXT) CREATE TABLE assets_in_events (asset_id DECIMAL, event_id DECIMAL) CREATE TABLE products (product_id DECIMAL, product_type_code TEXT, product_name TEXT, product_price DECIMAL) CREATE TABLE parties (party_id DECIMAL, party_details TEXT) CREATE TABLE addresses (address_id DECIMAL, address_details TEXT) CREATE TABLE assets (asset_id DECIMAL, other_details TEXT) CREATE TABLE products_in_events (product_in_event_id DECIMAL, event_id DECIMAL, product_id DECIMAL) CREATE TABLE agreements (document_id DECIMAL, event_id DECIMAL)
What is the name of the product with the highest price?
SELECT product_name FROM products ORDER BY product_price DESC LIMIT 1
SELECT "product_name" FROM "products" ORDER BY "product_price" DESC NULLS LAST LIMIT 1
0.083984
CREATE TABLE table_28760804_1 (title VARCHAR, directed_by VARCHAR)
What is the title of the episode Alex Reid directed?
SELECT title FROM table_28760804_1 WHERE directed_by = "Alex Reid"
SELECT "title" FROM "table_28760804_1" WHERE "Alex Reid" = "directed_by"
0.070313
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT)
on 12/30/this year, when was the last time that the heartrate of patient 006-14121 was less than 121.0?
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-14121')) AND vitalperiodic.heartrate < 121.0 AND NOT vitalperiodic.heartrate IS NULL AND DATETIME(vitalperiodic.observationtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m-%d', vitalperiodic.observationtime) = '12-30' ORDER BY vitalperiodic.observationtime DESC LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '006-14121' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT "vitalperiodic"."observationtime" FROM "vitalperiodic" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "vitalperiodic"."patientunitstayid" WHERE "vitalperiodic"."heartrate" < 121.0 AND DATETIME("vitalperiodic"."observationtime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND NOT "_u_1"."" IS NULL AND NOT "vitalperiodic"."heartrate" IS NULL AND STRFTIME('%m-%d', "vitalperiodic"."observationtime") = '12-30' ORDER BY "vitalperiodic"."observationtime" DESC NULLS LAST LIMIT 1
0.842773
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 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 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 treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
patient 012-63427 has received any procedure?
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-63427'))
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '012-63427' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) > 0 FROM "treatment" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "treatment"."patientunitstayid" WHERE NOT "_u_1"."" IS NULL
0.484375
CREATE TABLE TRACK (UnitPrice INT)
What is the average unit price of all the tracks?
SELECT AVG(UnitPrice) FROM TRACK
SELECT AVG("UnitPrice") FROM "TRACK"
0.035156
CREATE TABLE table_60782 ("Region" TEXT, "Year" TEXT, "Label" TEXT, "Format" TEXT, "Catalog" TEXT)
Which region had the year May 1974?
SELECT "Region" FROM table_60782 WHERE "Year" = 'may 1974'
SELECT "Region" FROM "table_60782" WHERE "Year" = 'may 1974'
0.058594
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 d_labitems (row_id DECIMAL, itemid DECIMAL, label 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 diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime 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 d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title 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 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 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 cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT)
retrieve the patients' ids who are diagnosed with acc poisn-sympatholytics until 4 years ago.
SELECT admissions.subject_id FROM admissions WHERE admissions.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'acc poisn-sympatholytics') AND DATETIME(diagnoses_icd.charttime) <= DATETIME(CURRENT_TIME(), '-4 year'))
WITH "_u_1" AS (SELECT "diagnoses_icd"."hadm_id" FROM "diagnoses_icd" JOIN "d_icd_diagnoses" ON "d_icd_diagnoses"."icd9_code" = "diagnoses_icd"."icd9_code" AND "d_icd_diagnoses"."short_title" = 'acc poisn-sympatholytics' WHERE DATETIME("diagnoses_icd"."charttime") <= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY "hadm_id") SELECT "admissions"."subject_id" FROM "admissions" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "admissions"."hadm_id" WHERE NOT "_u_1"."" IS NULL
0.456055