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_15348 ("Sydney" TEXT, "Melbourne" TEXT, "Perth" TEXT, "Adelaide" TEXT, "Gold Coast" TEXT, "Auckland" TEXT)
Which Adelaide has a Sydney of yes, a Perth of no, a Melbourne of yes, and an Auckland of no?
SELECT "Adelaide" FROM table_15348 WHERE "Sydney" = 'yes' AND "Perth" = 'no' AND "Melbourne" = 'yes' AND "Auckland" = 'no'
SELECT "Adelaide" FROM "table_15348" WHERE "Auckland" = 'no' AND "Melbourne" = 'yes' AND "Perth" = 'no' AND "Sydney" = 'yes'
0.121094
CREATE TABLE table_43177 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" TEXT)
What country was the player, rod pampling, from who placed t10?
SELECT "Country" FROM table_43177 WHERE "Place" = 't10' AND "Player" = 'rod pampling'
SELECT "Country" FROM "table_43177" WHERE "Place" = 't10' AND "Player" = 'rod pampling'
0.084961
CREATE TABLE table_30118 ("Episode #" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Originalairdate" TEXT, "Viewers ( millions ) " TEXT)
How many million viewers watched episodes prior to episode 2.0?
SELECT "Viewers (millions)" FROM table_30118 WHERE "Episode #" < '2.0'
SELECT "Viewers (millions)" FROM "table_30118" WHERE "Episode #" < '2.0'
0.070313
CREATE TABLE Products (Product_ID VARCHAR, Product_Name VARCHAR, Product_Price DECIMAL, Product_Description VARCHAR, Other_Product_Service_Details VARCHAR) CREATE TABLE Performers_in_Bookings (Order_ID INT, Performer_ID INT) CREATE TABLE Bookings_Services (Order_ID INT, Product_ID INT) CREATE TABLE Order_Items (Order_Item_ID INT, Order_ID INT, Product_ID INT, Order_Quantity VARCHAR, Other_Item_Details VARCHAR) CREATE TABLE Ref_Service_Types (Service_Type_Code CHAR, Parent_Service_Type_Code CHAR, Service_Type_Description VARCHAR) CREATE TABLE Invoices (Invoice_ID INT, Order_ID INT, payment_method_code CHAR, Product_ID INT, Order_Quantity VARCHAR, Other_Item_Details VARCHAR, Order_Item_ID INT) CREATE TABLE Invoice_Items (Invoice_Item_ID INT, Invoice_ID INT, Order_ID INT, Order_Item_ID INT, Product_ID INT, Order_Quantity INT, Other_Item_Details VARCHAR) CREATE TABLE Performers (Performer_ID INT, Address_ID INT, Customer_Name VARCHAR, Customer_Phone VARCHAR, Customer_Email_Address VARCHAR, Other_Details VARCHAR) CREATE TABLE Bookings (Booking_ID INT, Customer_ID INT, Workshop_Group_ID VARCHAR, Status_Code CHAR, Store_ID INT, Order_Date DATETIME, Planned_Delivery_Date DATETIME, Actual_Delivery_Date DATETIME, Other_Order_Details VARCHAR) CREATE TABLE Ref_Payment_Methods (payment_method_code CHAR, payment_method_description VARCHAR) CREATE TABLE Clients (Client_ID INT, Address_ID INT, Customer_Email_Address VARCHAR, Customer_Name VARCHAR, Customer_Phone VARCHAR, Other_Details VARCHAR) CREATE TABLE Addresses (Address_ID VARCHAR, Line_1 VARCHAR, Line_2 VARCHAR, City_Town VARCHAR, State_County VARCHAR, Other_Details VARCHAR) CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID INT, Address_ID INT, Currency_Code CHAR, Marketing_Region_Code CHAR, Store_Name VARCHAR, Store_Phone VARCHAR, Store_Email_Address VARCHAR, Other_Details VARCHAR) CREATE TABLE Services (Service_ID INT, Service_Type_Code CHAR, Workshop_Group_ID INT, Product_Description VARCHAR, Product_Name VARCHAR, Product_Price DECIMAL, Other_Product_Service_Details VARCHAR) CREATE TABLE Customer_Orders (Order_ID INT, Customer_ID INT, Store_ID INT, Order_Date DATETIME, Planned_Delivery_Date DATETIME, Actual_Delivery_Date DATETIME, Other_Order_Details VARCHAR) CREATE TABLE Stores (Store_ID VARCHAR, Address_ID INT, Marketing_Region_Code CHAR, Store_Name VARCHAR, Store_Phone VARCHAR, Store_Email_Address VARCHAR, Other_Details VARCHAR) CREATE TABLE Customers (Customer_ID VARCHAR, Address_ID INT, Customer_Name VARCHAR, Customer_Phone VARCHAR, Customer_Email_Address VARCHAR, Other_Details VARCHAR) CREATE TABLE Marketing_Regions (Marketing_Region_Code CHAR, Marketing_Region_Name VARCHAR, Marketing_Region_Descriptrion VARCHAR, Other_Details VARCHAR)
Give me a bar chart for mean product price of each product name
SELECT Product_Name, AVG(Product_Price) FROM Products GROUP BY Product_Name
SELECT "Product_Name", AVG("Product_Price") FROM "Products" GROUP BY "Product_Name"
0.081055
CREATE TABLE table_204_971 (id DECIMAL, "m" DECIMAL, "date" TEXT, "tournament" TEXT, "round" TEXT, "ground" TEXT, "opponent" TEXT, "score" TEXT, "attendance" DECIMAL, "dinamo scorers" TEXT, "report" TEXT)
how many tournaments were attended by the same number of people as uel on the 19th of august ?
SELECT COUNT("tournament") FROM table_204_971 WHERE "date" <> '19 aug' AND "attendance" = (SELECT "attendance" FROM table_204_971 WHERE "date" = '19 aug')
SELECT COUNT("tournament") FROM "table_204_971" WHERE "attendance" = (SELECT "attendance" FROM "table_204_971" WHERE "date" = '19 aug') AND "date" <> '19 aug'
0.154297
CREATE TABLE table_56366 ("Date" TEXT, "Venue" TEXT, "Score" TEXT, "Result" TEXT, "Competition" TEXT)
What is the name of the competition that ended with a score of 1-3?
SELECT "Competition" FROM table_56366 WHERE "Score" = '1-3'
SELECT "Competition" FROM "table_56366" WHERE "Score" = '1-3'
0.05957
CREATE TABLE table_name_12 (player VARCHAR, to_par VARCHAR, score VARCHAR)
What Player has a To par of +5 with a Score of 70-70-71-74=285?
SELECT player FROM table_name_12 WHERE to_par = "+5" AND score = 70 - 70 - 71 - 74 = 285
SELECT "player" FROM "table_name_12" WHERE "+5" = "to_par" AND "score" = FALSE
0.076172
CREATE TABLE table_24118 ("Game" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Orangemen points" FLOAT, "Opponents" FLOAT, "Record" TEXT)
Which opponent has a record of 6-2?
SELECT "Opponent" FROM table_24118 WHERE "Record" = '6-2'
SELECT "Opponent" FROM "table_24118" WHERE "Record" = '6-2'
0.057617
CREATE TABLE table_50204 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Ground" TEXT, "Crowd" FLOAT, "Date" TEXT)
Who was the away team on sunday, 13 february?
SELECT "Away team" FROM table_50204 WHERE "Date" = 'sunday, 13 february'
SELECT "Away team" FROM "table_50204" WHERE "Date" = 'sunday, 13 february'
0.072266
CREATE TABLE table_68727 ("Event" TEXT, "Time" TEXT, "Venue" TEXT, "Date" TEXT, "Notes" TEXT)
Which venue has a note of AM?
SELECT "Venue" FROM table_68727 WHERE "Notes" = 'am'
SELECT "Venue" FROM "table_68727" WHERE "Notes" = 'am'
0.052734
CREATE TABLE table_25318033_1 (races INT)
What is the lowest amount of races?
SELECT MIN(races) FROM table_25318033_1
SELECT MIN("races") FROM "table_25318033_1"
0.041992
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 Document_Locations (Document_ID INT, Location_Code CHAR, Date_in_Location_From DATETIME, Date_in_Locaton_To DATETIME) CREATE TABLE Employees (Employee_ID INT, Role_Code CHAR, Employee_Name VARCHAR, Gender_MFU CHAR, Date_of_Birth DATETIME, Other_Details 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 Ref_Calendar (Calendar_Date DATETIME, Day_Number INT) CREATE TABLE Ref_Locations (Location_Code CHAR, Location_Name VARCHAR, Location_Description VARCHAR) CREATE TABLE Roles (Role_Code CHAR, Role_Name VARCHAR, Role_Description VARCHAR) CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR, Document_Type_Name VARCHAR, Document_Type_Description VARCHAR)
I want to see trend of the number of date in locaton to by date in locaton to, and list by the x axis in asc.
SELECT Date_in_Locaton_To, COUNT(Date_in_Locaton_To) FROM Document_Locations ORDER BY Date_in_Locaton_To
SELECT "Date_in_Locaton_To", COUNT("Date_in_Locaton_To") FROM "Document_Locations" ORDER BY "Date_in_Locaton_To" NULLS FIRST
0.121094
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
what is the number of patients whose diagnoses icd9 code is 7242 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.icd9_code = "7242" AND lab.flag = "abnormal"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "7242" = "diagnoses"."icd9_code" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "abnormal" = "lab"."flag" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.25293
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
provide the number of patients whose ethnicity is unknown/not specified and primary disease is brain mass;intracranial hemorrhage?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "UNKNOWN/NOT SPECIFIED" AND demographic.diagnosis = "BRAIN MASS;INTRACRANIAL HEMORRHAGE"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "BRAIN MASS;INTRACRANIAL HEMORRHAGE" = "demographic"."diagnosis" AND "UNKNOWN/NOT SPECIFIED" = "demographic"."ethnicity"
0.19043
CREATE TABLE table_name_43 (date VARCHAR, visitor VARCHAR, record VARCHAR)
What day was the visitor Cleveland when the record was 34-26?
SELECT date FROM table_name_43 WHERE visitor = "cleveland" AND record = "34-26"
SELECT "date" FROM "table_name_43" WHERE "34-26" = "record" AND "cleveland" = "visitor"
0.084961
CREATE TABLE table_203_153 (id DECIMAL, "stamp issue date" TEXT, "stamp set" TEXT, "#cards" TEXT, "card set ref" TEXT, "qty. issued" DECIMAL)
which was the only stamp set to have more than 200,000 issued ?
SELECT "stamp set" FROM table_203_153 WHERE "qty. issued" > 200000
SELECT "stamp set" FROM "table_203_153" WHERE "qty. issued" > 200000
0.066406
CREATE TABLE table_11531 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
How many people were in attendance at Glenferrie Oval?
SELECT MIN("Crowd") FROM table_11531 WHERE "Venue" = 'glenferrie oval'
SELECT MIN("Crowd") FROM "table_11531" WHERE "Venue" = 'glenferrie oval'
0.070313
CREATE TABLE record (ID INT, Result TEXT, Swimmer_ID INT, Event_ID INT) CREATE TABLE swimmer (ID INT, name TEXT, Nationality TEXT, meter_100 FLOAT, meter_200 TEXT, meter_300 TEXT, meter_400 TEXT, meter_500 TEXT, meter_600 TEXT, meter_700 TEXT, Time TEXT) CREATE TABLE event (ID INT, Name TEXT, Stadium_ID INT, Year TEXT) CREATE TABLE stadium (ID INT, name TEXT, Capacity INT, City TEXT, Country TEXT, Opening_year INT)
Give me the comparison about meter_100 over the meter_600 by a bar chart, and could you order from low to high by the Y-axis?
SELECT meter_600, meter_100 FROM swimmer ORDER BY meter_100
SELECT "meter_600", "meter_100" FROM "swimmer" ORDER BY "meter_100" NULLS FIRST
0.077148
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 airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE compartment_class (compartment VARCHAR, class_type 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 dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE 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 airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight 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 time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE code_description (code VARCHAR, 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_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare 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)
show me the nonstop flights from ATLANTA to OAKLAND that leave in the afternoon and arrive between 1630 and 1830
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((((flight.arrival_time <= 1830 AND flight.arrival_time >= 1630) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'OAKLAND' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.departure_time BETWEEN 1200 AND 1800) AND flight.stops = 0
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'ATLANTA' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "flight"."arrival_time" <= 1830 AND "flight"."arrival_time" >= 1630 AND "flight"."departure_time" <= 1800 AND "flight"."departure_time" >= 1200 AND "flight"."stops" = 0 JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'OAKLAND'
0.663086
CREATE TABLE table_name_74 (tournament VARCHAR)
What is Tournament, when 2005 is 'N/A', and when 2002 is '0 / 1'?
SELECT tournament FROM table_name_74 WHERE 2005 = "n/a" AND 2002 = "0 / 1"
SELECT "tournament" FROM "table_name_74" WHERE "0 / 1" = 2002 AND "n/a" = 2005
0.076172
CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) 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 lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
what is the cost of a diagnosis for an acute respiratory failure - due to increased co2 production?
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'diagnosis' AND cost.eventid IN (SELECT diagnosis.diagnosisid FROM diagnosis WHERE diagnosis.diagnosisname = 'acute respiratory failure - due to increased co2 production')
WITH "_u_0" AS (SELECT "diagnosis"."diagnosisid" FROM "diagnosis" WHERE "diagnosis"."diagnosisname" = 'acute respiratory failure - due to increased co2 production' GROUP BY "diagnosisid") SELECT DISTINCT "cost"."cost" FROM "cost" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "cost"."eventid" WHERE "cost"."eventtype" = 'diagnosis' AND NOT "_u_0"."" IS NULL
0.344727
CREATE TABLE table_name_49 (mixed_doubles VARCHAR, year VARCHAR)
Who won the Mixed Doubles in 2007?
SELECT mixed_doubles FROM table_name_49 WHERE year = "2007"
SELECT "mixed_doubles" FROM "table_name_49" WHERE "2007" = "year"
0.063477
CREATE TABLE student_course_registrations (student_id VARCHAR) CREATE TABLE student_course_attendance (student_id VARCHAR)
What are all info of students who registered courses but not attended courses?
SELECT * FROM student_course_registrations WHERE NOT student_id IN (SELECT student_id FROM student_course_attendance)
SELECT * FROM "student_course_registrations" WHERE NOT "student_id" IN (SELECT "student_id" FROM "student_course_attendance")
0.12207
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) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
what is minimum age of patients whose ethnicity is white and admission year is greater than or equal to 2119?
SELECT MIN(demographic.age) FROM demographic WHERE demographic.ethnicity = "WHITE" AND demographic.admityear >= "2119"
SELECT MIN("demographic"."age") FROM "demographic" WHERE "2119" <= "demographic"."admityear" AND "WHITE" = "demographic"."ethnicity"
0.128906
CREATE TABLE table_203_547 (id DECIMAL, "ship" TEXT, "built" DECIMAL, "in service for cunard" TEXT, "type" TEXT, "tonnage" TEXT, "notes" TEXT)
the year the last intermediate ship was built .
SELECT MAX("built") FROM table_203_547 WHERE "type" = 'intermediate'
SELECT MAX("built") FROM "table_203_547" WHERE "type" = 'intermediate'
0.068359
CREATE TABLE table_name_3 (score VARCHAR, player VARCHAR)
What score has fred couples as the player?
SELECT score FROM table_name_3 WHERE player = "fred couples"
SELECT "score" FROM "table_name_3" WHERE "fred couples" = "player"
0.064453
CREATE TABLE table_203_51 (id DECIMAL, "channel" TEXT, "definition" TEXT, "organisation" TEXT, "ownership" TEXT, "notes" TEXT)
what are the number of channels owned by the government ?
SELECT COUNT("channel") FROM table_203_51 WHERE "ownership" = 'government'
SELECT COUNT("channel") FROM "table_203_51" WHERE "ownership" = 'government'
0.074219
CREATE TABLE table_name_97 (platform VARCHAR, system VARCHAR, name VARCHAR)
What platform is nds4droid on for the nintendo ds?
SELECT platform FROM table_name_97 WHERE system = "nintendo ds" AND name = "nds4droid"
SELECT "platform" FROM "table_name_97" WHERE "name" = "nds4droid" AND "nintendo ds" = "system"
0.091797
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) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL)
what were the top four most commonly performed procedures that patients took after being diagnosed with pleural effusion - bilateral in the same hospital visit until 2102?
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'pleural effusion - bilateral' AND STRFTIME('%y', diagnosis.diagnosistime) <= '2102') AS t1 JOIN (SELECT patient.uniquepid, treatment.treatmentname, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE STRFTIME('%y', treatment.treatmenttime) <= '2102') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.treatmenttime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid GROUP BY t2.treatmentname) AS t3 WHERE t3.c1 <= 4
WITH "t2" AS (SELECT "patient"."uniquepid", "treatment"."treatmentname", "treatment"."treatmenttime", "patient"."patienthealthsystemstayid" FROM "treatment" JOIN "patient" ON "patient"."patientunitstayid" = "treatment"."patientunitstayid" WHERE STRFTIME('%y', "treatment"."treatmenttime") <= '2102'), "t3" AS (SELECT "t2"."treatmentname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" JOIN "t2" AS "t2" ON "diagnosis"."diagnosistime" < "t2"."treatmenttime" AND "patient"."patienthealthsystemstayid" = "t2"."patienthealthsystemstayid" AND "patient"."uniquepid" = "t2"."uniquepid" WHERE "diagnosis"."diagnosisname" = 'pleural effusion - bilateral' AND STRFTIME('%y', "diagnosis"."diagnosistime") <= '2102' GROUP BY "t2"."treatmentname") SELECT "t3"."treatmentname" FROM "t3" AS "t3" WHERE "t3"."c1" <= 4
0.894531
CREATE TABLE table_48219 ("Category" TEXT, "Speed ( km/h ) " FLOAT, "Speed ( mph ) " FLOAT, "Vehicle" TEXT, "Pilot" TEXT, "Date" TEXT)
What is the sum of speed in km per hour reached by John Egginton?
SELECT SUM("Speed (km/h)") FROM table_48219 WHERE "Pilot" = 'john egginton'
SELECT SUM("Speed (km/h)") FROM "table_48219" WHERE "Pilot" = 'john egginton'
0.075195
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) 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 patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE 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 d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT)
provide me with the four most common diagnosis since 4 years ago.
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE DATETIME(diagnoses_icd.charttime) >= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY diagnoses_icd.icd9_code) AS t1 WHERE t1.c1 <= 4)
WITH "t1" AS (SELECT "diagnoses_icd"."icd9_code", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "diagnoses_icd" WHERE DATETIME("diagnoses_icd"."charttime") >= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY "diagnoses_icd"."icd9_code"), "_u_0" AS (SELECT "t1"."icd9_code" FROM "t1" AS "t1" WHERE "t1"."c1" <= 4 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
0.5
CREATE TABLE table_16175217_1 (donor_payment VARCHAR, children_per_donor VARCHAR)
What are donor payments in the country where there are 12 children to 6 families (2 per family)?
SELECT donor_payment FROM table_16175217_1 WHERE children_per_donor = "12 children to 6 families (2 per family)"
SELECT "donor_payment" FROM "table_16175217_1" WHERE "12 children to 6 families (2 per family)" = "children_per_donor"
0.115234
CREATE TABLE table_204_587 (id DECIMAL, "drop ( s ) " TEXT, "multiplayer map ( s ) " TEXT, "spec ops mission ( s ) " TEXT, "face off map ( s ) " TEXT, "xbox 360 release date" TEXT, "playstation 3 release date" TEXT)
were drops 4-6 released on xbox 360 after they were released on playstation 3 ?
SELECT (SELECT "xbox 360 release date" FROM table_204_587 WHERE "drop(s)" = '4-6') > (SELECT "playstation 3 release date" FROM table_204_587 WHERE "drop(s)" = '4-6')
SELECT (SELECT "playstation 3 release date" FROM "table_204_587" WHERE "drop(s)" = '4-6') < (SELECT "xbox 360 release date" FROM "table_204_587" WHERE "drop(s)" = '4-6')
0.165039
CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE area (course_id INT, area VARCHAR) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category 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 gsi (course_offering_id INT, student_id INT) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_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 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 program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT)
How many courses are there that 2 or more professors teach ?
SELECT COUNT(DISTINCT course_offering.course_id) FROM course, course_offering, offering_instructor AS OFFERING_INSTRUCTOR_0, offering_instructor AS OFFERING_INSTRUCTOR_1, offering_instructor AS OFFERING_INSTRUCTOR_2 WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND OFFERING_INSTRUCTOR_0.instructor_id < OFFERING_INSTRUCTOR_1.instructor_id AND OFFERING_INSTRUCTOR_0.offering_id = course_offering.offering_id AND OFFERING_INSTRUCTOR_1.instructor_id < OFFERING_INSTRUCTOR_2.instructor_id AND OFFERING_INSTRUCTOR_1.offering_id = OFFERING_INSTRUCTOR_0.offering_id AND OFFERING_INSTRUCTOR_2.offering_id = OFFERING_INSTRUCTOR_0.offering_id
SELECT COUNT(DISTINCT "course_offering"."course_id") FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "offering_instructor" AS "OFFERING_INSTRUCTOR_0" ON "OFFERING_INSTRUCTOR_0"."offering_id" = "course_offering"."offering_id" JOIN "offering_instructor" AS "OFFERING_INSTRUCTOR_1" ON "OFFERING_INSTRUCTOR_0"."instructor_id" < "OFFERING_INSTRUCTOR_1"."instructor_id" AND "OFFERING_INSTRUCTOR_0"."offering_id" = "OFFERING_INSTRUCTOR_1"."offering_id" JOIN "offering_instructor" AS "OFFERING_INSTRUCTOR_2" ON "OFFERING_INSTRUCTOR_0"."offering_id" = "OFFERING_INSTRUCTOR_2"."offering_id" AND "OFFERING_INSTRUCTOR_1"."instructor_id" < "OFFERING_INSTRUCTOR_2"."instructor_id" WHERE "course"."department" = 'EECS'
0.735352
CREATE TABLE table_name_1 (res VARCHAR, record VARCHAR)
What was the result of the bout that led to a 4-4 record?
SELECT res FROM table_name_1 WHERE record = "4-4"
SELECT "res" FROM "table_name_1" WHERE "4-4" = "record"
0.053711
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
provide the number of patients whose insurance is private and age is less than 89?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Private" AND demographic.age < "89"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "89" > "demographic"."age" AND "Private" = "demographic"."insurance"
0.139648
CREATE TABLE table_18870 ("District" TEXT, "2010 Population ( 000 ) " FLOAT, "2008 GDP ( USD bn ) a" TEXT, "2008 GDP per capita ( USD ) a" FLOAT, "Agri culture b" TEXT, "Mining b" TEXT, "Manufac turing b" TEXT, "Services & cons truction b" TEXT, "Exports ( USD mn ) 2011" FLOAT, "Median mo. salary ( USD ) a e" FLOAT, "Vehicles ( per 1000 ) d" FLOAT, "Income poverty f" TEXT, "Structural poverty g" TEXT)
How low was the income where services is 72.5?
SELECT "Income poverty f" FROM table_18870 WHERE "Services & cons truction b" = '72.5'
SELECT "Income poverty f" FROM "table_18870" WHERE "Services & cons truction b" = '72.5'
0.085938
CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE course_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE 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 program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE course_prerequisite (pre_course_id INT, course_id 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 gsi (course_offering_id INT, student_id INT) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE area (course_id INT, area VARCHAR)
Among the courses I 've taken , are any of them computing infrastructure courses ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN student_record ON student_record.course_id = course.course_id INNER JOIN area ON student_record.course_id = area.course_id WHERE area.area LIKE '%computing infrastructure%' AND student_record.student_id = 1
SELECT DISTINCT "course"."department", "course"."name", "course"."number" FROM "course" JOIN "student_record" ON "course"."course_id" = "student_record"."course_id" AND "student_record"."student_id" = 1 JOIN "area" ON "area"."area" LIKE '%computing infrastructure%' AND "area"."course_id" = "student_record"."course_id"
0.311523
CREATE TABLE table_49426 ("Player" TEXT, "Team" TEXT, "Matches" FLOAT, "Overs" FLOAT, "Wickets" FLOAT, "Economy Rate" FLOAT, "Average" FLOAT, "Strike Rate" FLOAT, "Best Bowling" TEXT)
What were the total number of matches played when the Deccan Chargers had a strike rate of 15.5?
SELECT MAX("Matches") FROM table_49426 WHERE "Team" = 'deccan chargers' AND "Strike Rate" > '15.5'
SELECT MAX("Matches") FROM "table_49426" WHERE "Strike Rate" > '15.5' AND "Team" = 'deccan chargers'
0.097656
CREATE TABLE table_name_40 (loses INT, draws INT)
What average Loses has Draws less than 0?
SELECT AVG(loses) FROM table_name_40 WHERE draws < 0
SELECT AVG("loses") FROM "table_name_40" WHERE "draws" < 0
0.056641
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE 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)
provide the number of patients whose ethnicity is black/cape verdean and drug name is 5% dextrose (excel bag)?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND prescriptions.drug = "5% Dextrose (EXCEL BAG)"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "5% Dextrose (EXCEL BAG)" = "prescriptions"."drug" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "BLACK/CAPE VERDEAN" = "demographic"."ethnicity"
0.248047
CREATE TABLE table_204_735 (id DECIMAL, "rank" DECIMAL, "team" TEXT, "names" TEXT, "time" TEXT, "qualification" TEXT)
which team finished after germany in cycling at the 1996 summer olympics men 's team pursuit ?
SELECT "team" FROM table_204_735 WHERE "rank" = (SELECT "rank" FROM table_204_735 WHERE "team" = 'germany') + 1
SELECT "team" FROM "table_204_735" WHERE "rank" = (SELECT "rank" FROM "table_204_735" WHERE "team" = 'germany') + 1
0.112305
CREATE TABLE table_49145 ("Res." TEXT, "Record" TEXT, "Opponent" TEXT, "Method" TEXT, "Event" TEXT, "Round" FLOAT, "Time" TEXT, "Location" TEXT)
What was the time of the match with a record of 9-0 and used the tko (doctor stoppage) method?
SELECT "Time" FROM table_49145 WHERE "Method" = 'tko (doctor stoppage)' AND "Record" = '9-0'
SELECT "Time" FROM "table_49145" WHERE "Method" = 'tko (doctor stoppage)' AND "Record" = '9-0'
0.091797
CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) 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 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) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL)
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about commission_pct over the last_name .
SELECT LAST_NAME, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
SELECT "LAST_NAME", "COMMISSION_PCT" FROM "employees" WHERE NOT "DEPARTMENT_ID" IN (SELECT "DEPARTMENT_ID" FROM "departments" WHERE "MANAGER_ID" <= 200 AND "MANAGER_ID" >= 100)
0.171875
CREATE TABLE table_25017530_6 (cfl_team VARCHAR, position VARCHAR)
Name the cfl team for lb position
SELECT cfl_team FROM table_25017530_6 WHERE position = "LB"
SELECT "cfl_team" FROM "table_25017530_6" WHERE "LB" = "position"
0.063477
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)
what is the number of patients whose admission type is elective and lab test name is lactate?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab.label = "Lactate"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Lactate" = "lab"."label" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "ELECTIVE" = "demographic"."admission_type"
0.199219
CREATE TABLE table_name_77 (city_of_license VARCHAR, identifier VARCHAR)
What city of license has cbon-fm-11 as the identifier?
SELECT city_of_license FROM table_name_77 WHERE identifier = "cbon-fm-11"
SELECT "city_of_license" FROM "table_name_77" WHERE "cbon-fm-11" = "identifier"
0.077148
CREATE TABLE table_name_19 (year INT, actor VARCHAR)
What is the average year that Idris Elba was nominated for or won an award?
SELECT AVG(year) FROM table_name_19 WHERE actor = "idris elba"
SELECT AVG("year") FROM "table_name_19" WHERE "actor" = "idris elba"
0.066406
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 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 employees (EMPLOYEE_ID DECIMAL, FIRST_NAME VARCHAR, LAST_NAME VARCHAR, EMAIL VARCHAR, PHONE_NUMBER VARCHAR, HIRE_DATE DATE, JOB_ID VARCHAR, SALARY DECIMAL, COMMISSION_PCT DECIMAL, MANAGER_ID DECIMAL, DEPARTMENT_ID DECIMAL) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL)
For those employees who was hired before 2002-06-21, a line chart shows the change of salary over hire_date, could you show X-axis in descending order?
SELECT HIRE_DATE, SALARY FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY HIRE_DATE DESC
SELECT "HIRE_DATE", "SALARY" FROM "employees" WHERE "HIRE_DATE" < '2002-06-21' ORDER BY "HIRE_DATE" DESC NULLS LAST
0.112305
CREATE TABLE table_2155350_2 (cab_size VARCHAR, category VARCHAR)
Name the number of cab size for 4 medium tanker
SELECT COUNT(cab_size) FROM table_2155350_2 WHERE category = "4 Medium tanker"
SELECT COUNT("cab_size") FROM "table_2155350_2" WHERE "4 Medium tanker" = "category"
0.082031
CREATE TABLE table_74698 ("Player" TEXT, "Tries" TEXT, "Conv" TEXT, "Pens" TEXT, "Drop" TEXT, "Venue" TEXT, "Date" TEXT)
How many conversions did Severo Koroduadua Waqanibau have when he has 0 pens?
SELECT "Conv" FROM table_74698 WHERE "Pens" = '0' AND "Player" = 'severo koroduadua waqanibau'
SELECT "Conv" FROM "table_74698" WHERE "Pens" = '0' AND "Player" = 'severo koroduadua waqanibau'
0.09375
CREATE TABLE table_17625749_1 (won VARCHAR, tries_against VARCHAR)
Name the won when tries against is 72
SELECT won FROM table_17625749_1 WHERE tries_against = "72"
SELECT "won" FROM "table_17625749_1" WHERE "72" = "tries_against"
0.063477
CREATE TABLE table_8013 ("Tie no" TEXT, "Home team" TEXT, "Score" TEXT, "Away team" TEXT, "Date" TEXT)
What is the score when away team is Crystal Palace?
SELECT "Score" FROM table_8013 WHERE "Away team" = 'crystal palace'
SELECT "Score" FROM "table_8013" WHERE "Away team" = 'crystal palace'
0.067383
CREATE TABLE table_name_2 (round VARCHAR, pick VARCHAR)
Which Round is pick 112 in?
SELECT round FROM table_name_2 WHERE pick = 112
SELECT "round" FROM "table_name_2" WHERE "pick" = 112
0.051758
CREATE TABLE table_name_45 (attendance VARCHAR, week VARCHAR, date VARCHAR)
What is the attendance number later than week 9 on November 20, 1983?
SELECT COUNT(attendance) FROM table_name_45 WHERE week > 9 AND date = "november 20, 1983"
SELECT COUNT("attendance") FROM "table_name_45" WHERE "date" = "november 20, 1983" AND "week" > 9
0.094727
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE 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)
Tell me the number of patients with angioedema as their primary disease who had a blood gas lab test category.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "ANGIOEDEMA" AND lab."CATEGORY" = "Blood Gas"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Blood Gas" = "lab"."CATEGORY" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "ANGIOEDEMA" = "demographic"."diagnosis"
0.201172
CREATE TABLE table_name_48 (ship VARCHAR, pennant_number VARCHAR)
What is the name of the ship that had a Pennant number of h55?
SELECT ship FROM table_name_48 WHERE pennant_number = "h55"
SELECT "ship" FROM "table_name_48" WHERE "h55" = "pennant_number"
0.063477
CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
give the lab test results of patient id 2560.
SELECT lab.flag FROM lab WHERE lab.subject_id = "2560"
SELECT "lab"."flag" FROM "lab" WHERE "2560" = "lab"."subject_id"
0.0625
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE 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 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 microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
what did patient 016-35802 get diagnosed with since 2102 for the first time?
SELECT diagnosis.diagnosisname FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-35802')) AND STRFTIME('%y', diagnosis.diagnosistime) >= '2102' ORDER BY diagnosis.diagnosistime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '016-35802' 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 "diagnosis"."diagnosisname" FROM "diagnosis" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "diagnosis"."patientunitstayid" WHERE NOT "_u_1"."" IS NULL AND STRFTIME('%y', "diagnosis"."diagnosistime") >= '2102' ORDER BY "diagnosis"."diagnosistime" NULLS FIRST LIMIT 1
0.611328
CREATE TABLE table_name_16 (opponent VARCHAR, date VARCHAR)
Who was the opponent on May 20?
SELECT opponent FROM table_name_16 WHERE date = "may 20"
SELECT "opponent" FROM "table_name_16" WHERE "date" = "may 20"
0.060547
CREATE TABLE table_7443 ("Position" FLOAT, "Team" TEXT, "Points" FLOAT, "Played" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "Against" FLOAT, "Difference" TEXT)
Which Against has a Drawn smaller than 5, a Lost of 3, and a Position of 3?
SELECT MIN("Against") FROM table_7443 WHERE "Drawn" < '5' AND "Lost" = '3' AND "Position" = '3'
SELECT MIN("Against") FROM "table_7443" WHERE "Drawn" < '5' AND "Lost" = '3' AND "Position" = '3'
0.094727
CREATE TABLE table_name_84 (away_team VARCHAR, venue VARCHAR)
How much did the away team score at Victoria park?
SELECT away_team AS score FROM table_name_84 WHERE venue = "victoria park"
SELECT "away_team" AS "score" FROM "table_name_84" WHERE "venue" = "victoria park"
0.080078
CREATE TABLE table_name_86 (hits VARCHAR, year INT)
Name the hits for years before 1883
SELECT hits FROM table_name_86 WHERE year < 1883
SELECT "hits" FROM "table_name_86" WHERE "year" < 1883
0.052734
CREATE TABLE table_203_574 (id DECIMAL, "track number" DECIMAL, "russian title" TEXT, "english title" TEXT, "music" TEXT, "lyrics" TEXT)
what is the last track on the album smile ! ?
SELECT "english title" FROM table_203_574 ORDER BY "track number" DESC LIMIT 1
SELECT "english title" FROM "table_203_574" ORDER BY "track number" DESC NULLS LAST LIMIT 1
0.088867
CREATE TABLE table_142573_1 (clock_rate__mhz_ INT)
Name the maximum clock rate mhz
SELECT MAX(clock_rate__mhz_) FROM table_142573_1
SELECT MAX("clock_rate__mhz_") FROM "table_142573_1"
0.050781
CREATE TABLE table_name_35 (name VARCHAR, roll VARCHAR)
Who has a roll value of 422?
SELECT name FROM table_name_35 WHERE roll = 422
SELECT "name" FROM "table_name_35" WHERE "roll" = 422
0.051758
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
how many patients whose age is less than 81 and drug route is iv bolus?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "81" AND prescriptions.route = "IV BOLUS"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "IV BOLUS" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "81" > "demographic"."age"
0.212891
CREATE TABLE artist (Artist_ID INT, Name TEXT, Country TEXT, Year_Join INT, Age INT) CREATE TABLE exhibition (Exhibition_ID INT, Year INT, Theme TEXT, Artist_ID INT, Ticket_Price FLOAT) CREATE TABLE exhibition_record (Exhibition_ID INT, Date TEXT, Attendance INT)
Find those years for all exhibitions with ticket prices lower than 15, return a bar chart that groups by year and counts the total number of years.
SELECT Year, COUNT(Year) FROM exhibition WHERE Ticket_Price < 15 GROUP BY Year
SELECT "Year", COUNT("Year") FROM "exhibition" WHERE "Ticket_Price" < 15 GROUP BY "Year"
0.085938
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 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 the number of elective hospital admission patients who have personal history of malignant neoplasm of rectum, rectosigmoid junction, and anus diagnoses?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND diagnoses.long_title = "Personal history of malignant neoplasm of rectum, rectosigmoid junction, and anus"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Personal history of malignant neoplasm of rectum, rectosigmoid junction, and anus" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "ELECTIVE" = "demographic"."admission_type"
0.293945
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_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 patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE 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 transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_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 labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE 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)
has patient 5310 been administered any d10w during the last month?
SELECT COUNT(*) > 0 FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5310)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'd10w' AND d_items.linksto = 'inputevents_cv') AND DATETIME(inputevents_cv.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month')
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 5310 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'd10w' AND "d_items"."linksto" = 'inputevents_cv' GROUP BY "itemid") SELECT COUNT(*) > 0 FROM "inputevents_cv" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "inputevents_cv"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "inputevents_cv"."itemid" WHERE DATETIME("inputevents_cv"."charttime", 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL
0.77832
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime 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 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) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE 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 vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME)
on this hospital visit, when patient 031-3355 had the last other microbiology test?
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355' AND patient.hospitaldischargetime IS NULL)) AND microlab.culturesite = 'other' ORDER BY microlab.culturetakentime DESC LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."hospitaldischargetime" IS NULL AND "patient"."uniquepid" = '031-3355' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT "microlab"."culturetakentime" FROM "microlab" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "microlab"."patientunitstayid" WHERE "microlab"."culturesite" = 'other' AND NOT "_u_1"."" IS NULL ORDER BY "microlab"."culturetakentime" DESC NULLS LAST LIMIT 1
0.642578
CREATE TABLE supplier_addresses (supplier_id DECIMAL, address_id DECIMAL, date_from TIME, date_to TIME) CREATE TABLE departments (department_id DECIMAL, dept_store_id DECIMAL, department_name TEXT) 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 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 staff (staff_id DECIMAL, staff_gender TEXT, staff_name TEXT) CREATE TABLE addresses (address_id DECIMAL, address_details TEXT) 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 staff_department_assignments (staff_id DECIMAL, department_id DECIMAL, date_assigned_from TIME, job_title_code TEXT, date_assigned_to TIME) CREATE TABLE products (product_id DECIMAL, product_type_code TEXT, product_name TEXT, product_price DECIMAL) CREATE TABLE suppliers (supplier_id DECIMAL, supplier_name TEXT, supplier_phone TEXT) 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 customer_orders (order_id DECIMAL, customer_id DECIMAL, order_status_code TEXT, order_date TIME) CREATE TABLE department_store_chain (dept_store_chain_id DECIMAL, dept_store_chain_name TEXT)
Give the id and product type of the product with the lowest price.
SELECT product_id, product_type_code FROM products ORDER BY product_price LIMIT 1
SELECT "product_id", "product_type_code" FROM "products" ORDER BY "product_price" NULLS FIRST LIMIT 1
0.098633
CREATE TABLE language (language_id DECIMAL, name TEXT, last_update TIME) CREATE TABLE film (film_id DECIMAL, title TEXT, description TEXT, release_year TIME, language_id DECIMAL, original_language_id DECIMAL, rental_duration DECIMAL, rental_rate DECIMAL, length DECIMAL, replacement_cost DECIMAL, rating TEXT, special_features TEXT, last_update TIME) CREATE TABLE actor (actor_id DECIMAL, first_name TEXT, last_name TEXT, last_update TIME) CREATE TABLE staff (staff_id DECIMAL, first_name TEXT, last_name TEXT, address_id DECIMAL, picture others, email TEXT, store_id DECIMAL, active BOOLEAN, username TEXT, password TEXT, last_update TIME) CREATE TABLE rental (rental_id DECIMAL, rental_date TIME, inventory_id DECIMAL, customer_id DECIMAL, return_date TIME, staff_id DECIMAL, last_update TIME) CREATE TABLE film_actor (actor_id DECIMAL, film_id DECIMAL, last_update TIME) CREATE TABLE store (store_id DECIMAL, manager_staff_id DECIMAL, address_id DECIMAL, last_update TIME) CREATE TABLE address (address_id DECIMAL, address TEXT, address2 TEXT, district TEXT, city_id DECIMAL, postal_code TEXT, phone TEXT, last_update TIME) CREATE TABLE customer (customer_id DECIMAL, store_id DECIMAL, first_name TEXT, last_name TEXT, email TEXT, address_id DECIMAL, active BOOLEAN, create_date TIME, last_update TIME) CREATE TABLE country (country_id DECIMAL, country TEXT, last_update TIME) CREATE TABLE film_category (film_id DECIMAL, category_id DECIMAL, last_update TIME) CREATE TABLE category (category_id DECIMAL, name TEXT, last_update TIME) CREATE TABLE inventory (inventory_id DECIMAL, film_id DECIMAL, store_id DECIMAL, last_update TIME) CREATE TABLE payment (payment_id DECIMAL, customer_id DECIMAL, staff_id DECIMAL, rental_id DECIMAL, amount DECIMAL, payment_date TIME, last_update TIME) CREATE TABLE film_text (film_id DECIMAL, title TEXT, description TEXT) CREATE TABLE city (city_id DECIMAL, city TEXT, country_id DECIMAL, last_update TIME)
Which movies have 'Deleted Scenes' as a substring in the special feature?
SELECT title FROM film WHERE special_features LIKE '%Deleted Scenes%'
SELECT "title" FROM "film" WHERE "special_features" LIKE '%Deleted Scenes%'
0.073242
CREATE TABLE table_name_68 (length VARCHAR, version VARCHAR)
What is the length of the UK remix version?
SELECT length FROM table_name_68 WHERE version = "uk remix"
SELECT "length" FROM "table_name_68" WHERE "uk remix" = "version"
0.063477
CREATE TABLE table_6982 ("Rank" FLOAT, "Celebrity" TEXT, "Professional Partner" TEXT, "Season" FLOAT, "Average" FLOAT)
Who is the professional partner of celebrity ma gorzata foremniak with a season less than 7, an average greater than 34.66, and a rank less than 10?
SELECT "Professional Partner" FROM table_6982 WHERE "Season" < '7' AND "Average" > '34.66' AND "Rank" < '10' AND "Celebrity" = 'małgorzata foremniak'
SELECT "Professional Partner" FROM "table_6982" WHERE "Average" > '34.66' AND "Celebrity" = 'małgorzata foremniak' AND "Rank" < '10' AND "Season" < '7'
0.147461
CREATE TABLE table_1805 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "Prod. code" TEXT, "Viewers ( millions ) " TEXT)
What's the production code of the episode titled 'Got to get her out of my house'?
SELECT "Prod. code" FROM table_1805 WHERE "Title" = 'Got to Get Her Out of My House'
SELECT "Prod. code" FROM "table_1805" WHERE "Title" = 'Got to Get Her Out of My House'
0.083984
CREATE TABLE table_204_218 (id DECIMAL, "name" TEXT, "faith" TEXT, "type" TEXT, "gov" TEXT, "opened" DECIMAL, "intake" DECIMAL, "dcsf number" DECIMAL, "ofsted number" DECIMAL, "web" TEXT, "coordinates" TEXT)
count the number of schools with cy governments .
SELECT COUNT(*) FROM table_204_218 WHERE "gov" = 'cy'
SELECT COUNT(*) FROM "table_204_218" WHERE "gov" = 'cy'
0.053711
CREATE TABLE table_5410 ("Date" TEXT, "Venue" TEXT, "Score" TEXT, "Result" TEXT, "Competition" TEXT)
What was the result of the 2007 gulf cup of nations?
SELECT "Result" FROM table_5410 WHERE "Competition" = '2007 gulf cup of nations'
SELECT "Result" FROM "table_5410" WHERE "Competition" = '2007 gulf cup of nations'
0.080078
CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note 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 time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE flight_fare (flight_id INT, fare_id 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 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 city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) 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 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 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 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 days (days_code VARCHAR, day_name VARCHAR) 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 code_description (code VARCHAR, description TEXT) CREATE TABLE compartment_class (compartment VARCHAR, class_type 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 ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare 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)
list all AA from MILWAUKEE to PHOENIX on saturday
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 = 'PHOENIX' 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 = 'MILWAUKEE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.airline_code = 'AA'
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "date_day" ON "date_day"."day_number" = 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" = 'MILWAUKEE' JOIN "days" ON "date_day"."day_name" = "days"."day_name" JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "days"."days_code" = "flight"."flight_days" AND "flight"."airline_code" = 'AA' JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'PHOENIX'
0.741211
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) 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 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 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 microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME)
have patient 59275 got admitted to the hospital until 1 year ago?
SELECT COUNT(*) > 0 FROM admissions WHERE admissions.subject_id = 59275 AND DATETIME(admissions.admittime) <= DATETIME(CURRENT_TIME(), '-1 year')
SELECT COUNT(*) > 0 FROM "admissions" WHERE "admissions"."subject_id" = 59275 AND DATETIME("admissions"."admittime") <= DATETIME(CURRENT_TIME(), '-1 year')
0.151367
CREATE TABLE table_23170118_2 (title VARCHAR, villains VARCHAR)
What was the title of the episode where reg lacey (aka mr. b) played the villain?
SELECT title FROM table_23170118_2 WHERE villains = "Reg Lacey (AKA Mr. B)"
SELECT "title" FROM "table_23170118_2" WHERE "Reg Lacey (AKA Mr. B)" = "villains"
0.079102
CREATE TABLE injury_accident (game_id INT, id INT, Player TEXT, Injury TEXT, Number_of_matches TEXT, Source TEXT) CREATE TABLE game (stadium_id INT, id INT, Season INT, Date TEXT, Home_team TEXT, Away_team TEXT, Score TEXT, Competition TEXT) CREATE TABLE stadium (id INT, name TEXT, Home_Games INT, Average_Attendance FLOAT, Total_Attendance FLOAT, Capacity_Percentage FLOAT)
Bar chart x axis away team y axis the number of away team, I want to rank by the y-axis from high to low.
SELECT Away_team, COUNT(Away_team) FROM game GROUP BY Away_team ORDER BY COUNT(Away_team) DESC
SELECT "Away_team", COUNT("Away_team") FROM "game" GROUP BY "Away_team" ORDER BY COUNT("Away_team") DESC NULLS LAST
0.112305
CREATE TABLE table_10838 ("Rank" FLOAT, "Constituency" TEXT, "Winning party 2007" TEXT, "Swing to gain" FLOAT, "PC's place 2007" TEXT, "Result" TEXT)
What's the sum of swing to gain with a winning party 2007 of Conservative with a rank smaller than 5?
SELECT SUM("Swing to gain") FROM table_10838 WHERE "Winning party 2007" = 'conservative' AND "Rank" < '5'
SELECT SUM("Swing to gain") FROM "table_10838" WHERE "Rank" < '5' AND "Winning party 2007" = 'conservative'
0.104492
CREATE TABLE table_16592 ("Finishing position" TEXT, "Points awarded ( Platinum ) " FLOAT, "Points awarded ( Gold ) " FLOAT, "Points awarded ( Silver ) " FLOAT, "Points awarded ( Satellite ) " FLOAT)
How many platinum points were awarded for 5th place?
SELECT MAX("Points awarded (Platinum)") FROM table_16592 WHERE "Finishing position" = '5th'
SELECT MAX("Points awarded (Platinum)") FROM "table_16592" WHERE "Finishing position" = '5th'
0.09082
CREATE TABLE table_10926 ("Model" TEXT, "FSB ( MHz ) " TEXT, "Chipset" TEXT, "Memory" TEXT, "Graphics" TEXT)
What is the chipset in the Precision 340 model that has the rambus memory and 400 or 533 FSB (MHz)?
SELECT "Chipset" FROM table_10926 WHERE "Memory" = 'rambus' AND "FSB (MHz)" = '400 or 533' AND "Model" = 'precision 340'
SELECT "Chipset" FROM "table_10926" WHERE "FSB (MHz)" = '400 or 533' AND "Memory" = 'rambus' AND "Model" = 'precision 340'
0.119141
CREATE TABLE table_name_64 (date VARCHAR, opponents VARCHAR)
Name the date for zi yan jie zheng opponent
SELECT date FROM table_name_64 WHERE opponents = "zi yan jie zheng"
SELECT "date" FROM "table_name_64" WHERE "opponents" = "zi yan jie zheng"
0.071289
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) 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)
what is drug type of drug name nafcillin?
SELECT prescriptions.drug_type FROM prescriptions WHERE prescriptions.drug = "Nafcillin"
SELECT "prescriptions"."drug_type" FROM "prescriptions" WHERE "Nafcillin" = "prescriptions"."drug"
0.095703
CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME 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 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 departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL)
For all employees who have the letters D or S in their first name, show me about the correlation between salary and commission_pct in a scatter chart.
SELECT SALARY, COMMISSION_PCT FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
SELECT "SALARY", "COMMISSION_PCT" FROM "employees" WHERE "FIRST_NAME" LIKE '%D%' OR "FIRST_NAME" LIKE '%S%'
0.104492
CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) 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 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 treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME)
count the number of times that patient 030-49739 had received an tv lab test during this year.
SELECT COUNT(*) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-49739')) AND lab.labname = 'tv' AND DATETIME(lab.labresulttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '030-49739' 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 "lab" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "lab"."patientunitstayid" WHERE "lab"."labname" = 'tv' AND DATETIME("lab"."labresulttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND NOT "_u_1"."" IS NULL
0.600586
CREATE TABLE table_28938 ("District" TEXT, "Incumbent" TEXT, "Party" TEXT, "First elected" TEXT, "Result" TEXT, "Candidates" TEXT)
Name the district for matthew clay
SELECT "District" FROM table_28938 WHERE "Incumbent" = 'Matthew Clay'
SELECT "District" FROM "table_28938" WHERE "Incumbent" = 'Matthew Clay'
0.069336
CREATE TABLE table_12937 ("Driver" TEXT, "Team" TEXT, "Laps" FLOAT, "Time/Retired" TEXT, "Grid" FLOAT, "Points" FLOAT)
What team has 0 points and a contact tired/retired, and 71 laps?
SELECT "Team" FROM table_12937 WHERE "Points" = '0' AND "Time/Retired" = 'contact' AND "Laps" = '71'
SELECT "Team" FROM "table_12937" WHERE "Laps" = '71' AND "Points" = '0' AND "Time/Retired" = 'contact'
0.099609
CREATE TABLE table_14050 ("Event" TEXT, "Record" TEXT, "Nationality" TEXT, "Date" TEXT, "Games" TEXT)
What's the record of Barbados?
SELECT "Record" FROM table_14050 WHERE "Nationality" = 'barbados'
SELECT "Record" FROM "table_14050" WHERE "Nationality" = 'barbados'
0.06543
CREATE TABLE table_67944 ("Date" TEXT, "Round" TEXT, "Opponents" TEXT, "Result F\\u2013A" TEXT, "Attendance" FLOAT)
Name the attendance for 4 january 2004
SELECT "Attendance" FROM table_67944 WHERE "Date" = '4 january 2004'
SELECT "Attendance" FROM "table_67944" WHERE "Date" = '4 january 2004'
0.068359
CREATE TABLE table_1770 ("Parish ( Prestegjeld ) " TEXT, "Sub-Parish ( Sogn ) " TEXT, "Church Name" TEXT, "Year Built" FLOAT, "Location of the Church" TEXT)
What is the church name for the church located in Kyrkjeb ?
SELECT "Church Name" FROM table_1770 WHERE "Location of the Church" = 'Kyrkjebø'
SELECT "Church Name" FROM "table_1770" WHERE "Location of the Church" = 'Kyrkjebø'
0.080078
CREATE TABLE ref_colors (color_code TEXT, color_description TEXT) CREATE TABLE characteristics (characteristic_id DECIMAL, characteristic_type_code TEXT, characteristic_data_type TEXT, characteristic_name TEXT, other_characteristic_details TEXT) CREATE TABLE product_characteristics (product_id DECIMAL, characteristic_id DECIMAL, product_characteristic_value TEXT) CREATE TABLE products (product_id DECIMAL, color_code TEXT, product_category_code TEXT, product_name TEXT, typical_buying_price TEXT, typical_selling_price TEXT, product_description TEXT, other_product_details TEXT) CREATE TABLE ref_product_categories (product_category_code TEXT, product_category_description TEXT, unit_of_measure TEXT) CREATE TABLE ref_characteristic_types (characteristic_type_code TEXT, characteristic_type_description TEXT)
What are the descriptions for each color?
SELECT color_description FROM ref_colors
SELECT "color_description" FROM "ref_colors"
0.042969
CREATE TABLE university (School_ID INT, School TEXT, Location TEXT, Founded FLOAT, Affiliation TEXT, Enrollment FLOAT, Nickname TEXT, Primary_conference TEXT) CREATE TABLE basketball_match (Team_ID INT, School_ID INT, Team_Name TEXT, ACC_Regular_Season TEXT, ACC_Percent TEXT, ACC_Home TEXT, ACC_Road TEXT, All_Games TEXT, All_Games_Percent INT, All_Home TEXT, All_Road TEXT, All_Neutral TEXT)
Show me about the distribution of All_Neutral and Team_ID in a bar chart, list in ascending by the names.
SELECT All_Neutral, Team_ID FROM basketball_match ORDER BY All_Neutral
SELECT "All_Neutral", "Team_ID" FROM "basketball_match" ORDER BY "All_Neutral" NULLS FIRST
0.087891
CREATE TABLE table_10065 ("Railway" TEXT, "Builder" TEXT, "Built" TEXT, "Wheels" TEXT, "Location" TEXT, "ObjectNumber" TEXT)
What is the Object Number for the item with wheels 4-4-0 and a location of Barrow Hill?
SELECT "ObjectNumber" FROM table_10065 WHERE "Location" = 'barrow hill' AND "Wheels" = '4-4-0'
SELECT "ObjectNumber" FROM "table_10065" WHERE "Location" = 'barrow hill' AND "Wheels" = '4-4-0'
0.09375
CREATE TABLE table_1281 ("Mission name" TEXT, "Lunar lander" TEXT, "Lunar landing date" TEXT, "Lunar blastoff date" TEXT, "Lunar landing site" TEXT, "Duration on lunar surface" TEXT, "Crew" TEXT, "Number of s EVA" FLOAT, "Total EVA Time ( HH:MM ) " TEXT)
Name the mission name for ocean of storms
SELECT "Mission name" FROM table_1281 WHERE "Lunar landing site" = 'Ocean of Storms'
SELECT "Mission name" FROM "table_1281" WHERE "Lunar landing site" = 'Ocean of Storms'
0.083984
CREATE TABLE game (stadium_id INT, id INT, Season INT, Date TEXT, Home_team TEXT, Away_team TEXT, Score TEXT, Competition TEXT) CREATE TABLE injury_accident (game_id INT, id INT, Player TEXT, Injury TEXT, Number_of_matches TEXT, Source TEXT) CREATE TABLE stadium (id INT, name TEXT, Home_Games INT, Average_Attendance FLOAT, Total_Attendance FLOAT, Capacity_Percentage FLOAT)
I want to see trend the number of season over season by Home_team, and show x-axis in ascending order.
SELECT Season, COUNT(Season) FROM game GROUP BY Home_team, Season ORDER BY Season
SELECT "Season", COUNT("Season") FROM "game" GROUP BY "Home_team", "Season" ORDER BY "Season" NULLS FIRST
0.102539
CREATE TABLE table_name_98 (us_rap VARCHAR, album VARCHAR)
What is the U.S. Rap chart number of the album west coast bad boyz, vol. 3: poppin' collars?
SELECT us_rap FROM table_name_98 WHERE album = "west coast bad boyz, vol. 3: poppin' collars"
SELECT "us_rap" FROM "table_name_98" WHERE "album" = "west coast bad boyz, vol. 3: poppin' collars"
0.09668