context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
tell me the number of patients who were ordered platelet count lab test and had abnormal lab test status.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.flag = "abnormal" AND lab.label = "Platelet Count"
mimicsql_data
CREATE TABLE table_922 ( "Num" real, "Team" text, "W" real, "L" real, "PCT" text, "PF" real, "PA" real, "Last appearance" real, "Last championship" text, "HOME games" real, "Home wins" real, "Home losses" real, "Home Win Pct." text, "ROAD games" real, "Road wi...
How many home losses occured when PF 13?
SELECT COUNT("Home losses") FROM table_922 WHERE "PF" = '13'
wikisql
CREATE TABLE table_2004733_2 ( barangay VARCHAR, area__in_km_2__ VARCHAR )
What's the name of the barangay whose area is 3.6787 km ?
SELECT barangay FROM table_2004733_2 WHERE area__in_km_2__ = "3.6787"
sql_create_context
CREATE TABLE table_name_80 ( total INTEGER, country VARCHAR, silver VARCHAR )
What is the lowest total medals for the united states who had more than 11 silver medals?
SELECT MIN(total) FROM table_name_80 WHERE country = "united states" AND silver > 11
sql_create_context
CREATE TABLE table_train_110 ( "id" int, "cholesterol" float, "body_weight" float, "creatinine_clearance_cl" float, "triglyceride_tg" float, "age" float, "NOUSE" float )
aged 20 _ 30 or 60 _ 70
SELECT * FROM table_train_110 WHERE (age >= 20 AND age <= 30) OR (age >= 60 OR age <= 70)
criteria2sql
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS va...
For all employees who have the letters D or S in their first name, give me the comparison about the average of manager_id over the job_id , and group by attribute job_id, and rank bar from low to high order.
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY JOB_ID
nvbench
CREATE TABLE table_76865 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location/Attendance" text, "Record" text )
Who had the most assists in the game that led to a 3-7 record?
SELECT "High assists" FROM table_76865 WHERE "Record" = '3-7'
wikisql
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 employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), ...
Draw a bar chart for what are the department names and how many employees work in each of them?, sort the total number from low to high order.
SELECT DEPARTMENT_NAME, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID GROUP BY DEPARTMENT_NAME ORDER BY COUNT(*)
nvbench
CREATE TABLE table_2709 ( "County" text, "Population" real, "Unemployment Rate" text, "Market Income Per Capita" text, "Poverty Rate" text, "Status" text )
What is the unemployment rate in those places in Alexander county whose status is transitional?
SELECT "Unemployment Rate" FROM table_2709 WHERE "Status" = 'Transitional' AND "County" = 'Alexander'
wikisql
CREATE TABLE table_18012738_1 ( directed_by VARCHAR, uk_viewers__million_ VARCHAR )
Name the total number directed by for uk viewers being 6.86
SELECT COUNT(directed_by) FROM table_18012738_1 WHERE uk_viewers__million_ = "6.86"
sql_create_context
CREATE TABLE table_58023 ( "Date" text, "Track" text, "Race" text, "Distance" text, "Surface track" text, "Winning horse" text, "Winning jockey" text )
What distance did the winning horse run in the Summer Doldrums.
SELECT "Distance" FROM table_58023 WHERE "Winning horse" = 'summer doldrums'
wikisql
CREATE TABLE table_name_23 ( type VARCHAR, year_s_ VARCHAR )
what is the type when the year(s) is 1982?
SELECT type FROM table_name_23 WHERE year_s_ = "1982"
sql_create_context
CREATE TABLE table_203_551 ( id number, "goal" number, "date" text, "venue" text, "opponent" text, "score" text, "result" text, "competition" text )
what is the number of goals d m szalai made against san marino in 2010 ?
SELECT COUNT(*) FROM table_203_551 WHERE "opponent" = 'san marino' AND "date" = 2010
squall
CREATE TABLE table_55466 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
what is the laps when the time/retired is turbo and the grid is less than 14?
SELECT "Laps" FROM table_55466 WHERE "Time/Retired" = 'turbo' AND "Grid" < '14'
wikisql
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE SuggestedEditVotes ( ...
Stats For Rep Per Post.
WITH repPerPostUser AS (SELECT u.Id, CAST(u.Reputation AS FLOAT(15, 5)) / CAST(CASE WHEN COUNT(p.Id) = 0 THEN 1 ELSE COUNT(p.Id) END AS FLOAT(15, 5)) AS RepPerPost FROM Users AS u INNER JOIN Posts AS p ON u.Id = p.OwnerUserId GROUP BY u.Id, u.Reputation) SELECT AVG(RepPerPost) AS Mean_RepPerPost, MAX(RepPerPost) AS Max...
sede
CREATE TABLE table_23211041_5 ( team VARCHAR, date VARCHAR )
What team was played on november 24?
SELECT team FROM table_23211041_5 WHERE date = "November 24"
sql_create_context
CREATE TABLE table_31518 ( "Rnd" real, "Circuit" text, "Location" text, "Date" text, "Pole position" text, "Fastest lap" text, "Winning driver" text, "Winning team" text, "Supporting" text )
What is the circuit located in baltimore , maryland?
SELECT "Circuit" FROM table_31518 WHERE "Location" = 'Baltimore , Maryland'
wikisql
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
统计一下医疗记录中年龄15岁及以上的患者的平均治病费总额有多少钱?
SELECT AVG(MED_AMOUT) FROM t_kc24 WHERE MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_AGE >= 15)
css
CREATE TABLE table_32174 ( "Region" text, "Date" text, "Label" text, "Format" text, "Catalogue" text )
What is the label for catalogue of RT-346-5?
SELECT "Label" FROM table_32174 WHERE "Catalogue" = 'rt-346-5'
wikisql
CREATE TABLE table_name_27 ( pada_3 VARCHAR, pada_2 VARCHAR )
which Pada 3 has a Pada 2 of che?
SELECT pada_3 FROM table_name_27 WHERE pada_2 = "चे che"
sql_create_context
CREATE TABLE table_name_51 ( Id VARCHAR )
What's the 1986 if 1991 has a QF and 1998 has a 3R?
SELECT 1986 FROM table_name_51 WHERE 1991 = "qf" AND 1998 = "3r"
sql_create_context
CREATE TABLE table_22738 ( "Submitting country" text, "Film title used in nomination" text, "Original title" text, "Language(s)" text, "Director(s)" text, "Result" text )
Who directed the film Nuits d'arabie?
SELECT "Director(s)" FROM table_22738 WHERE "Film title used in nomination" = 'Nuits d''Arabie'
wikisql
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id n...
what was the first medication patient 83062 was prescribed via oral route in the current hospital encounter?
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 83062 AND admissions.dischtime IS NULL) AND prescriptions.route = 'oral' ORDER BY prescriptions.startdate LIMIT 1
mimic_iii
CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number...
Users with most suggested edits.
SELECT OwnerUserId AS "user_link", COUNT(Id) AS Total, COUNT(ApprovalDate) AS Approved, COUNT(RejectionDate) AS Rejected, ROUND((COUNT(ApprovalDate)) * 100.0 / (COUNT(Id)), 2) AS PercApproved, ROUND((COUNT(RejectionDate)) * 100.0 / (COUNT(Id)), 2) AS PercRejected FROM SuggestedEdits GROUP BY OwnerUserId ORDER BY COUNT(...
sede
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, ...
what is the last time patient 73913 had the microbiology test in the last hospital encounter?
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73913 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) ORDER BY microbiologyevents.charttime DESC LIMIT 1
mimic_iii
CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE Comments ( Id number, PostId number, Score numb...
Top Posts with 'Application' in Feedback Section.
SELECT ParentId AS "post_link", COUNT(PostId) AS "id" FROM Posts, PostFeedback WHERE PostTypeId = 1 AND LENGTH(Body) <= 200 AND (Body LIKE '%pplicatio%') GROUP BY ParentId, PostFeedback.Id HAVING COUNT(Posts.Id) > 1 ORDER BY COUNT(Posts.Id) DESC
sede
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
Draw a bar chart of affiliation versus sum enrollment, and could you rank by the names from high to low?
SELECT Affiliation, SUM(Enrollment) FROM university GROUP BY Affiliation ORDER BY Affiliation DESC
nvbench
CREATE TABLE table_34313 ( "Position" text, "Name" text, "School" text, "Unanimous" text, "College Hall of Fame" text )
What is the School of the quarterback?
SELECT "School" FROM table_34313 WHERE "Position" = 'quarterback'
wikisql
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
统计年龄高于22岁的患者医疗记录的平均医疗费总额是多少钱?
SELECT AVG(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_AGE > 22 UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_AGE > 22)
css
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, war...
since 1 year ago what are the top five most frequent microbiological tests given to patients within 2 months after inject/infuse nec?
SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FR...
mimic_iii
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
编号为97657668的病患的医疗记录中药品消费不低于9132.88元的医疗就诊编号是啥
SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_ID = '97657668' AND NOT gwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT < 9132.88) UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_ID = '97657668' AND NOT fgwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLI...
css
CREATE TABLE table_name_93 ( result VARCHAR, week VARCHAR )
What was the result of week 2?
SELECT result FROM table_name_93 WHERE week = "week 2"
sql_create_context
CREATE TABLE airlines ( alid number, name text, iata text, icao text, callsign text, country text, active text ) CREATE TABLE airports ( apid number, name text, city text, country text, x number, y number, elevation number, iata text, icao text ) CREATE ...
What is the name and city of the airport that the most routes end at?
SELECT T1.name, T1.city, T2.dst_apid FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid GROUP BY T2.dst_apid ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE table_name_57 ( floors INTEGER, street_address VARCHAR )
WHAT IS THE FLOOR NUMBERS WITH 01.0 10 light street?
SELECT SUM(floors) FROM table_name_57 WHERE street_address = "01.0 10 light street"
sql_create_context
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 icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, fi...
what is the number of patients who received a extracorporeal circulat procedure within the same month after having received a packed cell transfusion procedure during a year before?
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'packed cell...
mimic_iii
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 prescriptions...
Bring me the number of patients with adelta abnormal lab test who were diagnosed with long-term (current) use of steroids.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Long-term (current) use of steroids" AND lab.flag = "delta"
mimicsql_data
CREATE TABLE flight ( flno number(4,0), origin varchar2(20), destination varchar2(20), distance number(6,0), departure_date date, arrival_date date, price number(7,2), aid number(9,0) ) CREATE TABLE aircraft ( aid number(9,0), name varchar2(30), distance number(6,0) ) CREAT...
Show all origins and the number of flights from each origin Show bar chart, display in desc by the y axis please.
SELECT origin, COUNT(*) FROM flight GROUP BY origin ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_29761 ( "Stadium" text, "City" text, "Capacity" real, "Matches played" real, "Overall attendance" real, "Average attendance per match" real, "Average attendance as % of Capacity" text, "Overall goals scored" real, "Average goals scored per match" text, "Elevati...
how many overall goals were scored at moses mabhida stadium?
SELECT MAX("Overall goals scored") FROM table_29761 WHERE "Stadium" = 'Moses Mabhida Stadium'
wikisql
CREATE TABLE table_name_50 ( number_of_s_eva INTEGER, lunar_lander VARCHAR )
What is the average number of EVA for the Orion?
SELECT AVG(number_of_s_eva) FROM table_name_50 WHERE lunar_lander = "orion"
sql_create_context
CREATE TABLE party ( Party_ID int, Minister text, Took_office text, Left_office text, Region_ID int, Party_name text ) CREATE TABLE party_events ( Event_ID int, Event_Name text, Party_ID int, Member_in_charge_ID int ) CREATE TABLE region ( Region_ID int, Region_name tex...
Which ministers are not a part of the Progress Party, and count them by a bar chart
SELECT Minister, COUNT(Minister) FROM party WHERE Party_name <> 'Progress Party' GROUP BY Minister
nvbench
CREATE TABLE table_name_17 ( structure_type VARCHAR, name VARCHAR )
What type of structure is there at the American Tower Christmas?
SELECT structure_type FROM table_name_17 WHERE name = "american tower christmas"
sql_create_context
CREATE TABLE table_46468 ( "Show" text, "Last Aired" real, "Previous Network" text, "Retitled as/Same" text, "New/Returning/Same Network" text, "Returning" text )
Which New/Returning/Same Network has a Previous Network of nbc, and a Show of blockbusters?
SELECT "New/Returning/Same Network" FROM table_46468 WHERE "Previous Network" = 'nbc' AND "Show" = 'blockbusters'
wikisql
CREATE TABLE table_name_5 ( manufacturer VARCHAR, finish VARCHAR, team VARCHAR, year VARCHAR, start VARCHAR )
WHAT MANUFACTURER AFTER 1966 HAD A START SMALLER THAN 5, A WOOD TEAM AND FINISHED 35?
SELECT manufacturer FROM table_name_5 WHERE year > 1966 AND start < 5 AND team = "wood" AND finish = 35
sql_create_context
CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, ...
i would like a flight that leaves on friday from PHILADELPHIA to DALLAS that makes a stop in ATLANTA
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, date_day, days, flight, flight_stop WHERE ((CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'ATLAN...
atis
CREATE TABLE table_1404456_1 ( former_province VARCHAR, area__km_2__ VARCHAR )
what's the former province with area (km 2 ) being 12,245.9
SELECT former_province FROM table_1404456_1 WHERE area__km_2__ = "12,245.9"
sql_create_context
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,...
how much does flight DL 402 from DENVER to PHILADELPHIA cost
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE (((flight.airline_code = 'DL') AND flight.flight_number = 402) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADEL...
atis
CREATE TABLE table_name_18 ( goals_for INTEGER, points VARCHAR, losses VARCHAR, position VARCHAR )
Name the most goals with losses less than 15 and position more than 8 with points of 42+4
SELECT MAX(goals_for) FROM table_name_18 WHERE losses < 15 AND position > 8 AND points = "42+4"
sql_create_context
CREATE TABLE Services ( Service_ID INTEGER, Service_Type_Code CHAR(15) ) CREATE TABLE Participants_in_Events ( Event_ID INTEGER, Participant_ID INTEGER ) CREATE TABLE Events ( Event_ID INTEGER, Service_ID INTEGER, Event_Details VARCHAR(255) ) CREATE TABLE Participants ( Participant_ID...
Give me a bar chart to show the number of event details of events that have more than one participant.
SELECT Event_Details, COUNT(Event_Details) FROM Events AS T1 JOIN Participants_in_Events AS T2 ON T1.Event_ID = T2.Event_ID GROUP BY Event_Details
nvbench
CREATE TABLE table_name_57 ( electorate INTEGER, name VARCHAR, political_party VARCHAR, constituency VARCHAR )
What is the smallest electorate for the Conservative party in South West Devon constituency, with over 2 conservatives and a name of Plymstock Radford?
SELECT MIN(electorate) FROM table_name_57 WHERE political_party = "conservative" AND constituency = "south west devon" AND "conservative" > 2 AND name = "plymstock radford"
sql_create_context
CREATE TABLE table_2084 ( "Pick #" real, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
What player is from the California Golden Seals?
SELECT "Player" FROM table_2084 WHERE "NHL team" = 'California Golden Seals'
wikisql
CREATE TABLE table_name_25 ( date VARCHAR, loss VARCHAR )
What was the date of the game that had a loss of Politte (0-2)?
SELECT date FROM table_name_25 WHERE loss = "politte (0-2)"
sql_create_context
CREATE TABLE table_72210 ( "Series #" real, "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 written by Karen Felix and Don Woodard?
SELECT "Original air date" FROM table_72210 WHERE "Written by" = 'Karen Felix and Don Woodard'
wikisql
CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PostHistoryTypes ( Id number, ...
Most duplicated questions linked to a post.
SELECT PostId AS "post_link", COUNT(RelatedPostId) AS count FROM PostLinks WHERE LinkTypeId = 3 GROUP BY PostId ORDER BY COUNT(RelatedPostId) DESC LIMIT 50
sede
CREATE TABLE Transactions_Lots ( transaction_id INTEGER, lot_id INTEGER ) CREATE TABLE Transactions ( transaction_id INTEGER, investor_id INTEGER, transaction_type_code VARCHAR(10), date_of_transaction DATETIME, amount_of_transaction DECIMAL(19,4), share_count VARCHAR(40), other_det...
For the dates of transactions with amount smaller than 3000, bin the date into year interval, and draw a line chart to show the trend of the number of records in each bin, and order by the x-axis in desc please.
SELECT date_of_transaction, COUNT(date_of_transaction) FROM Sales AS T1 JOIN Transactions AS T2 ON T1.sales_transaction_id = T2.transaction_id WHERE T2.amount_of_transaction < 3000 ORDER BY date_of_transaction DESC
nvbench
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...
how many patients whose admission year is less than 2197 and procedure icd9 code is 3323?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2197" AND procedures.icd9_code = "3323"
mimicsql_data
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
Visualize a bar chart for simply displaying the email address of the employee and the corresponding employee id, order in ascending by the Y-axis.
SELECT EMAIL, EMPLOYEE_ID FROM employees ORDER BY EMPLOYEE_ID
nvbench
CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE student ( student_id int, lastname varchar, ...
For how long has MFG 605 been offered ?
SELECT DISTINCT semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'MFG' AND course.number = 605 AND semester.semester_id = course_offering.semester ORDER BY semester.year LIMIT 1
advising
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, ...
What is the number of patients admitted before 2190 who had a hemoglobin a1c lab test done?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2190" AND lab.label = "% Hemoglobin A1c"
mimicsql_data
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 ) ...
count the number of patients whose religion is christian scientist and item id is 51254?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "CHRISTIAN SCIENTIST" AND lab.itemid = "51254"
mimicsql_data
CREATE TABLE table_25429986_1 ( distance VARCHAR, position VARCHAR )
what is distance for the 7th position?
SELECT COUNT(distance) FROM table_25429986_1 WHERE position = "7th"
sql_create_context
CREATE TABLE table_18594107_2 ( draws INTEGER, scored VARCHAR )
How many draws are there when the score is 13?
SELECT MAX(draws) FROM table_18594107_2 WHERE scored = 13
sql_create_context
CREATE TABLE table_48805 ( "Name" text, "Launched" text, "Vehicle" text, "Ceased operation" text, "Notes" text )
What are the notes regarding the scout x-4 vehicle which ceased operation in June 1971?
SELECT "Notes" FROM table_48805 WHERE "Vehicle" = 'scout x-4' AND "Ceased operation" = 'june 1971'
wikisql
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 the number of patients whose diagnoses short title is hemochromatos-rbc trans and drug type is base?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Hemochromatos-rbc trans" AND prescriptions.drug_type = "BASE"
mimicsql_data
CREATE TABLE table_26202788_7 ( championship VARCHAR, opponent_in_the_final VARCHAR )
Marat Safin is the opponent in the final in what championship?
SELECT championship FROM table_26202788_7 WHERE opponent_in_the_final = "Marat Safin"
sql_create_context
CREATE TABLE event ( venue VARCHAR, name VARCHAR, Event_Attendance VARCHAR )
List the event venues and names that have the top 2 most number of people attended.
SELECT venue, name FROM event ORDER BY Event_Attendance DESC LIMIT 2
sql_create_context
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
出院时医疗就诊13686436304诊断的疾病编号与名称分别是什么?
SELECT gwyjzb.OUT_DIAG_DIS_CD, gwyjzb.OUT_DIAG_DIS_NM FROM gwyjzb WHERE gwyjzb.MED_CLINIC_ID = '13686436304' UNION SELECT fgwyjzb.OUT_DIAG_DIS_CD, fgwyjzb.OUT_DIAG_DIS_NM FROM fgwyjzb WHERE fgwyjzb.MED_CLINIC_ID = '13686436304'
css
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE prescriptions ( row_id num...
what are the three most common lab tests for the patients of age 50s since 2102?
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t1.itemid FROM (SELECT labevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 50 AND 59) AND STRFTIME('%y', labevents.c...
mimic_iii
CREATE TABLE table_60688 ( "Golden Rivers" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real )
What is the total number of draws when there are fewer than 3 wins?
SELECT COUNT("Draws") FROM table_60688 WHERE "Wins" < '3'
wikisql
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, ...
Give me the time of admission and diagnoses icd9 code for the patient with patient id 1875.
SELECT demographic.admittime, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "1875"
mimicsql_data
CREATE TABLE table_name_69 ( opponent VARCHAR, score VARCHAR )
Who scored 18-19?
SELECT opponent FROM table_name_69 WHERE score = "18-19"
sql_create_context
CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttim...
what is the total amount of input that patient 4401 during a day before has received?
SELECT SUM(inputevents_cv.amount) 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 = 4401)) AND DATETIME(inputevents_cv.charttime, 'start of day') = DATETIME(CURRENT_TIME(), '...
mimic_iii
CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req 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 ...
Between 10:00 and 2:00 is there any section of JAZZ 471 offered ?
SELECT DISTINCT course_offering.end_time, course_offering.section_number, course_offering.start_time FROM course, course_offering, semester WHERE course_offering.end_time <= '2:00' AND course_offering.start_time >= '10:00' AND course.course_id = course_offering.course_id AND course.department = 'JAZZ' AND course.number...
advising
CREATE TABLE table_name_75 ( winning_team VARCHAR, winning_driver VARCHAR, circuit VARCHAR, fastest_lap VARCHAR, pole_position VARCHAR )
Which Winning Team has the Fastest Lap of brendon hartley, and a Pole Position of oliver turvey, and a Circuit of spa-francorchamps, and the Winning Driver of brendon hartley?
SELECT winning_team FROM table_name_75 WHERE fastest_lap = "brendon hartley" AND pole_position = "oliver turvey" AND circuit = "spa-francorchamps" AND winning_driver = "brendon hartley"
sql_create_context
CREATE TABLE table_61260 ( "Military deaths" text, "Civilian deaths" text, "Total deaths (not including foreigners)" text, "Military and/or Civilian wounded" text, "Total casualties" text )
How many military or civilians were wounded in the conflict that had an unknown number of civilian and total deaths?
SELECT "Military and/or Civilian wounded" FROM table_61260 WHERE "Civilian deaths" = 'unknown' AND "Total deaths (not including foreigners)" = 'unknown'
wikisql
CREATE TABLE table_73543 ( "Series #" real, "Season #" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (in millions)" text )
What are the titles of the episodes which had 1.10 million U.S. viewers?
SELECT "Title" FROM table_73543 WHERE "U.S. viewers (in millions)" = '1.10'
wikisql
CREATE TABLE table_name_52 ( lost VARCHAR, points_against VARCHAR )
How many resulted in a loss with 479 points against?
SELECT lost FROM table_name_52 WHERE points_against = "479"
sql_create_context
CREATE TABLE table_26199130_1 ( no INTEGER, us_viewers__million_ VARCHAR )
What numbered episode had 11.96 million US viewers?
SELECT MAX(no) FROM table_26199130_1 WHERE us_viewers__million_ = "11.96"
sql_create_context
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,...
i would like a flight on CO leaving from BOSTON making a stop in DENVER and arriving in SAN FRANCISCO
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND CI...
atis
CREATE TABLE table_2957 ( "Vehicle" text, "Operating mode" text, "EPA rated All-electric range" text, "EPA rated combined fuel economy" text, "Clean electric grid California (San Francisco)" text, "U.S. national average electric mix" text, "Dirty electric grid Rocky Mountains (Denver)" text ...
What is the dirty electric grid rocky mountains (denver) for the vehicle with the clean electric grid california (san francisco) of 160 g/mi (99 g/km)?
SELECT "Dirty electric grid Rocky Mountains (Denver)" FROM table_2957 WHERE "Clean electric grid California (San Francisco)" = '160 g/mi (99 g/km)'
wikisql
CREATE TABLE table_64944 ( "Heat" real, "Lane" real, "Name" text, "Nationality" text, "Time" text )
What is the total number of heat for Chinyere Pigot?
SELECT COUNT("Heat") FROM table_64944 WHERE "Name" = 'chinyere pigot'
wikisql
CREATE TABLE country ( country_id number, country text, last_update time ) CREATE TABLE film_text ( film_id number, title text, description text ) CREATE TABLE actor ( actor_id number, first_name text, last_name text, last_update time ) CREATE TABLE film ( film_id number, ...
Count the number of cities in Australia.
SELECT COUNT(*) FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id WHERE T2.country = 'Australia'
spider
CREATE TABLE table_20774360_2 ( regular_season_record__w_l_ VARCHAR, standing VARCHAR )
Name the regular season record for standing 11th
SELECT regular_season_record__w_l_ FROM table_20774360_2 WHERE standing = "11th"
sql_create_context
CREATE TABLE table_77635 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
When Jean Alesi had laps less than 24, what was his highest grid?
SELECT MAX("Grid") FROM table_77635 WHERE "Driver" = 'jean alesi' AND "Laps" < '24'
wikisql
CREATE TABLE table_name_76 ( noof_settlements INTEGER, district VARCHAR, pop_dens VARCHAR )
How many settlements are in esk krumlov (ck) with a population density higher than 38?
SELECT SUM(noof_settlements) FROM table_name_76 WHERE district = "český krumlov (ck)" AND pop_dens > 38
sql_create_context
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 regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), ...
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of hire_date and the sum of department_id bin hire_date by weekday in a bar chart, I want to rank from low to high by the Y please.
SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(DEPARTMENT_ID)
nvbench
CREATE TABLE Student_Tests_Taken ( registration_id INTEGER, date_test_taken DATETIME, test_result VARCHAR(255) ) CREATE TABLE Courses ( course_id INTEGER, author_id INTEGER, subject_id INTEGER, course_name VARCHAR(120), course_description VARCHAR(255) ) CREATE TABLE Student_Course_Enro...
What are the number of the completion dates of all the tests that have result 'Fail'?, and rank from high to low by the y-axis.
SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" GROUP BY date_of_completion ORDER BY COUNT(date_of_completion) DESC
nvbench
CREATE TABLE table_68083 ( "Year" real, "Office" text, "Candidate" text, "Popular Votes" real, "Percentage" text )
Name the least popular votes for year less than 1994 and percentage of 0.96%
SELECT MIN("Popular Votes") FROM table_68083 WHERE "Year" < '1994' AND "Percentage" = '0.96%'
wikisql
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_proje...
Will OMS 995 classes take place on Friday ?
SELECT DISTINCT course_offering.friday FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.department = 'OMS' AND course.number = 995 AND semester.semester = 'WN' AND semester.year = 2016
advising
CREATE TABLE table_14342480_5 ( points VARCHAR, position VARCHAR, starter VARCHAR )
Name the number of points for right halfback and starter being yes
SELECT COUNT(points) FROM table_14342480_5 WHERE position = "Right halfback" AND starter = "yes"
sql_create_context
CREATE TABLE table_55894 ( "Pick" real, "Player" text, "Country of origin*" text, "PBA team" text, "College" text )
What college has Jojo Manalo?
SELECT "College" FROM table_55894 WHERE "Player" = 'jojo manalo'
wikisql
CREATE TABLE Participants ( Participant_ID INTEGER, Participant_Type_Code CHAR(15), Participant_Details VARCHAR(255) ) CREATE TABLE Events ( Event_ID INTEGER, Service_ID INTEGER, Event_Details VARCHAR(255) ) CREATE TABLE Participants_in_Events ( Event_ID INTEGER, Participant_ID INTEGER...
What are the ids and details of events that have more than one participants, and order by the total number in desc.
SELECT T1.Event_Details, T1.Event_ID FROM Events AS T1 JOIN Participants_in_Events AS T2 ON T1.Event_ID = T2.Event_ID GROUP BY T1.Event_Details ORDER BY T1.Event_ID DESC
nvbench
CREATE TABLE table_name_2 ( nationality VARCHAR, player VARCHAR )
What is the Nationality for alexandre jacques?
SELECT nationality FROM table_name_2 WHERE player = "alexandre jacques"
sql_create_context
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, ...
what is the number of patients whose religion is romanian east. orth and year of birth is less than 2078?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.religion = "ROMANIAN EAST. ORTH" AND demographic.dob_year < "2078"
mimicsql_data
CREATE TABLE musical ( Musical_ID int, Name text, Year int, Award text, Category text, Nominee text, Result text ) CREATE TABLE actor ( Actor_ID int, Name text, Musical_ID int, Character text, Duration text, age int )
Bar chart x axis duration y axis how many duration, display by the y axis in asc.
SELECT Duration, COUNT(Duration) FROM actor GROUP BY Duration ORDER BY COUNT(Duration)
nvbench
CREATE TABLE table_47003 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
Who was the home when the visitor was New York Knicks?
SELECT "Home" FROM table_47003 WHERE "Visitor" = 'new york knicks'
wikisql
CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Coun...
Show me the total number by country in a histogram, could you order in desc by the names?
SELECT Country, COUNT(*) FROM stadium GROUP BY Country ORDER BY Country DESC
nvbench
CREATE TABLE table_name_10 ( player VARCHAR, to_par VARCHAR, score VARCHAR )
What is Player, when To Par is '7', and when Score is '73-72-67-75=287'?
SELECT player FROM table_name_10 WHERE to_par = 7 AND score = 73 - 72 - 67 - 75 = 287
sql_create_context
CREATE TABLE table_204_664 ( id number, "rank" number, "bib" number, "name" text, "nationality" text, "start" text, "penalties (p+p+s+s)" text, "time" text, "deficit" text )
how long did it take for erik lesser to finish ?
SELECT "time" FROM table_204_664 WHERE "name" = 'erik lesser'
squall
CREATE TABLE table_70698 ( "Race" text, "Position" text, "Time (HH:MM:SS)" text, "Speed (Mph)" text, "Replica" text )
What race is in the 5th position?
SELECT "Race" FROM table_70698 WHERE "Position" = '5th'
wikisql
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate t...
GROUP BY - Most popular user locations.
SELECT Location, COUNT(*) AS Population FROM dbo.Users GROUP BY Location ORDER BY Population DESC
sede