table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE table_27713030_12 ( high_points VARCHAR, date VARCHAR )
What were the high points on April 8?
SELECT high_points FROM table_27713030_12 WHERE date = "April 8"
CREATE TABLE table_name_71 ( date VARCHAR, home_team VARCHAR )
If collingwood was the Home team, what Date did they play?
SELECT date FROM table_name_71 WHERE home_team = "collingwood"
CREATE TABLE table_name_97 ( pick__number VARCHAR, position VARCHAR, player VARCHAR )
What was the pick# for Lorenzo Freeman as defensive tackle?
SELECT pick__number FROM table_name_97 WHERE position = "defensive tackle" AND player = "lorenzo freeman"
CREATE TABLE table_24399615_5 ( cable_rank VARCHAR, episode_no VARCHAR )
How many times did episode number 8 air?
SELECT COUNT(cable_rank) FROM table_24399615_5 WHERE episode_no = 8
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
what were the three most frequently ordered microbiology tests for patients that had previous laxatives - doss (colace) within 2 months in 2105?
SELECT t3.culturesite FROM (SELECT t2.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'laxatives - doss (colace)' AND STRFTIME('%y'...
CREATE TABLE table_9414 ( "Round" real, "Pick" real, "Player" text, "Position" text, "Nationality" text, "School/Club Team" text )
What is the pick for the Maryland-Eastern Shore team with a round lower than 2?
SELECT SUM("Pick") FROM table_9414 WHERE "School/Club Team" = 'maryland-eastern shore' AND "Round" < '2'
CREATE TABLE table_21256068_3 ( score VARCHAR, opponent VARCHAR )
what's the score against crusaders
SELECT score FROM table_21256068_3 WHERE opponent = "Crusaders"
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 t...
what is admission location of subject name thomas nazario?
SELECT demographic.admission_location FROM demographic WHERE demographic.name = "Thomas Nazario"
CREATE TABLE table_15272 ( "Rank" real, "Lane" real, "Name" text, "Nationality" text, "Time" real )
Name the sum of time for lane of 1 and rank less than 8
SELECT SUM("Time") FROM table_15272 WHERE "Lane" = '1' AND "Rank" < '8'
CREATE TABLE table_65845 ( "Draw" real, "Artist" text, "Song" text, "Points" real, "Place" real )
What is the number of points for the song 'viva rock 'n' roll', with more than 3 Draws?
SELECT AVG("Points") FROM table_65845 WHERE "Song" = 'viva rock ''n'' roll' AND "Draw" > '3'
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 ) C...
calculate the total number of patients treated with sertraline
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Sertraline"
CREATE TABLE table_name_8 ( gold_coast VARCHAR, melbourne VARCHAR, auckland VARCHAR )
Which Gold Coast has Melbourne yes, and Auckland yes?
SELECT gold_coast FROM table_name_8 WHERE melbourne = "yes" AND auckland = "yes"
CREATE TABLE table_17787 ( "Day" text, "Sunday Surya (the Sun)" text, "Monday Soma (the Moon)" text, "Tuesday Mangala (Mars)" text, "Wednesday Budha (Mercury)" text, "Thursday Guru (Jupiter)" text, "Friday Shukra (Venus)" text, "Saturday Shani (Saturn)" text )
In language where Wednesday is budh'var, what is Saturday?
SELECT "Saturday Shani (Saturn)" FROM table_17787 WHERE "Wednesday Budha (Mercury)" = 'برھ وار Budh''var'
CREATE TABLE table_204_763 ( id number, "county" text, "km" number, "intersecting road" text, "notes" text, "coordinates" text )
which intersecting road comes before range road 273 ?
SELECT "intersecting road" FROM table_204_763 WHERE id = (SELECT id FROM table_204_763 WHERE "intersecting road" = 'range road 273') - 1
CREATE TABLE table_train_251 ( "id" int, "gender" string, "left_ventricular_ejection_fraction_lvef" int, "allergy_to_rabbit_proteins" bool, "recurring_alcohol_related_legal_problem" bool, "hyperlipidemia" bool, "fasting_ldl_cholesterol" int, "baseline_hemoglobin_hgb" float, "NOUSE" f...
recurring alcohol _ related legal problem
SELECT * FROM table_train_251 WHERE recurring_alcohol_related_legal_problem = 1
CREATE TABLE table_48025 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is To Par, when Score is '69-72=141
SELECT "To par" FROM table_48025 WHERE "Score" = '69-72=141'
CREATE TABLE table_name_74 ( employed VARCHAR, position_held VARCHAR )
What are the years employed shown for mathematics & prefect master?
SELECT employed FROM table_name_74 WHERE position_held = "mathematics & prefect master"
CREATE TABLE table_9492 ( "Outcome" text, "Date" real, "Tournament" text, "Surface" text, "Partner" text, "Opponents in the final" text, "Score in the final" text )
What is the total number of Date, when Partner is 'Carl-Uwe Steeb'?
SELECT COUNT("Date") FROM table_9492 WHERE "Partner" = 'carl-uwe steeb'
CREATE TABLE table_30825 ( "Conference" text, "Regular Season Winner" text, "Conference Player of the Year" text, "Conference Tournament" text, "Tournament Venue (City)" text, "Tournament Winner" text )
Who was the tournament winner in the Southwestern Athletic Conference?
SELECT "Tournament Winner" FROM table_30825 WHERE "Conference" = 'Southwestern Athletic Conference'
CREATE TABLE table_name_56 ( position VARCHAR, club_province VARCHAR )
What is the position of Perpignan?
SELECT position FROM table_name_56 WHERE club_province = "perpignan"
CREATE TABLE table_name_93 ( total VARCHAR, gold VARCHAR, silver VARCHAR, bronze VARCHAR )
Which Total has a Silver larger than 8, and a Bronze of 20, and a Gold smaller than 20?
SELECT COUNT(total) FROM table_name_93 WHERE silver > 8 AND bronze = 20 AND gold < 20
CREATE TABLE Order_Items ( order_item_id INTEGER, order_id INTEGER, product_id INTEGER, order_quantity VARCHAR(80) ) CREATE TABLE Customer_Address_History ( customer_id INTEGER, address_id INTEGER, date_from DATETIME, date_to DATETIME ) CREATE TABLE Contacts ( contact_id INTEGER, ...
Show the number of customer address history in each day and bin date to by weekday with a bar chart, and could you order y axis in ascending order?
SELECT date_to, COUNT(date_to) FROM Customer_Address_History AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id JOIN Addresses AS T3 ON T1.address_id = T3.address_id ORDER BY COUNT(date_to)
CREATE TABLE musical ( musical_id number, name text, year number, award text, category text, nominee text, result text ) CREATE TABLE actor ( actor_id number, name text, musical_id number, character text, duration text, age number )
What are the names of musicals who have at 3 or more actors?
SELECT T2.name FROM actor AS T1 JOIN musical AS T2 ON T1.musical_id = T2.musical_id GROUP BY T1.musical_id HAVING COUNT(*) >= 3
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, ...
what are the three most common drugs prescribed to patients with age 40s within 2 months after they were diagnosed with anemia nos, since 4 years ago?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ...
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE employees ( EMPLO...
For those employees who was hired before 2002-06-21, a bar chart shows the distribution of hire_date and the average of department_id bin hire_date by weekday, list by the Y in ascending please.
SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY AVG(DEPARTMENT_ID)
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 flight ( aircraft_code_sequence text, airline_code varchar, airline_fli...
flight from SALT LAKE CITY to OAKLAND CALIFORNIA
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, state WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SALT LAKE CITY' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_...
CREATE TABLE table_17904 ( "Series number" text, "Episode number" real, "Date of first broadcast" text, "Total viewers" real, "Series average" real )
what is the total viewers where the date of first broadcast is 28 january 2010 and the episode number is 1?
SELECT MIN("Total viewers") FROM table_17904 WHERE "Date of first broadcast" = '28 January 2010' AND "Episode number" = '1'
CREATE TABLE table_34597 ( "Number" real, "Name" text, "Position" text, "Height" text, "Weight" real, "Class" text, "Hometown" text )
Weight of 220 has what class?
SELECT "Class" FROM table_34597 WHERE "Weight" = '220'
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, ...
when did patient 010-11305 for the last time leave the hospital until 2101?
SELECT patient.hospitaldischargetime FROM patient WHERE patient.uniquepid = '010-11305' AND STRFTIME('%y', patient.hospitaldischargetime) <= '2101' ORDER BY patient.hospitaldischargetime DESC LIMIT 1
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE microlab ( microlabid number, patient...
since 4 years ago, what was the last hospital admission time of patient 028-23341 via the recovery room?
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '028-23341' AND patient.hospitaladmitsource = 'recovery room' AND DATETIME(patient.hospitaladmittime) >= DATETIME(CURRENT_TIME(), '-4 year') ORDER BY patient.hospitaladmittime DESC LIMIT 1
CREATE TABLE table_name_9 ( run_2 VARCHAR, rank VARCHAR )
Which Run 2 has a Rank of 4?
SELECT run_2 FROM table_name_9 WHERE rank = "4"
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE class_of_servi...
what price is a LIMOUSINE service to NEW YORK 's LGA
SELECT DISTINCT ground_service.ground_fare FROM airport, city, ground_service WHERE (airport.airport_code = 'LGA' AND city.city_name = 'NEW YORK' AND ground_service.airport_code = airport.airport_code AND ground_service.city_code = city.city_code) AND ground_service.transport_type = 'LIMOUSINE'
CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT ) CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT ) CREATE TABLE trip ( id INTEGER, d...
Create a bar chart showing the total number across city
SELECT city, COUNT(*) FROM station GROUP BY city
CREATE TABLE table_71837 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text )
Name the average attendance with dallas visitor
SELECT AVG("Attendance") FROM table_71837 WHERE "Visitor" = 'dallas'
CREATE TABLE useracct ( u_id VARCHAR ) CREATE TABLE review ( u_id VARCHAR )
Find the number of users who did not write any review.
SELECT COUNT(*) FROM useracct WHERE NOT u_id IN (SELECT u_id FROM review)
CREATE TABLE table_200_47 ( id number, "date" text, "event" text, "duration\t\n(months)" text, "duration\t\t\n(years)" text )
when did the first drop in the experiment fall ?
SELECT "date" FROM table_200_47 WHERE "event" = '1st drop fell'
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 aircraft ( ...
i need information on flights between ST. PETERSBURG and CHARLOTTE
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ST. PETERSBURG' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = ...
CREATE TABLE table_36422 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Save" text, "Record" text )
What was the Record on September 21?
SELECT "Record" FROM table_36422 WHERE "Date" = 'september 21'
CREATE TABLE table_13006 ( "Mountain" text, "Height (m)" real, "Height (ft)" real, "Range" text, "Prominence (m)" real, "Parent mountain" text, "First ascent" text )
What is the largest height when the prominence is 3,118?
SELECT MAX("Height (m)") FROM table_13006 WHERE "Prominence (m)" = '3,118'
CREATE TABLE table_11570261_2 ( margin_of_victory VARCHAR, runner_s__up VARCHAR )
What was the margin of victory over Justin Leonard, phillip price?
SELECT COUNT(margin_of_victory) FROM table_11570261_2 WHERE runner_s__up = "Justin Leonard, Phillip Price"
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAno...
Questions which had given tag (included the editor who added it).
WITH firstrev_cte AS (SELECT p.Id AS pid, MIN(ph.Id) AS MinId FROM PostHistory AS ph INNER JOIN Posts AS p ON ph.PostId = p.Id WHERE ph.PostHistoryTypeId IN (3, 6, 9) AND ph.Text LIKE '%<##tagName##>%' GROUP BY p.Id) SELECT pid AS "post_link", url = 'site://posts/' + CAST(PostId AS TEXT) + '/revisions', UserId AS "user...
CREATE TABLE table_name_41 ( place VARCHAR, country VARCHAR, player VARCHAR )
What is Place, when Country is 'United States', and when Player is 'Lee Trevino'?
SELECT place FROM table_name_41 WHERE country = "united states" AND player = "lee trevino"
CREATE TABLE table_name_65 ( English VARCHAR, winning_song VARCHAR )
Which winning song was sung by aku tetap milikmu?
SELECT WINNING_SONG(English AS Title) FROM table_name_65 WHERE winning_song = "aku tetap milikmu"
CREATE TABLE table_58028 ( "Year" real, "Tournament" text, "Venue" text, "Result" text, "Extra" text )
In what tournament was there an extra of 400 m hurdles?
SELECT "Tournament" FROM table_58028 WHERE "Extra" = '400 m hurdles'
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), ...
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about employee_id over the last_name by a bar chart, could you display from high to low by the Y-axis?
SELECT LAST_NAME, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMPLOYEE_ID DESC
CREATE TABLE table_26048 ( "Years led" text, "Span of years led" real, "Player" text, "Titles won at point of lead" real, "Total Career titles" real, "Tournament at which lead began" text )
At which tournament did william renshaw begin his lead when he had won 7 titles?
SELECT "Tournament at which lead began" FROM table_26048 WHERE "Player" = 'William Renshaw' AND "Titles won at point of lead" = '7'
CREATE TABLE table_204_846 ( id number, "tie no" number, "home team" text, "score" text, "away team" text, "attendance" number )
which tie number did not have any attendance ?
SELECT "tie no" FROM table_204_846 WHERE "attendance" IS NULL
CREATE TABLE table_24027 ( "Ep." real, "Season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Prod. Code" text )
How many episodes had a production code of 5m13?
SELECT COUNT("Ep.") FROM table_24027 WHERE "Prod. Code" = '5M13'
CREATE TABLE table_61659 ( "7:00 am" text, "7:30 am" text, "8:00 am" text, "9:00 am" text, "10:00 am" text, "11:00 am" text, "noon" text, "12:30 pm" text, "1:00 pm" text, "1:30 pm" text, "2:00 pm" text, "3:00 pm" text, "3:30 pm" text, "4:00 pm" text, "4:30 pm"...
WHAT IS THE 4:30PM WITH AN 8:00AM CBS THIS MORNING?
SELECT "4:30 pm" FROM table_61659 WHERE "8:00 am" = 'cbs this morning'
CREATE TABLE table_71100 ( "Language" text, "Number" text, "percentage (%)" text, "males" text, "females" text )
What was the number of males that had the number females 62 331?
SELECT "males" FROM table_71100 WHERE "females" = '62 331'
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,...
tell me both the short title and long title of diagnoses for patient josette orr.
SELECT diagnoses.short_title, diagnoses.long_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Josette Orr"
CREATE TABLE table_10975034_4 ( player VARCHAR, pick__number VARCHAR )
Which players have a pick number of 27?
SELECT player FROM table_10975034_4 WHERE pick__number = 27
CREATE TABLE table_31250 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real )
What is the original air date of the episode that was directed by Bruce Seth Green?
SELECT "Original air date" FROM table_31250 WHERE "Directed by" = 'Bruce Seth Green'
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 prescriptions...
Count the number of patients admitted to the hospital before year 2157 whose procedure long title is open reduction of fracture with internal fixation, femur.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2157" AND procedures.long_title = "Open reduction of fracture with internal fixation, femur"
CREATE TABLE table_21748 ( "Branding" text, "Callsign" text, "Frequency" text, "Power (kW)" text, "Location" text )
How many locations have the call signs dxjp-fm?
SELECT COUNT("Location") FROM table_21748 WHERE "Callsign" = 'DXJP-FM'
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
when has patient 59275 first had the minimum value of rdw until 40 months ago?
SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 59275) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'rdw') AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME(), '-40 month'...
CREATE TABLE table_name_93 ( overall INTEGER, position VARCHAR, round VARCHAR )
What is the lowest Overall for the wide receiver in a round less than 2?
SELECT MIN(overall) FROM table_name_93 WHERE position = "wide receiver" AND round < 2
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, ni...
show me times for flights from SAN FRANCISCO to ATLANTA
SELECT DISTINCT flight.arrival_time, flight.departure_time FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_cod...
CREATE TABLE table_261642_3 ( frequency__hz_ VARCHAR, g__μs_km_ VARCHAR )
what is the frequency (hz) when the g ( s/km) is 53.205?
SELECT frequency__hz_ FROM table_261642_3 WHERE g__μs_km_ = "53.205"
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code tex...
tell me the maximum cost for a hospital with cerebral mass of unknown etiology?
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'cerebral mass of unknown etiology')) GROUP B...
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, ...
when was the first time patient 26799 was having less than 18.0 respiratory rate on 09/20/last year?
SELECT chartevents.charttime FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26799)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'respirat...
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE d_icd_procedures ( ...
until 2104 how many patients were diagnosed with cor ath unsp vsl ntv/gft and didn't come back to the hospital within 2 months?
SELECT (SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'cor ath un...
CREATE TABLE table_29635868_1 ( object_date VARCHAR, origin VARCHAR )
How many object dates have origin in Samoa?
SELECT COUNT(object_date) FROM table_29635868_1 WHERE origin = "Samoa"
CREATE TABLE Staff ( staff_id INTEGER, staff_first_name VARCHAR(80), staff_last_name VARCHAR(80), other_staff_details VARCHAR(255) ) CREATE TABLE Product ( product_id INTEGER, product_name VARCHAR(80), product_details VARCHAR(255) ) CREATE TABLE Problem_Log ( problem_log_id INTEGER, ...
For the problem whose id is 10, bin the log_entry_date into the weekday interval and count the date, and return a bar chart, display by the Y from high to low.
SELECT log_entry_date, COUNT(log_entry_date) FROM Problem_Log WHERE problem_id = 10 ORDER BY COUNT(log_entry_date) DESC
CREATE TABLE table_name_53 ( position INTEGER, club VARCHAR, points VARCHAR, draws VARCHAR )
What is the position when the points were less than 34, draws of 7, and a Club of sd eibar?
SELECT AVG(position) FROM table_name_53 WHERE points < 34 AND draws = 7 AND club = "sd eibar"
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE T...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, draw a bar chart about the distribution of hire_date and the sum of salary bin hire_date by time, could you list by the total number in asc?
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY SUM(SALARY)
CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, ...
I need to see my transcript .
SELECT DISTINCT course.department, course.name, course.number, semester.semester, semester.year, student_record.grade FROM course, semester, student_record WHERE student_record.course_id = course.course_id AND student_record.semester = semester.semester_id AND student_record.student_id = 1
CREATE TABLE table_name_16 ( wins INTEGER, draws VARCHAR, scored VARCHAR, team VARCHAR )
What is the fewest wins that has fewer than 23 goals scored, team of 2 de Mayo, and fewer than 7 draws?
SELECT MIN(wins) FROM table_name_16 WHERE scored < 23 AND team = "2 de mayo" AND draws < 7
CREATE TABLE playlists ( id INTEGER, name VARCHAR(120) ) CREATE TABLE invoice_lines ( id INTEGER, invoice_id INTEGER, track_id INTEGER, unit_price NUMERIC(10,2), quantity INTEGER ) CREATE TABLE employees ( id INTEGER, last_name VARCHAR(20), first_name VARCHAR(20), title VAR...
List the number of invoices from the US, grouped by state by a bar chart, show by the Y-axis from low to high.
SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state ORDER BY COUNT(*)
CREATE TABLE procedures ( cost INTEGER )
What are the highest cost, lowest cost and average cost of procedures?
SELECT MAX(cost), MIN(cost), AVG(cost) FROM procedures
CREATE TABLE table_204_392 ( id number, "#" number, "stadium" text, "capacity" number, "city" text, "country" text, "domed or retractable roof" text )
how many more seats does at & t stadium have than ford field ?
SELECT (SELECT "capacity" FROM table_204_392 WHERE "stadium" = 'at&t stadium') - (SELECT "capacity" FROM table_204_392 WHERE "stadium" = 'ford field')
CREATE TABLE table_1341690_18 ( result VARCHAR, incumbent VARCHAR )
What were the results when the incumbent was John Breaux?
SELECT result FROM table_1341690_18 WHERE incumbent = "John Breaux"
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE treatment ( ...
what was the name of the last lab test that patient 006-133605 had on this hospital visit?
SELECT lab.labname FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-133605' AND patient.hospitaldischargetime IS NULL)) ORDER BY lab.labresulttime DESC L...
CREATE TABLE table_27313 ( "Region" text, "Preschool (0\u20135 years)" text, "Primary (6\u201313 years)" text, "Secondary (14\u201317 years)" text, "Tertiary (18\u201324 years)" text )
What is the enrollment ratio for preschool in the region where enrollment ratio for tertiary is 29.55?
SELECT "Preschool (0\u20135 years)" FROM table_27313 WHERE "Tertiary (18\u201324 years)" = '29.55'
CREATE TABLE table_name_18 ( score VARCHAR, competition VARCHAR )
What's the score of the friendly competition?
SELECT score FROM table_name_18 WHERE competition = "friendly"
CREATE TABLE table_203_99 ( id number, "season" number, "date" text, "driver" text, "team" text, "chassis" text, "engine" text, "race distance\nlaps" number, "race distance\nmiles (km)" text, "race time" text, "average speed\n(mph)" number, "report" text )
what is the total number dallara chassis listed in the table ?
SELECT COUNT(*) FROM table_203_99 WHERE "chassis" = 'dallara'
CREATE TABLE table_name_87 ( rank INTEGER, notes VARCHAR, time VARCHAR )
What is the lowest rank for the team that raced a time of 6:17.62 and a notes of sa/b?
SELECT MIN(rank) FROM table_name_87 WHERE notes = "sa/b" AND time = "6:17.62"
CREATE TABLE table_name_21 ( attendance INTEGER, date VARCHAR, week VARCHAR )
Name the most attendance for november 17, 1946 and week more than 8
SELECT MAX(attendance) FROM table_name_21 WHERE date = "november 17, 1946" AND week > 8
CREATE TABLE table_1213511_7 ( player VARCHAR, position VARCHAR, nhl_team VARCHAR )
Which players have the position of centre and play for the nhl team new york rangers
SELECT player FROM table_1213511_7 WHERE position = "Centre" AND nhl_team = "New York Rangers"
CREATE TABLE table_5934 ( "Date" text, "Tournament" text, "Location" text, "Winner" text, "Score" text, "1st prize ( $ )" real )
What is the date of the Los Angeles open?
SELECT "Date" FROM table_5934 WHERE "Tournament" = 'los angeles open'
CREATE TABLE table_203_522 ( id number, "week" number, "date" text, "opponent" text, "results\nfinal score" text, "results\nteam record" text, "venue" text, "attendance" number )
what was the team record during the 10th week of the season ?
SELECT "results\nteam record" FROM table_203_522 WHERE "week" = 10
CREATE TABLE table_name_42 ( opponent VARCHAR, date VARCHAR )
Which Opponent has a Date of march 16?
SELECT opponent FROM table_name_42 WHERE date = "march 16"
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE admissions ( row_id num...
what is the yearly average of heart rate for patient 25796 until 49 months ago?
SELECT AVG(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25796)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'hear...
CREATE TABLE table_name_24 ( player VARCHAR, position VARCHAR, school_club_team VARCHAR )
Who is the forward from Grambling State?
SELECT player FROM table_name_24 WHERE position = "forward" AND school_club_team = "grambling state"
CREATE TABLE table_name_20 ( format VARCHAR, label VARCHAR )
What was the format when the label was loen entertainment?
SELECT format FROM table_name_20 WHERE label = "loen entertainment"
CREATE TABLE table_7586 ( "1900s" real, "1920s" real, "1930s" real, "1940s" real, "1950s" real, "1960s" real, "1970s" real, "1980s" real, "1990s" real, "2000s to date" real, "Total to date" real )
What was the lowest in the 1930s, has more than 1 in the 1940s, 0 in the 1990s, and a total to date of less than 17?
SELECT MIN("1930s") FROM table_7586 WHERE "1940s" > '1' AND "1990s" < '1' AND "Total to date" < '17'
CREATE TABLE table_23472 ( "Language" text, "Concepci\u00f3n Municipality (%)" real, "San Javier Municipality (%)" real, "San Ram\u00f3n Municipality (%)" real, "San Juli\u00e1n Municipality (%)" real, "San Antonio de Lomer\u00edo Municipality (%)" text, "Cuatro Ca\u00f1adas Municipality (%)...
What is the San Javier municipality percentage if the Cuatro Ca adas municipality percentage is 202?
SELECT "San Javier Municipality (%)" FROM table_23472 WHERE "Cuatro Ca\u00f1adas Municipality (%)" = '202'
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, ...
provide the number of patients with diagnoses icd9 code v1009 who were admitted before the year 2135.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2135" AND diagnoses.icd9_code = "V1009"
CREATE TABLE table_204_415 ( id number, "season" text, "tier" number, "division" text, "place" text )
after the 1994/95 season , how many first place finishes did the club have ?
SELECT COUNT(*) FROM table_204_415 WHERE "season" > '1994/95' AND "place" = 1
CREATE TABLE table_name_41 ( score VARCHAR, player VARCHAR )
What is Score, when Player is 'Vijay Singh'?
SELECT score FROM table_name_41 WHERE player = "vijay singh"
CREATE TABLE table_name_78 ( year VARCHAR, total VARCHAR, competitors VARCHAR )
In what Year did Yugoslavia have 4 Competitors with 0 medals Total?
SELECT year FROM table_name_78 WHERE total = "0" AND competitors = "4"
CREATE TABLE table_name_83 ( country VARCHAR, iata VARCHAR )
Which Country that has a IATA of bal?
SELECT country FROM table_name_83 WHERE iata = "bal"
CREATE TABLE hall_of_fame ( player_id TEXT, yearid INTEGER, votedby TEXT, ballots NUMERIC, needed NUMERIC, votes NUMERIC, inducted TEXT, category TEXT, needed_note TEXT ) CREATE TABLE pitching ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id...
For each year, return the year and the average number of attendance at home games, and I want to list by the X in desc please.
SELECT year, AVG(attendance) FROM home_game GROUP BY year ORDER BY year DESC
CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER numeric, DEPT_CODE varchar(18), STU_PHONE varchar(4), PROF_NUM int ) CREATE TABLE DE...
Find the first name and gpa of the students whose gpa is lower than the average gpa of all students Plot them as bar chart, sort bar from low to high order.
SELECT STU_FNAME, SUM(STU_GPA) FROM STUDENT WHERE STU_GPA < (SELECT AVG(STU_GPA) FROM STUDENT) GROUP BY STU_FNAME ORDER BY STU_FNAME
CREATE TABLE table_name_81 ( external_affairs VARCHAR, human_resources_ VARCHAR, _operations VARCHAR )
Who was in external affairs when Jakki Doyle was in Human Resources & Operations?
SELECT external_affairs FROM table_name_81 WHERE human_resources_ & _operations = "jakki doyle"
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 t...
what is primary disease and procedure icd9 code of subject id 4589?
SELECT demographic.diagnosis, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "4589"
CREATE TABLE table_name_10 ( record VARCHAR, score VARCHAR )
What was the Record of the game with a Score of 118 105?
SELECT record FROM table_name_10 WHERE score = "118–105"
CREATE TABLE table_29301050_1 ( train_name VARCHAR, arrival_lonavla VARCHAR )
which train name arrives in lonavla at 17:45
SELECT train_name FROM table_29301050_1 WHERE arrival_lonavla = "17:45"
CREATE TABLE table_name_47 ( gold INTEGER, bronze VARCHAR, silver VARCHAR, rank VARCHAR )
What nation with Rank 1 won the fewest gold medals while winning more than 11 silver but fewer than 7 bronze medals?
SELECT MIN(gold) FROM table_name_47 WHERE silver > 11 AND rank = "1" AND bronze < 7
CREATE TABLE table_name_5 ( result VARCHAR, date VARCHAR )
What was the result and score of the game on February 22?
SELECT result FROM table_name_5 WHERE date = "february 22"