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 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 countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_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) 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 jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL)
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, give me the comparison about the sum of employee_id over the hire_date bin hire_date by time, and list by the sum employee id in ascending please.
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY SUM(EMPLOYEE_ID)
SELECT "HIRE_DATE", SUM("EMPLOYEE_ID") FROM "employees" WHERE ("COMMISSION_PCT" <> "null" OR "DEPARTMENT_ID" <> 40) AND ("DEPARTMENT_ID" <> 40 OR "SALARY" <= 12000) AND ("DEPARTMENT_ID" <> 40 OR "SALARY" >= 8000) ORDER BY SUM("EMPLOYEE_ID") NULLS FIRST
0.246094
CREATE TABLE table_48964 ("Team #1" TEXT, "Agg." TEXT, "Team #2" TEXT, "1st leg" TEXT, "2nd leg" TEXT)
What was the team Unics Kazan's 1st leg score?
SELECT "1st leg" FROM table_48964 WHERE "Team #1" = 'unics kazan'
SELECT "1st leg" FROM "table_48964" WHERE "Team #1" = 'unics kazan'
0.06543
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 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 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 allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT)
what were the top five most common diagnoses that followed during the same hospital encounter for the patient who received beta blocker - atenolol until 1 year ago?
SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'beta blocker - atenolol' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-1 year')) AS t1 JOIN (SELECT patient.uniquepid, diagnosis.diagnosisname, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-1 year')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.treatmenttime < t2.diagnosistime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid GROUP BY t2.diagnosisname) AS t3 WHERE t3.c1 <= 5
WITH "t2" AS (SELECT "patient"."uniquepid", "diagnosis"."diagnosisname", "diagnosis"."diagnosistime", "patient"."patienthealthsystemstayid" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" WHERE DATETIME("diagnosis"."diagnosistime") <= DATETIME(CURRENT_TIME(), '-1 year')), "t3" AS (SELECT "t2"."diagnosisname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "treatment" JOIN "patient" ON "patient"."patientunitstayid" = "treatment"."patientunitstayid" JOIN "t2" AS "t2" ON "patient"."patienthealthsystemstayid" = "t2"."patienthealthsystemstayid" AND "patient"."uniquepid" = "t2"."uniquepid" AND "t2"."diagnosistime" > "treatment"."treatmenttime" WHERE "treatment"."treatmentname" = 'beta blocker - atenolol' AND DATETIME("treatment"."treatmenttime") <= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY "t2"."diagnosisname") SELECT "t3"."diagnosisname" FROM "t3" AS "t3" WHERE "t3"."c1" <= 5
0.93457
CREATE TABLE table_12790 ("Tournament" TEXT, "2009" TEXT, "2010" TEXT, "2011" TEXT, "2012" TEXT, "Win %" TEXT)
What is the 2009 for 2012 1R in Wimbledon and a 2011 2r?
SELECT "2009" FROM table_12790 WHERE "2012" = '1r' AND "Tournament" = 'wimbledon' AND "2011" = '2r'
SELECT "2009" FROM "table_12790" WHERE "2011" = '2r' AND "2012" = '1r' AND "Tournament" = 'wimbledon'
0.098633
CREATE TABLE table_33600 ("Driver" TEXT, "Team" TEXT, "Laps" FLOAT, "Time/Retired" TEXT, "Grid" FLOAT, "Points" FLOAT)
What driver has over 19 points and a grid of over 2?
SELECT "Driver" FROM table_33600 WHERE "Points" > '19' AND "Grid" > '2'
SELECT "Driver" FROM "table_33600" WHERE "Grid" > '2' AND "Points" > '19'
0.071289
CREATE TABLE table_203_780 (id DECIMAL, "rank" DECIMAL, "diver" TEXT, "preliminary\ points" DECIMAL, "preliminary\ rank" DECIMAL, "final\ points" DECIMAL, "final\ rank" DECIMAL, "final\ total" DECIMAL)
who has the same nationality as juno stover irwin ?
SELECT "diver" FROM table_203_780 WHERE "diver" <> 'juno stover-irwin' AND "diver" = (SELECT "diver" FROM table_203_780 WHERE "diver" = 'juno stover-irwin')
SELECT "diver" FROM "table_203_780" WHERE "diver" <> 'juno stover-irwin' AND "diver" = (SELECT "diver" FROM "table_203_780" WHERE "diver" = 'juno stover-irwin')
0.15625
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 cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
how many days have passed since patient 013-38992 has been admitted to the hospital?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.hospitaladmittime)) FROM patient WHERE patient.uniquepid = '013-38992' AND patient.hospitaldischargetime IS NULL
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "patient"."hospitaladmittime")) FROM "patient" WHERE "patient"."hospitaldischargetime" IS NULL AND "patient"."uniquepid" = '013-38992'
0.189453
CREATE TABLE table_8759 ("Player" TEXT, "Nationality" TEXT, "Jersey Number ( s ) " TEXT, "Position" TEXT, "Years" TEXT, "From" TEXT)
What is Player, when From is Cincinnati, and when Position is C?
SELECT "Player" FROM table_8759 WHERE "From" = 'cincinnati' AND "Position" = 'c'
SELECT "Player" FROM "table_8759" WHERE "From" = 'cincinnati' AND "Position" = 'c'
0.080078
CREATE TABLE table_73677 ("Club" TEXT, "Home city" TEXT, "Stadium" TEXT, "First season in the Serie A" FLOAT, "First season in current spell" FLOAT, "Last title" TEXT)
Name the club for quevedo
SELECT "Club" FROM table_73677 WHERE "Home city" = 'Quevedo'
SELECT "Club" FROM "table_73677" WHERE "Home city" = 'Quevedo'
0.060547
CREATE TABLE table_33832 ("Season" TEXT, "Episodes" FLOAT, "First airdate" TEXT, "Last airdate" TEXT, "Nielsen ranking" TEXT)
How many episodes were in the season that ended on April 29, 1986?
SELECT AVG("Episodes") FROM table_33832 WHERE "Last airdate" = 'april 29, 1986'
SELECT AVG("Episodes") FROM "table_33832" WHERE "Last airdate" = 'april 29, 1986'
0.079102
CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE employees (EMPLOYEE_ID DECIMAL, FIRST_NAME VARCHAR, LAST_NAME VARCHAR, EMAIL VARCHAR, PHONE_NUMBER VARCHAR, HIRE_DATE DATE, JOB_ID VARCHAR, SALARY DECIMAL, COMMISSION_PCT DECIMAL, MANAGER_ID DECIMAL, DEPARTMENT_ID DECIMAL) 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) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR)
For those employees who did not have any job in the past, show me about the distribution of hire_date and the sum of employee_id bin hire_date by time in a bar chart, and sort by the y-axis in descending.
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY SUM(EMPLOYEE_ID) DESC
SELECT "HIRE_DATE", SUM("EMPLOYEE_ID") FROM "employees" WHERE NOT "EMPLOYEE_ID" IN (SELECT "EMPLOYEE_ID" FROM "job_history") ORDER BY SUM("EMPLOYEE_ID") DESC NULLS LAST
0.164063
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 patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod 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 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 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 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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) 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 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 d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT)
when did patient 22517 first get prescribed vancomycin in 05/2102?
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 22517) AND prescriptions.drug = 'vancomycin' AND STRFTIME('%y-%m', prescriptions.startdate) = '2102-05' ORDER BY prescriptions.startdate LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 22517 GROUP BY "hadm_id") SELECT "prescriptions"."startdate" FROM "prescriptions" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "prescriptions"."hadm_id" WHERE "prescriptions"."drug" = 'vancomycin' AND NOT "_u_0"."" IS NULL AND STRFTIME('%y-%m', "prescriptions"."startdate") = '2102-05' ORDER BY "prescriptions"."startdate" NULLS FIRST LIMIT 1
0.426758
CREATE TABLE table_name_87 (new_entries_this_round VARCHAR, leagues_entering_at_this_round VARCHAR)
How many new entries when the leagues entering in the round are tff third league & turkish regional amateur league?
SELECT new_entries_this_round FROM table_name_87 WHERE leagues_entering_at_this_round = "tff third league & turkish regional amateur league"
SELECT "new_entries_this_round" FROM "table_name_87" WHERE "leagues_entering_at_this_round" = "tff third league & turkish regional amateur league"
0.142578
CREATE TABLE Band (id VARCHAR) CREATE TABLE Performance (stageposition VARCHAR, bandmate VARCHAR)
Find all the stage positions of the musicians with first name 'Solveig
SELECT DISTINCT T1.stageposition FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id WHERE Firstname = "Solveig"
SELECT DISTINCT "T1"."stageposition" FROM "Performance" AS "T1" JOIN "Band" AS "T2" ON "T1"."bandmate" = "T2"."id" WHERE "Firstname" = "Solveig"
0.140625
CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) 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 countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_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 job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL)
For those employees who did not have any job in the past, show me about the distribution of hire_date and the sum of salary bin hire_date by time in a bar chart, and order from low to high by the Y.
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY SUM(SALARY)
SELECT "HIRE_DATE", SUM("SALARY") FROM "employees" WHERE NOT "EMPLOYEE_ID" IN (SELECT "EMPLOYEE_ID" FROM "job_history") ORDER BY SUM("SALARY") NULLS FIRST
0.150391
CREATE TABLE Ref_Calendar (Calendar_Date DATETIME, Day_Number INT) CREATE TABLE Ref_Locations (Location_Code CHAR, Location_Name VARCHAR, Location_Description VARCHAR) CREATE TABLE Documents_to_be_Destroyed (Document_ID INT, Destruction_Authorised_by_Employee_ID INT, Destroyed_by_Employee_ID INT, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR) CREATE TABLE Employees (Employee_ID INT, Role_Code CHAR, Employee_Name VARCHAR, Gender_MFU CHAR, Date_of_Birth DATETIME, Other_Details VARCHAR) CREATE TABLE All_Documents (Document_ID INT, Date_Stored DATETIME, Document_Type_Code CHAR, Document_Name CHAR, Document_Description CHAR, Other_Details VARCHAR) CREATE TABLE Roles (Role_Code CHAR, Role_Name VARCHAR, Role_Description VARCHAR) CREATE TABLE Document_Locations (Document_ID INT, Location_Code CHAR, Date_in_Location_From DATETIME, Date_in_Locaton_To DATETIME) CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR, Document_Type_Name VARCHAR, Document_Type_Description VARCHAR)
Plot calendar date by how many calendar date as a line chart
SELECT Calendar_Date, COUNT(Calendar_Date) FROM Ref_Calendar
SELECT "Calendar_Date", COUNT("Calendar_Date") FROM "Ref_Calendar"
0.064453
CREATE TABLE table_20971444_3 (rank__timeslot_ VARCHAR, rating__18_49_ VARCHAR)
Name the total number of rank timeslot for 18-49 being 3.1
SELECT COUNT(rank__timeslot_) FROM table_20971444_3 WHERE rating__18_49_ = "3.1"
SELECT COUNT("rank__timeslot_") FROM "table_20971444_3" WHERE "3.1" = "rating__18_49_"
0.083984
CREATE TABLE table_49497 ("Issued" FLOAT, "Type" TEXT, "Design" TEXT, "Serial format" TEXT, "Serials issued" TEXT)
What serial format was issued in 1972?
SELECT "Serial format" FROM table_49497 WHERE "Issued" = '1972'
SELECT "Serial format" FROM "table_49497" WHERE "Issued" = '1972'
0.063477
CREATE TABLE table_name_28 (opponent VARCHAR, date VARCHAR)
Who was the opponent on september 10, 1979?
SELECT opponent FROM table_name_28 WHERE date = "september 10, 1979"
SELECT "opponent" FROM "table_name_28" WHERE "date" = "september 10, 1979"
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 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 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)
how many patients whose year of birth is less than 2060 and lab test name is calcium, total?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2060" AND lab.label = "Calcium, Total"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Calcium, Total" = "lab"."label" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "2060" > "demographic"."dob_year"
0.196289
CREATE TABLE table_51734 ("Name" TEXT, "Street address" TEXT, "Years as tallest" TEXT, "Height ft / m" TEXT, "Floors" TEXT)
What is the street address of Oliver Building?
SELECT "Street address" FROM table_51734 WHERE "Name" = 'oliver building'
SELECT "Street address" FROM "table_51734" WHERE "Name" = 'oliver building'
0.073242
CREATE TABLE table_1974545_3 (softball_stadium VARCHAR, baseball_stadium VARCHAR)
What is the name of the softball stadium for the school that has Eastern Baseball Stadium?
SELECT softball_stadium FROM table_1974545_3 WHERE baseball_stadium = "Eastern Baseball Stadium"
SELECT "softball_stadium" FROM "table_1974545_3" WHERE "Eastern Baseball Stadium" = "baseball_stadium"
0.099609
CREATE TABLE ENROLL (CLASS_CODE VARCHAR, STU_NUM INT, ENROLL_GRADE VARCHAR) CREATE TABLE PROFESSOR (EMP_NUM INT, DEPT_CODE VARCHAR, PROF_OFFICE VARCHAR, PROF_EXTENSION VARCHAR, PROF_HIGH_DEGREE VARCHAR) CREATE TABLE STUDENT (STU_NUM INT, STU_LNAME VARCHAR, STU_FNAME VARCHAR, STU_INIT VARCHAR, STU_DOB DATETIME, STU_HRS INT, STU_CLASS VARCHAR, STU_GPA FLOAT, STU_TRANSFER DECIMAL, DEPT_CODE VARCHAR, STU_PHONE VARCHAR, PROF_NUM INT) CREATE TABLE EMPLOYEE (EMP_NUM INT, EMP_LNAME VARCHAR, EMP_FNAME VARCHAR, EMP_INITIAL VARCHAR, EMP_JOBCODE VARCHAR, EMP_HIREDATE DATETIME, EMP_DOB DATETIME) CREATE TABLE DEPARTMENT (DEPT_CODE VARCHAR, DEPT_NAME VARCHAR, SCHOOL_CODE VARCHAR, EMP_NUM INT, DEPT_ADDRESS VARCHAR, DEPT_EXTENSION VARCHAR) CREATE TABLE CLASS (CLASS_CODE VARCHAR, CRS_CODE VARCHAR, CLASS_SECTION VARCHAR, CLASS_TIME VARCHAR, CLASS_ROOM VARCHAR, PROF_NUM INT) CREATE TABLE COURSE (CRS_CODE VARCHAR, DEPT_CODE VARCHAR, CRS_DESCRIPTION VARCHAR, CRS_CREDIT FLOAT)
How many sections does each course has. Visualize by bar chart.
SELECT CRS_CODE, COUNT(*) FROM CLASS GROUP BY CRS_CODE
SELECT "CRS_CODE", COUNT(*) FROM "CLASS" GROUP BY "CRS_CODE"
0.058594
CREATE TABLE table_name_40 (gold VARCHAR, silver VARCHAR, rank VARCHAR, nation VARCHAR)
Which Gold has a Rank of 7, a Nation of italy, and a Silver smaller than 0?
SELECT COUNT(gold) FROM table_name_40 WHERE rank = "7" AND nation = "italy" AND silver < 0
SELECT COUNT("gold") FROM "table_name_40" WHERE "7" = "rank" AND "italy" = "nation" AND "silver" < 0
0.097656
CREATE TABLE movie (mid DECIMAL, title TEXT, year DECIMAL, director TEXT) CREATE TABLE reviewer (rid DECIMAL, name TEXT) CREATE TABLE rating (rid DECIMAL, mid DECIMAL, stars DECIMAL, ratingdate TIME)
What are the ids of all reviewers who did not give 4 stars?
SELECT rid FROM rating EXCEPT SELECT rid FROM rating WHERE stars = 4
SELECT "rid" FROM "rating" EXCEPT SELECT "rid" FROM "rating" WHERE "stars" = 4
0.076172
CREATE TABLE table_37708 ("Date" TEXT, "Visitor" TEXT, "Score" TEXT, "Home" TEXT, "Decision" TEXT, "Attendance" FLOAT)
What is the lowest number of people attending the game on May 30 with Colorado as the visitors?
SELECT MIN("Attendance") FROM table_37708 WHERE "Visitor" = 'colorado' AND "Date" = 'may 30'
SELECT MIN("Attendance") FROM "table_37708" WHERE "Date" = 'may 30' AND "Visitor" = 'colorado'
0.091797
CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE employees (EMPLOYEE_ID DECIMAL, FIRST_NAME VARCHAR, LAST_NAME VARCHAR, EMAIL VARCHAR, PHONE_NUMBER VARCHAR, HIRE_DATE DATE, JOB_ID VARCHAR, SALARY DECIMAL, COMMISSION_PCT DECIMAL, MANAGER_ID DECIMAL, DEPARTMENT_ID DECIMAL) 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 job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR)
For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of email and employee_id , and I want to sort in desc by the X.
SELECT EMAIL, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMAIL DESC
SELECT "EMAIL", "EMPLOYEE_ID" FROM "employees" WHERE NOT "DEPARTMENT_ID" IN (SELECT "DEPARTMENT_ID" FROM "departments" WHERE "MANAGER_ID" <= 200 AND "MANAGER_ID" >= 100) ORDER BY "EMAIL" DESC NULLS LAST
0.197266
CREATE TABLE table_33728 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
What was the score for Footscray when they were the away team?
SELECT "Away team score" FROM table_33728 WHERE "Away team" = 'footscray'
SELECT "Away team score" FROM "table_33728" WHERE "Away team" = 'footscray'
0.073242
CREATE TABLE Activity (actid INT, activity_name VARCHAR) CREATE TABLE Participates_in (stuid INT, actid INT) CREATE TABLE Faculty (FacID INT, Lname VARCHAR, Fname VARCHAR, Rank VARCHAR, Sex VARCHAR, Phone INT, Room VARCHAR, Building VARCHAR) CREATE TABLE Student (StuID INT, LName VARCHAR, Fname VARCHAR, Age INT, Sex VARCHAR, Major INT, Advisor INT, city_code VARCHAR) CREATE TABLE Faculty_Participates_in (FacID INT, actid INT)
What is the first name of the faculty members who participated in at least one activity? For each of them, also show the number of activities they participated in with a bar chart, and sort in descending by the Y-axis.
SELECT Fname, COUNT(*) FROM Faculty AS T1 JOIN Faculty_Participates_in AS T2 ON T1.FacID = T2.FacID GROUP BY T1.FacID ORDER BY COUNT(*) DESC
SELECT "Fname", COUNT(*) FROM "Faculty" AS "T1" JOIN "Faculty_Participates_in" AS "T2" ON "T1"."FacID" = "T2"."FacID" GROUP BY "T1"."FacID" ORDER BY COUNT(*) DESC NULLS LAST
0.168945
CREATE TABLE table_name_73 (percentage___percentage_ VARCHAR, language VARCHAR)
What is the percentage who speak Russian?
SELECT percentage___percentage_ FROM table_name_73 WHERE language = "russian"
SELECT "percentage___percentage_" FROM "table_name_73" WHERE "language" = "russian"
0.081055
CREATE TABLE table_name_40 (league_cup VARCHAR, years VARCHAR)
What is the League Cup for 1947 1958?
SELECT league_cup FROM table_name_40 WHERE years = "1947–1958"
SELECT "league_cup" FROM "table_name_40" WHERE "1947–1958" = "years"
0.066406
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) 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)
how many female patients have benzodiazepine-based tranquilizers causing adverse effects in therapeutic use diagnoses?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.long_title = "Benzodiazepine-based tranquilizers causing adverse effects in therapeutic use"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Benzodiazepine-based tranquilizers causing adverse effects in therapeutic use" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "F" = "demographic"."gender"
0.275391
CREATE TABLE table_18538 ("District" TEXT, "Incumbent" TEXT, "Party" TEXT, "First elected" FLOAT, "Result" TEXT, "Candidates" TEXT)
What was the result when incumbent Tom Steed was elected?
SELECT "Result" FROM table_18538 WHERE "Incumbent" = 'Tom Steed'
SELECT "Result" FROM "table_18538" WHERE "Incumbent" = 'Tom Steed'
0.064453
CREATE TABLE Reservations (Code INT, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate FLOAT, LastName TEXT, FirstName TEXT, Adults INT, Kids INT) CREATE TABLE Rooms (RoomId TEXT, roomName TEXT, beds INT, bedType TEXT, maxOccupancy INT, basePrice INT, decor TEXT)
Visualize a bar chart for how many rooms cost more than 120, for each different decor?, and list by the Y in descending.
SELECT decor, COUNT(*) FROM Rooms WHERE basePrice > 120 GROUP BY decor ORDER BY COUNT(*) DESC
SELECT "decor", COUNT(*) FROM "Rooms" WHERE "basePrice" > 120 GROUP BY "decor" ORDER BY COUNT(*) DESC NULLS LAST
0.109375
CREATE TABLE table_name_15 (result VARCHAR, event VARCHAR, method VARCHAR)
Which Result has the Event Strikeforce and the Method, Ko (spinning back fist)?
SELECT result FROM table_name_15 WHERE event = "strikeforce" AND method = "ko (spinning back fist)"
SELECT "result" FROM "table_name_15" WHERE "event" = "strikeforce" AND "ko (spinning back fist)" = "method"
0.104492
CREATE TABLE table_225093_4 (vacator VARCHAR, date_successor_seated VARCHAR)
How many vacators have October 22, 1808 as date successor seated?
SELECT COUNT(vacator) FROM table_225093_4 WHERE date_successor_seated = "October 22, 1808"
SELECT COUNT("vacator") FROM "table_225093_4" WHERE "October 22, 1808" = "date_successor_seated"
0.09375
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 Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE 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 PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description 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 PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
Top editors in a given period.
SELECT ph.UserId AS "user_link", COUNT(DISTINCT RevisionGUID) AS Count FROM PostHistory AS ph INNER JOIN Posts AS p ON p.Id = ph.PostId WHERE ph.PostHistoryTypeId IN (4, 5, 6) AND (ph.CreationDate >= '##Date1?2018-01-01##') AND (ph.CreationDate <= '##Date2?2018-12-31##') AND ph.UserId != p.OwnerUserId GROUP BY ph.UserId ORDER BY Count DESC LIMIT 100
SELECT "ph"."UserId" AS "user_link", COUNT(DISTINCT "RevisionGUID") AS "Count" FROM "PostHistory" AS "ph" JOIN "Posts" AS "p" ON "p"."Id" = "ph"."PostId" AND "p"."OwnerUserId" <> "ph"."UserId" WHERE "ph"."CreationDate" <= '##Date2?2018-12-31##' AND "ph"."CreationDate" >= '##Date1?2018-01-01##' AND "ph"."PostHistoryTypeId" IN (4, 5, 6) GROUP BY "ph"."UserId" ORDER BY "Count" DESC NULLS LAST LIMIT 100
0.392578
CREATE TABLE table_76567 ("Date" TEXT, "Opponent" TEXT, "Venue" TEXT, "Result" TEXT, "Attendance" TEXT, "Competition" TEXT, "Man of the Match" TEXT)
What was the date when the attendance was n/a and the Man of the Match was unknown?
SELECT "Date" FROM table_76567 WHERE "Attendance" = 'n/a' AND "Man of the Match" = 'unknown'
SELECT "Date" FROM "table_76567" WHERE "Attendance" = 'n/a' AND "Man of the Match" = 'unknown'
0.091797
CREATE TABLE student (stuid DECIMAL, lname TEXT, fname TEXT, age DECIMAL, sex TEXT, major DECIMAL, advisor DECIMAL, city_code TEXT) CREATE TABLE has_allergy (stuid DECIMAL, allergy TEXT) CREATE TABLE allergy_type (allergy TEXT, allergytype TEXT)
Which students are unaffected by allergies?
SELECT stuid FROM student EXCEPT SELECT stuid FROM has_allergy
SELECT "stuid" FROM "student" EXCEPT SELECT "stuid" FROM "has_allergy"
0.068359
CREATE TABLE table_name_72 (season VARCHAR, _number_of_teams VARCHAR, league VARCHAR)
When was the season that had more teams larger than 14 in the super rugby league?
SELECT season FROM table_name_72 WHERE _number_of_teams > 14 AND league = "super rugby"
SELECT "season" FROM "table_name_72" WHERE "_number_of_teams" > 14 AND "league" = "super rugby"
0.092773
CREATE TABLE table_name_27 (dainty_june VARCHAR, herbie VARCHAR)
Who was Dainty June when Boyd Gaines was Herbie?
SELECT dainty_june FROM table_name_27 WHERE herbie = "boyd gaines"
SELECT "dainty_june" FROM "table_name_27" WHERE "boyd gaines" = "herbie"
0.070313
CREATE TABLE table_name_31 (player VARCHAR, nationality VARCHAR, pick VARCHAR)
Which player is Pick 33 and has a Nationality of USA?
SELECT player FROM table_name_31 WHERE nationality = "usa" AND pick = 33
SELECT "player" FROM "table_name_31" WHERE "nationality" = "usa" AND "pick" = 33
0.078125
CREATE TABLE table_name_3 (constructor VARCHAR, driver VARCHAR)
What is the constructor for Jackie Stewart's car?
SELECT constructor FROM table_name_3 WHERE driver = "jackie stewart"
SELECT "constructor" FROM "table_name_3" WHERE "driver" = "jackie stewart"
0.072266
CREATE TABLE table_name_37 (losses INT, games_played INT)
What is the average losses for the team(s) that played more than 8 games?
SELECT AVG(losses) FROM table_name_37 WHERE games_played > 8
SELECT AVG("losses") FROM "table_name_37" WHERE "games_played" > 8
0.064453
CREATE TABLE table_21590 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Series" TEXT)
List of high assists with high rebounds for k. mchale (10)
SELECT "High assists" FROM table_21590 WHERE "High rebounds" = 'K. McHale (10)'
SELECT "High assists" FROM "table_21590" WHERE "High rebounds" = 'K. McHale (10)'
0.079102
CREATE TABLE table_48645 ("Discipline" TEXT, "Circuit" TEXT, "Event" TEXT, "Session" TEXT, "Cause" TEXT)
The 1977 Japanese Grand Prix in the open wheel discipline has what session?
SELECT "Session" FROM table_48645 WHERE "Discipline" = 'open wheel' AND "Event" = '1977 japanese grand prix'
SELECT "Session" FROM "table_48645" WHERE "Discipline" = 'open wheel' AND "Event" = '1977 japanese grand prix'
0.107422
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)
For each party, return the name of the party and the number of delegates from that party Plot them as bar chart, sort in asc by the Y-axis.
SELECT T2.Party, AVG(COUNT(*)) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T2.Party ORDER BY AVG(COUNT(*))
SELECT "T2"."Party", AVG(COUNT(*)) FROM "election" AS "T1" JOIN "party" AS "T2" ON "T1"."Party" = "T2"."Party_ID" GROUP BY "T2"."Party" ORDER BY AVG(COUNT(*)) NULLS FIRST
0.166016
CREATE TABLE table_name_95 (lane VARCHAR, nationality VARCHAR, time VARCHAR)
What lane is from Great Britain and a 57.78 time?
SELECT COUNT(lane) FROM table_name_95 WHERE nationality = "great britain" AND time > 57.78
SELECT COUNT("lane") FROM "table_name_95" WHERE "great britain" = "nationality" AND "time" > 57.78
0.095703
CREATE TABLE table_name_59 (final_round VARCHAR, members VARCHAR)
What was the final round value for member Chris Webber?
SELECT final_round FROM table_name_59 WHERE members = "chris webber"
SELECT "final_round" FROM "table_name_59" WHERE "chris webber" = "members"
0.072266
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
give the number of patients whose diagnosis long title is diabetes with ophthalmic manifestations, type ii or unspecified type, not stated as uncontrolled and lab test abnormal status is abnormal.
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.long_title = "Diabetes with ophthalmic manifestations, type II or unspecified type, not stated as uncontrolled" AND lab.flag = "abnormal"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Diabetes with ophthalmic manifestations, type II or unspecified type, not stated as uncontrolled" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "abnormal" = "lab"."flag" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.34375
CREATE TABLE table_name_6 (date VARCHAR, event VARCHAR)
Whcih Date has an Event of 3000 m?
SELECT date FROM table_name_6 WHERE event = "3000 m"
SELECT "date" FROM "table_name_6" WHERE "3000 m" = "event"
0.056641
CREATE TABLE table_54737 ("Date" FLOAT, "Country" TEXT, "Place" TEXT, "Building" TEXT, "Size" TEXT)
Name the least date for the place which has a building of victoria hall
SELECT MIN("Date") FROM table_54737 WHERE "Building" = 'victoria hall'
SELECT MIN("Date") FROM "table_54737" WHERE "Building" = 'victoria hall'
0.070313
CREATE TABLE View_Unit_Status (apt_id INT, apt_booking_id INT, status_date DATETIME, available_yn BIT) CREATE TABLE Apartment_Facilities (apt_id INT, facility_code CHAR) CREATE TABLE Guests (guest_id INT, gender_code CHAR, guest_first_name VARCHAR, guest_last_name VARCHAR, date_of_birth DATETIME) CREATE TABLE Apartments (apt_id INT, building_id INT, apt_type_code CHAR, apt_number CHAR, bathroom_count INT, bedroom_count INT, room_count CHAR) CREATE TABLE Apartment_Bookings (apt_booking_id INT, apt_id INT, guest_id INT, booking_status_code CHAR, booking_start_date DATETIME, booking_end_date DATETIME) CREATE TABLE Apartment_Buildings (building_id INT, building_short_name CHAR, building_full_name VARCHAR, building_description VARCHAR, building_address VARCHAR, building_manager VARCHAR, building_phone VARCHAR)
What is the number of booking start dates of the apartments with more than 2 bedrooms for each weekday? Show me a bar chart, and display by the total number in ascending please.
SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 2 ORDER BY COUNT(booking_start_date)
SELECT "booking_start_date", COUNT("booking_start_date") FROM "Apartment_Bookings" AS "T1" JOIN "Apartments" AS "T2" ON "T1"."apt_id" = "T2"."apt_id" AND "T2"."bedroom_count" > 2 ORDER BY COUNT("booking_start_date") NULLS FIRST
0.22168
CREATE TABLE table_name_98 (position VARCHAR, player VARCHAR)
What position does Michael Ruffin play?
SELECT position FROM table_name_98 WHERE player = "michael ruffin"
SELECT "position" FROM "table_name_98" WHERE "michael ruffin" = "player"
0.070313
CREATE TABLE table_13923 ("SEASON" TEXT, "TEAM" TEXT, "LEAGUE" TEXT, "GAMES" TEXT, "GOALS" TEXT)
What is the league listed that has goals of 10?
SELECT "LEAGUE" FROM table_13923 WHERE "GOALS" = '10'
SELECT "LEAGUE" FROM "table_13923" WHERE "GOALS" = '10'
0.053711
CREATE TABLE table_43063 ("Date" TEXT, "Cover model" TEXT, "Centerfold model" TEXT, "Interview subject" TEXT, "20 Questions" TEXT)
Who was the Interview Subject when the 20 Questions was William H. Macy?
SELECT "Interview subject" FROM table_43063 WHERE "20 Questions" = 'william h. macy'
SELECT "Interview subject" FROM "table_43063" WHERE "20 Questions" = 'william h. macy'
0.083984
CREATE TABLE culture_company (company_name TEXT, type TEXT, incorporated_in TEXT, group_equity_shareholding DECIMAL, book_club_id TEXT, movie_id TEXT) CREATE TABLE book_club (book_club_id DECIMAL, year DECIMAL, author_or_editor TEXT, book_title TEXT, publisher TEXT, category TEXT, result TEXT) CREATE TABLE movie (movie_id DECIMAL, title TEXT, year DECIMAL, director TEXT, budget_million DECIMAL, gross_worldwide DECIMAL)
What is the title and director for the movie with highest worldwide gross in the year 2000 or before?
SELECT title, director FROM movie WHERE year <= 2000 ORDER BY gross_worldwide DESC LIMIT 1
SELECT "title", "director" FROM "movie" WHERE "year" <= 2000 ORDER BY "gross_worldwide" DESC NULLS LAST LIMIT 1
0.108398
CREATE TABLE Manufacturers (Code INT, Name VARCHAR, Headquarter VARCHAR, Founder VARCHAR, Revenue FLOAT) CREATE TABLE Products (Code INT, Name VARCHAR, Price DECIMAL, Manufacturer INT)
For those records from the products and each product's manufacturer, find name and the sum of price , and group by attribute name, and visualize them by a bar chart, and sort from high to low by the names.
SELECT T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Name DESC
SELECT "T1"."Name", "T1"."Price" FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "T1"."Name" ORDER BY "T1"."Name" DESC NULLS LAST
0.175781
CREATE TABLE table_name_75 (position VARCHAR, difference VARCHAR, against VARCHAR)
How many positions had a difference of - 4 and an against of less than 24?
SELECT COUNT(position) FROM table_name_75 WHERE difference = "- 4" AND against < 24
SELECT COUNT("position") FROM "table_name_75" WHERE "- 4" = "difference" AND "against" < 24
0.088867
CREATE TABLE Royal_Family (Royal_Family_ID INT, Royal_Family_Details VARCHAR) CREATE TABLE Theme_Parks (Theme_Park_ID INT, Theme_Park_Details VARCHAR) CREATE TABLE Shops (Shop_ID INT, Shop_Details VARCHAR) CREATE TABLE Tourist_Attractions (Tourist_Attraction_ID INT, Attraction_Type_Code CHAR, Location_ID INT, How_to_Get_There VARCHAR, Name VARCHAR, Description VARCHAR, Opening_Hours VARCHAR, Other_Details VARCHAR) CREATE TABLE Street_Markets (Market_ID INT, Market_Details VARCHAR) CREATE TABLE Hotels (hotel_id INT, star_rating_code CHAR, pets_allowed_yn CHAR, price_range FLOAT, other_hotel_details VARCHAR) CREATE TABLE Locations (Location_ID INT, Location_Name VARCHAR, Address VARCHAR, Other_Details VARCHAR) CREATE TABLE Visitors (Tourist_ID INT, Tourist_Details VARCHAR) CREATE TABLE Ref_Hotel_Star_Ratings (star_rating_code CHAR, star_rating_description VARCHAR) CREATE TABLE Staff (Staff_ID INT, Tourist_Attraction_ID INT, Name VARCHAR, Other_Details VARCHAR) CREATE TABLE Features (Feature_ID INT, Feature_Details VARCHAR) CREATE TABLE Visits (Visit_ID INT, Tourist_Attraction_ID INT, Tourist_ID INT, Visit_Date DATETIME, Visit_Details VARCHAR) CREATE TABLE Tourist_Attraction_Features (Tourist_Attraction_ID INT, Feature_ID INT) CREATE TABLE Museums (Museum_ID INT, Museum_Details VARCHAR) CREATE TABLE Ref_Attraction_Types (Attraction_Type_Code CHAR, Attraction_Type_Description VARCHAR) CREATE TABLE Photos (Photo_ID INT, Tourist_Attraction_ID INT, Name VARCHAR, Description VARCHAR, Filename VARCHAR, Other_Details VARCHAR)
Show the names and ids of tourist attractions that are visited at most once by a bar chart, and display bars from high to low order.
SELECT T1.Name, T1.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN Visits AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID ORDER BY T1.Name DESC
SELECT "T1"."Name", "T1"."Tourist_Attraction_ID" FROM "Tourist_Attractions" AS "T1" JOIN "Visits" AS "T2" ON "T1"."Tourist_Attraction_ID" = "T2"."Tourist_Attraction_ID" ORDER BY "T1"."Name" DESC NULLS LAST
0.200195
CREATE TABLE table_24915964_4 (minutes INT, player VARCHAR)
How many minutes were played by Sue Bird?
SELECT MIN(minutes) FROM table_24915964_4 WHERE player = "Sue Bird"
SELECT MIN("minutes") FROM "table_24915964_4" WHERE "Sue Bird" = "player"
0.071289
CREATE TABLE table_62489 ("Rank" FLOAT, "Gold" FLOAT, "Silver" FLOAT, "Bronze" FLOAT, "Total" FLOAT)
What shows for bronze when silver is 1, rank is smaller than 4, and gold is larger than 1?
SELECT SUM("Bronze") FROM table_62489 WHERE "Silver" = '1' AND "Rank" < '4' AND "Gold" > '1'
SELECT SUM("Bronze") FROM "table_62489" WHERE "Gold" > '1' AND "Rank" < '4' AND "Silver" = '1'
0.091797
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
what is gender and language of subject name robert hyden?
SELECT demographic.gender, demographic.language FROM demographic WHERE demographic.name = "Robert Hyden"
SELECT "demographic"."gender", "demographic"."language" FROM "demographic" WHERE "Robert Hyden" = "demographic"."name"
0.115234
CREATE TABLE table_26336739_1 (result VARCHAR, elected VARCHAR)
What was the result for the district with an election in 1986
SELECT result FROM table_26336739_1 WHERE elected = 1986
SELECT "result" FROM "table_26336739_1" WHERE "elected" = 1986
0.060547
CREATE TABLE table_name_24 (outcome VARCHAR, year VARCHAR, opponent_in_the_final VARCHAR)
what is the outcome when the opponent in the final is william renshaw after year 1882?
SELECT outcome FROM table_name_24 WHERE year > 1882 AND opponent_in_the_final = "william renshaw"
SELECT "outcome" FROM "table_name_24" WHERE "opponent_in_the_final" = "william renshaw" AND "year" > 1882
0.102539
CREATE TABLE table_75378 ("Years" TEXT, "2004" FLOAT, "2005" FLOAT, "2006" FLOAT, "2007" FLOAT, "2008" FLOAT, "2009" FLOAT, "2010" FLOAT, "2011" FLOAT)
What was the average value in 2005 when 2008 is 61,837,716, and a 2006 is more than 57,126,389?
SELECT AVG("2005") FROM table_75378 WHERE "2008" = '61,837,716' AND "2006" > '57,126,389'
SELECT AVG("2005") FROM "table_75378" WHERE "2006" > '57,126,389' AND "2008" = '61,837,716'
0.088867
CREATE TABLE table_204_683 (id DECIMAL, "no." DECIMAL, "constituency" TEXT, "winner candidate" TEXT, "party" TEXT, "votes" DECIMAL, "margin" DECIMAL)
how many votes were there for the constituency of danta ?
SELECT "votes" FROM table_204_683 WHERE "constituency" = 'danta'
SELECT "votes" FROM "table_204_683" WHERE "constituency" = 'danta'
0.064453
CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
Stats about all SEDE TABLES including response time and last update date. stats about all SEDE tables including response time
SELECT 'SELECT ''' + table_name + ''' as tbl, max(creationdate) upd, getdate() dt from ' + table_name FROM information_schema.columns WHERE column_name = 'CreationDate'
SELECT 'SELECT \'' + "table_name" + '\' as tbl, max(creationdate) upd, getdate() dt from ' + "table_name" FROM "information_schema"."columns" WHERE "column_name" = 'CreationDate'
0.173828
CREATE TABLE table_4547 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
What was the attendance when Fitzroy played as home team?
SELECT COUNT("Crowd") FROM table_4547 WHERE "Home team" = 'fitzroy'
SELECT COUNT("Crowd") FROM "table_4547" WHERE "Home team" = 'fitzroy'
0.067383
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 medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE 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 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 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)
tell me the name of the drug which patient 003-7849 was prescribed in the same hospital encounter after having had a thrombolytic agent - alteplase procedure until 24 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 = '003-7849') AND treatment.treatmentname = 'thrombolytic agent - alteplase' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-24 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 = '003-7849') AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-24 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" = '003-7849' 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(), '-24 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" = 'thrombolytic agent - alteplase' AND DATETIME("treatment"."treatmenttime") <= DATETIME(CURRENT_TIME(), '-24 month') AND NOT "_u_0"."" IS NULL
1.12793
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 cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost 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_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 patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod 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 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 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) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
what was the highest three diagnosis, which had the highest three year mortality rate?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t4.icd9_code FROM (SELECT t3.icd9_code, DENSE_RANK() OVER (ORDER BY t3.c1 DESC) AS c2 FROM (SELECT t2.icd9_code, 100 - SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t2.charttime) > 3 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) AS c1 FROM (SELECT t1.subject_id, t1.icd9_code, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.icd9_code, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id GROUP BY admissions.subject_id, diagnoses_icd.icd9_code HAVING MIN(diagnoses_icd.charttime) = diagnoses_icd.charttime) AS t1 WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', t1.charttime) > 3 * 365) AS t2 JOIN patients ON t2.subject_id = patients.subject_id GROUP BY t2.icd9_code) AS t3) AS t4 WHERE t4.c2 <= 3)
WITH "t1" AS (SELECT "admissions"."subject_id", "diagnoses_icd"."icd9_code", "diagnoses_icd"."charttime" FROM "diagnoses_icd" JOIN "admissions" ON "admissions"."hadm_id" = "diagnoses_icd"."hadm_id" GROUP BY "admissions"."subject_id", "diagnoses_icd"."icd9_code" HAVING "diagnoses_icd"."charttime" = MIN("diagnoses_icd"."charttime")), "t3" AS (SELECT "t1"."icd9_code", 100 - SUM(CASE WHEN "patients"."dod" IS NULL THEN 1 WHEN STRFTIME('%j', "patients"."dod") - STRFTIME('%j', "t1"."charttime") > 1095 THEN 1 ELSE 0 END) * 100 / NULLIF(COUNT(*), 0) AS "c1" FROM "t1" AS "t1" JOIN "patients" ON "patients"."subject_id" = "t1"."subject_id" WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "t1"."charttime") > 1095 GROUP BY "t1"."icd9_code"), "t4" AS (SELECT "t3"."icd9_code", DENSE_RANK() OVER (ORDER BY "t3"."c1" DESC NULLS LAST) AS "c2" FROM "t3" AS "t3"), "_u_0" AS (SELECT "t4"."icd9_code" FROM "t4" AS "t4" WHERE "t4"."c2" <= 3 GROUP BY "icd9_code") SELECT "d_icd_diagnoses"."short_title" FROM "d_icd_diagnoses" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "d_icd_diagnoses"."icd9_code" WHERE NOT "_u_0"."" IS NULL
1.09082
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, give me the comparison about the amount of founder over the founder , and group by attribute founder by a bar chart.
SELECT Founder, COUNT(Founder) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder
SELECT "Founder", COUNT("Founder") FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "Founder"
0.139648
CREATE TABLE table_38151 ("Round" FLOAT, "Pick #" FLOAT, "Overall" FLOAT, "Name" TEXT, "Position" TEXT, "College" TEXT)
Which Name has an Overall of 235?
SELECT "Name" FROM table_38151 WHERE "Overall" = '235'
SELECT "Name" FROM "table_38151" WHERE "Overall" = '235'
0.054688
CREATE TABLE table_name_15 (year INT, issue_price VARCHAR, mintage VARCHAR)
What is the Year of the Coin with an Issue Price of $1089.95 and Mintage less than 900?
SELECT SUM(year) FROM table_name_15 WHERE issue_price = "$1089.95" AND mintage < 900
SELECT SUM("year") FROM "table_name_15" WHERE "$1089.95" = "issue_price" AND "mintage" < 900
0.089844
CREATE TABLE table_204_706 (id DECIMAL, "year" DECIMAL, "competition" TEXT, "venue" TEXT, "position" TEXT, "notes" TEXT)
in what year was the position of 3rd first achieved ?
SELECT MIN("year") FROM table_204_706 WHERE "position" = 3
SELECT MIN("year") FROM "table_204_706" WHERE "position" = 3
0.058594
CREATE TABLE table_name_20 (home VARCHAR, date VARCHAR)
On December 5 what team played their home game?
SELECT home FROM table_name_20 WHERE date = "december 5"
SELECT "home" FROM "table_name_20" WHERE "date" = "december 5"
0.060547
CREATE TABLE table_name_30 (class VARCHAR, year VARCHAR, points VARCHAR)
What is the Class for a year later than 1958, with 4 points?
SELECT class FROM table_name_30 WHERE year > 1958 AND points = 4
SELECT "class" FROM "table_name_30" WHERE "points" = 4 AND "year" > 1958
0.070313
CREATE TABLE table_44053 ("Game" FLOAT, "Date" TEXT, "Opponent" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location/Attendance" TEXT, "Record" TEXT)
What's the highest game found when the record is 2-1?
SELECT MAX("Game") FROM table_44053 WHERE "Record" = '2-1'
SELECT MAX("Game") FROM "table_44053" WHERE "Record" = '2-1'
0.058594
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)
Give me the comparison about the sum of Team_ID over the All_Home , and group by attribute All_Home by a bar chart, and I want to list by the y axis from high to low please.
SELECT All_Home, SUM(Team_ID) FROM basketball_match GROUP BY All_Home ORDER BY SUM(Team_ID) DESC
SELECT "All_Home", SUM("Team_ID") FROM "basketball_match" GROUP BY "All_Home" ORDER BY SUM("Team_ID") DESC NULLS LAST
0.114258
CREATE TABLE table_58698 ("Game" TEXT, "Date" TEXT, "Home Team" TEXT, "Result" TEXT, "Road Team" TEXT)
Name Road Team of Game of game 4?
SELECT "Road Team" FROM table_58698 WHERE "Game" = 'game 4'
SELECT "Road Team" FROM "table_58698" WHERE "Game" = 'game 4'
0.05957
CREATE TABLE Reservations (Code INT, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate FLOAT, LastName TEXT, FirstName TEXT, Adults INT, Kids INT) CREATE TABLE Rooms (RoomId TEXT, roomName TEXT, beds INT, bedType TEXT, maxOccupancy INT, basePrice INT, decor TEXT)
Show me the proportion on how many rooms have king beds? Report the number for each decor type.
SELECT decor, COUNT(*) FROM Rooms WHERE bedType = "King" GROUP BY decor
SELECT "decor", COUNT(*) FROM "Rooms" WHERE "King" = "bedType" GROUP BY "decor"
0.077148
CREATE TABLE table_19744915_18 (total INT, couple VARCHAR)
When ellery and frankie are the couple what is the highest total?
SELECT MAX(total) FROM table_19744915_18 WHERE couple = "Ellery and Frankie"
SELECT MAX("total") FROM "table_19744915_18" WHERE "Ellery and Frankie" = "couple"
0.080078
CREATE TABLE table_60512 ("Team" TEXT, "Matches" FLOAT, "Wins" FLOAT, "Wins %" TEXT, "Draws" FLOAT, "Draws %" TEXT, "Losses" FLOAT, "Losses %" TEXT, "Against" FLOAT)
What is the Lowest value in Against with Wins % of 50.4% and Losses less than 20?
SELECT MIN("Against") FROM table_60512 WHERE "Wins %" = '50.4%' AND "Losses" < '20'
SELECT MIN("Against") FROM "table_60512" WHERE "Losses" < '20' AND "Wins %" = '50.4%'
0.083008
CREATE TABLE table_28415 ("No." FLOAT, "#" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "U.S. viewers ( million ) " TEXT, "Rank ( week ) " TEXT, "Original air date" TEXT, "Production code" TEXT)
What was the rank (week) for episode number 34?
SELECT "Rank (week)" FROM table_28415 WHERE "No." = '34'
SELECT "Rank (week)" FROM "table_28415" WHERE "No." = '34'
0.056641
CREATE TABLE table_75409 ("Almal\\u0131 ( Qax ) " TEXT, "F\\u0131st\\u0131ql\\u0131" TEXT, "Malax" TEXT, "Qaxmu\\u011fal" TEXT, "S\\u00fcsk\\u0259n" TEXT)
What is the Almali village with the S sk n village z rn ?
SELECT "Almal\u0131 (Qax)" FROM table_75409 WHERE "S\u00fcsk\u0259n" = 'zərnə'
SELECT "Almal\u0131 (Qax)" FROM "table_75409" WHERE "S\u00fcsk\u0259n" = 'zərnə'
0.078125
CREATE TABLE table_203_158 (id DECIMAL, "date" TEXT, "time" TEXT, "opponent#" TEXT, "rank#" TEXT, "site" TEXT, "tv" TEXT, "result" TEXT, "attendance" DECIMAL)
how many games did each team score over 20 points ?
SELECT COUNT(*) FROM table_203_158 WHERE "result" > 20 AND "result" > 20
SELECT COUNT(*) FROM "table_203_158" WHERE "result" > 20
0.054688
CREATE TABLE table_name_98 (event VARCHAR, record VARCHAR, res VARCHAR, round VARCHAR)
What event had a win, record of 8-1 and n/a round?
SELECT event FROM table_name_98 WHERE res = "win" AND round = "n/a" AND record = "8-1"
SELECT "event" FROM "table_name_98" WHERE "8-1" = "record" AND "n/a" = "round" AND "res" = "win"
0.09375
CREATE TABLE table_64343 ("Class" TEXT, "Railway number ( s ) " TEXT, "Quantity" FLOAT, "Year ( s ) of manufacture" TEXT, "Type" TEXT)
Which Class has a Type of 1 c n2t?
SELECT "Class" FROM table_64343 WHERE "Type" = '1′c n2t'
SELECT "Class" FROM "table_64343" WHERE "Type" = '1′c n2t'
0.056641
CREATE TABLE table_name_19 (gold INT, bronze VARCHAR, total VARCHAR, nation VARCHAR)
What is the average number of gold medals won by Brazil for entries with more than 1 bronze medal but a total smaller than 4?
SELECT AVG(gold) FROM table_name_19 WHERE total < 4 AND nation = "brazil" AND bronze > 1
SELECT AVG("gold") FROM "table_name_19" WHERE "brazil" = "nation" AND "bronze" > 1 AND "total" < 4
0.095703
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 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 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 diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE 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 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 transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) 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 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)
whats the first care unit of patient 40707 since 2105?
SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 40707) AND NOT transfers.careunit IS NULL AND STRFTIME('%y', transfers.intime) >= '2105' ORDER BY transfers.intime LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 40707 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") >= '2105' ORDER BY "transfers"."intime" NULLS FIRST LIMIT 1
0.392578
CREATE TABLE table_50283 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Record" TEXT)
What are the high points that have 42 as the game?
SELECT "High points" FROM table_50283 WHERE "Game" = '42'
SELECT "High points" FROM "table_50283" WHERE "Game" = '42'
0.057617
CREATE TABLE View_Unit_Status (apt_id INT, apt_booking_id INT, status_date DATETIME, available_yn BIT) CREATE TABLE Apartment_Buildings (building_id INT, building_short_name CHAR, building_full_name VARCHAR, building_description VARCHAR, building_address VARCHAR, building_manager VARCHAR, building_phone VARCHAR) CREATE TABLE Apartment_Bookings (apt_booking_id INT, apt_id INT, guest_id INT, booking_status_code CHAR, booking_start_date DATETIME, booking_end_date DATETIME) CREATE TABLE Guests (guest_id INT, gender_code CHAR, guest_first_name VARCHAR, guest_last_name VARCHAR, date_of_birth DATETIME) CREATE TABLE Apartments (apt_id INT, building_id INT, apt_type_code CHAR, apt_number CHAR, bathroom_count INT, bedroom_count INT, room_count CHAR) CREATE TABLE Apartment_Facilities (apt_id INT, facility_code CHAR)
What is the number of booking start dates of the apartments with more than 2 bedrooms for each weekday? Draw a bar chart, and order by the Y from low to high please.
SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 2 ORDER BY COUNT(booking_start_date)
SELECT "booking_start_date", COUNT("booking_start_date") FROM "Apartment_Bookings" AS "T1" JOIN "Apartments" AS "T2" ON "T1"."apt_id" = "T2"."apt_id" AND "T2"."bedroom_count" > 2 ORDER BY COUNT("booking_start_date") NULLS FIRST
0.22168
CREATE TABLE table_name_22 (run_4 VARCHAR, final VARCHAR)
Which Run 4 has a Final of 8:16.28?
SELECT run_4 FROM table_name_22 WHERE final = "8:16.28"
SELECT "run_4" FROM "table_name_22" WHERE "8:16.28" = "final"
0.05957
CREATE TABLE table_75091 ("Game" FLOAT, "January" FLOAT, "Opponent" TEXT, "Score" TEXT, "Record" TEXT, "Points" FLOAT)
How many Games have a Score of 2 6, and Points larger than 62?
SELECT COUNT("Game") FROM table_75091 WHERE "Score" = '2–6' AND "Points" > '62'
SELECT COUNT("Game") FROM "table_75091" WHERE "Points" > '62' AND "Score" = '2–6'
0.079102
CREATE TABLE table_name_68 (score VARCHAR, set_3 VARCHAR)
What is the Score when the set 3 is 26 28?
SELECT score FROM table_name_68 WHERE set_3 = "26–28"
SELECT "score" FROM "table_name_68" WHERE "26–28" = "set_3"
0.057617
CREATE TABLE table_15005 ("Season" TEXT, "Player" TEXT, "Position" TEXT, "Nationality" TEXT, "Team" TEXT)
What positions are in the Chicago bulls?
SELECT "Position" FROM table_15005 WHERE "Team" = 'chicago bulls'
SELECT "Position" FROM "table_15005" WHERE "Team" = 'chicago bulls'
0.06543
CREATE TABLE table_63806 ("Rank" FLOAT, "Rowers" TEXT, "Country" TEXT, "Time" TEXT, "Notes" TEXT)
What is the highest rank with the notes of sa/b, and a time of 6:39.07?
SELECT MAX("Rank") FROM table_63806 WHERE "Notes" = 'sa/b' AND "Time" = '6:39.07'
SELECT MAX("Rank") FROM "table_63806" WHERE "Notes" = 'sa/b' AND "Time" = '6:39.07'
0.081055
CREATE TABLE table_name_42 (finish VARCHAR, year INT)
Give the Finish for years after 2007.
SELECT finish FROM table_name_42 WHERE year > 2007
SELECT "finish" FROM "table_name_42" WHERE "year" > 2007
0.054688
CREATE TABLE table_train_127 ("id" INT, "depression" BOOLEAN, "mini_mental_state_examination_mmse" INT, "back_pain" BOOLEAN, "renal_disease" BOOLEAN, "osteoarthritis" BOOLEAN, "hamilton_depression_scale_hds" INT, "liver_disease" BOOLEAN, "painful_condition" BOOLEAN, "other_chronic_musculoskeletal_pain" BOOLEAN, "major_depression" BOOLEAN, "NOUSE" FLOAT)
history of a typically painful condition, such as osteoarthritis, back pain, or other chronic musculoskeletal pain
SELECT * FROM table_train_127 WHERE painful_condition = 1 OR (osteoarthritis = 1 OR back_pain = 1 OR other_chronic_musculoskeletal_pain = 1)
SELECT * FROM "table_train_127" WHERE "back_pain" = 1 OR "osteoarthritis" = 1 OR "other_chronic_musculoskeletal_pain" = 1 OR "painful_condition" = 1
0.144531
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 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 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 d_icd_diagnoses (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 labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE 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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value 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 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)
how much ranitidine has been prescribed to patient 24971 in total in 01/2105?
SELECT SUM(prescriptions.dose_val_rx) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24971) AND prescriptions.drug = 'ranitidine' AND STRFTIME('%y-%m', prescriptions.startdate) = '2105-01'
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 24971 GROUP BY "hadm_id") SELECT SUM("prescriptions"."dose_val_rx") FROM "prescriptions" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "prescriptions"."hadm_id" WHERE "prescriptions"."drug" = 'ranitidine' AND NOT "_u_0"."" IS NULL AND STRFTIME('%y-%m', "prescriptions"."startdate") = '2105-01'
0.37793