context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Subjects (
subject_name VARCHAR,
subject_id VARCHAR
)
CREATE TABLE Courses (
subject_id VARCHAR
) | Find the subject ID, subject name, and the corresponding number of available courses for each subject. | SELECT T1.subject_id, T2.subject_name, COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id | sql_create_context |
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname var... | Does Prof. William Iii teach other courses besides 646 ? | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.number <> 646 AND instructor.name LIKE '%William Iii%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_i... | advising |
CREATE TABLE table_33856 (
"Celebrity" text,
"Famous for" text,
"Entered" text,
"Exited" text,
"Finished" text
) | Who was the celebrity who finished in 7th place? | SELECT "Celebrity" FROM table_33856 WHERE "Finished" = '7th' | wikisql |
CREATE TABLE table_70227 (
"Year" real,
"Team" text,
"Co-Drivers" text,
"Class" text,
"Pos." text,
"Class Pos." text
) | Which class has a Year of 1968? | SELECT "Class" FROM table_70227 WHERE "Year" = '1968' | wikisql |
CREATE TABLE customers (
customer_name VARCHAR,
payment_method VARCHAR
) | Find the name of customers who did not pay with Cash. | SELECT customer_name FROM customers WHERE payment_method <> 'Cash' | sql_create_context |
CREATE TABLE table_name_15 (
attendance VARCHAR,
date VARCHAR
) | How many people were in attendance on the game on April 8, 2007? | SELECT attendance FROM table_name_15 WHERE date = "april 8, 2007" | sql_create_context |
CREATE TABLE table_name_28 (
competition VARCHAR,
score VARCHAR
) | what is the competition when the score is 2-1? | SELECT competition FROM table_name_28 WHERE score = "2-1" | sql_create_context |
CREATE TABLE t_kc21 (
MED_CLINIC_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
COMP_ID text,
PERSON_ID text,
PERSON_NM text,
IDENTITY_CARD text,
SOC_SRT_CARD text,
PERSON_SEX number,
PERSON_AGE number,
IN_HOSP_DATE time,
OUT_HOSP_DATE time,
DIFF_PLACE_FLG numb... | 患者水雯华就诊过的医院有哪几家,时间是从01年12月24日到08年4月20日 | SELECT COUNT(DISTINCT MED_SER_ORG_NO) FROM t_kc21 WHERE PERSON_NM = '水雯华' AND IN_HOSP_DATE BETWEEN '2001-12-24' AND '2008-04-20' | css |
CREATE TABLE table_name_79 (
gold INTEGER,
rank VARCHAR,
bronze VARCHAR
) | What is the average Gold when the rank is less than 3 and the bronze is less than 1? | SELECT AVG(gold) FROM table_name_79 WHERE rank < 3 AND bronze < 1 | 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 discharge location is disch-tran to psych hosp and admission year is less than 2131? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND demographic.admityear < "2131" | mimicsql_data |
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 ... | tell me the two year survival rate of patients who were prescribed ns after they were diagnosed with paranoid schizo-chronic? | SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t4.charttime) > 2 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.subject_id, t2.charttime FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd... | mimic_iii |
CREATE TABLE workshop (
workshop_id number,
date text,
venue text,
name text
)
CREATE TABLE submission (
submission_id number,
scores number,
author text,
college text
)
CREATE TABLE acceptance (
submission_id number,
workshop_id number,
result text
) | Show the result of the submission with the highest score. | SELECT T1.result FROM acceptance AS T1 JOIN submission AS T2 ON T1.submission_id = T2.submission_id ORDER BY T2.scores DESC LIMIT 1 | spider |
CREATE TABLE table_name_21 (
opponents VARCHAR,
partner VARCHAR
) | Tell me the opponents for partner of yvonne meusburger | SELECT opponents FROM table_name_21 WHERE partner = "yvonne meusburger" | sql_create_context |
CREATE TABLE table_55412 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What did the team score when playing against an away team with a score of 13.8 (86)? | SELECT "Home team score" FROM table_55412 WHERE "Away team score" = '13.8 (86)' | wikisql |
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,... | how many male patients are diagnosed with injury to femoral nerve? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.long_title = "Injury to femoral nerve" | mimicsql_data |
CREATE TABLE table_1765 (
"Ending" text,
"American" text,
"British" text,
"Australian" text,
"Examples" text
) | what are the endings of examples achilles, appendices, f ces | SELECT "Ending" FROM table_1765 WHERE "Examples" = 'Achilles, appendices, fæces' | wikisql |
CREATE TABLE table_31942 (
"Goal" real,
"Date" text,
"Score" text,
"Result" text,
"Competition" text
) | Tell me the result for 2010 fifa world cup qualification | SELECT "Result" FROM table_31942 WHERE "Competition" = '2010 fifa world cup qualification' | wikisql |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospit... | calculate how many drugs patient 021-100763 is prescribed on this hospital visit. | SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-100763' AND patient.hospitaldischargetime IS NULL)) | eicu |
CREATE TABLE table_12002388_1 (
playoffs VARCHAR,
reg_season VARCHAR
) | What playoff result happened during the season in which they finished 1st, southern? | SELECT playoffs FROM table_12002388_1 WHERE reg_season = "1st, Southern" | sql_create_context |
CREATE TABLE table_name_71 (
channel VARCHAR,
play_by_play VARCHAR
) | Which channel has Joel Meyers as the Play by play commentator? | SELECT channel FROM table_name_71 WHERE play_by_play = "joel meyers" | 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 diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (... | Give me the number of widow patients who had a urine albumin/creatinine lab test. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "WIDOWED" AND lab.label = "Albumin/Creatinine, Urine" | mimicsql_data |
CREATE TABLE table_name_64 (
week_1 VARCHAR,
week_2 VARCHAR
) | Which week 1 had a week 2 of Mandy Lynn? | SELECT week_1 FROM table_name_64 WHERE week_2 = "mandy lynn" | sql_create_context |
CREATE TABLE Orders (
order_id INTEGER,
customer_id INTEGER,
date_order_placed DATETIME,
order_details VARCHAR(255)
)
CREATE TABLE Products (
product_id INTEGER,
parent_product_id INTEGER,
production_type_code VARCHAR(15),
unit_price DECIMAL(19,4),
product_name VARCHAR(80),
prod... | Show the number of accounts for all accounts by the customer with first name 'Meaghan' opened in each day Bin the account open day by weekday in a bar chart, show Y-axis in ascending order. | SELECT date_account_opened, COUNT(date_account_opened) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan' ORDER BY COUNT(date_account_opened) | nvbench |
CREATE TABLE table_8186 (
"Club" text,
"Sport" text,
"Founded" real,
"League" text,
"Venue" text
) | What kind of League has a Venue of billesley common? | SELECT "League" FROM table_8186 WHERE "Venue" = 'billesley common' | wikisql |
CREATE TABLE table_203_756 (
id number,
"year" number,
"title" text,
"role" text,
"network" text,
"notes" text
) | role played at least twice | SELECT "role" FROM table_203_756 GROUP BY "role" HAVING COUNT(*) >= 2 | squall |
CREATE TABLE table_18268930_1 (
population_served INTEGER
) | What's the minimal number of population served? | SELECT MIN(population_served) FROM table_18268930_1 | sql_create_context |
CREATE TABLE table_73829 (
"Settlement" text,
"Cyrillic Name Other Names" text,
"Type" text,
"Population (2011)" text,
"Largest ethnic group (2002)" text,
"Dominant religion (2002)" text
) | What kind of type is ? | SELECT "Type" FROM table_73829 WHERE "Cyrillic Name Other Names" = 'Бока' | wikisql |
CREATE TABLE table_name_41 (
channel VARCHAR,
opponent VARCHAR
) | Which Channel has an Opponent of washington redskins? | SELECT channel FROM table_name_41 WHERE opponent = "washington redskins" | sql_create_context |
CREATE TABLE table_name_75 (
head_coach VARCHAR,
shirt_sponsor VARCHAR
) | Who is the head coach for the team that has finke as the shirt sponsor? | SELECT head_coach FROM table_name_75 WHERE shirt_sponsor = "finke" | sql_create_context |
CREATE TABLE table_40234 (
"Administrative Panel" real,
"Agricultural Panel" real,
"Cultural and Educational Panel" real,
"Industrial and Commercial Panel" real,
"Labour Panel" real,
"National University of Ireland" real,
"University of Dublin" real,
"Nominated by the Taoiseach" real,
... | What is the sum of the Cultural and Educational Panels that have an Administrative Panel greater than 1, an Agricultural Panel of 11 and a University of Dublin smaller than 3? | SELECT SUM("Cultural and Educational Panel") FROM table_40234 WHERE "Administrative Panel" > '1' AND "Agricultural Panel" = '11' AND "University of Dublin" < '3' | wikisql |
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CRE... | SELECT DisplayName, Reputation, Id FROM Users WHERE UPPER(Location) LIKE '%ISRAEL%' ORDER B. | SELECT DisplayName, Reputation, Id AS "user_link" FROM Users WHERE UPPER(Location) LIKE '%ISRAEL%' ORDER BY 2 DESC | sede |
CREATE TABLE movie (
movie_id number,
title text,
year number,
director text,
budget_million number,
gross_worldwide number
)
CREATE TABLE culture_company (
company_name text,
type text,
incorporated_in text,
group_equity_shareholding number,
book_club_id text,
movie_id ... | Show publishers with a book published in 1989 and a book in 1990. | SELECT publisher FROM book_club WHERE year = 1989 INTERSECT SELECT publisher FROM book_club WHERE year = 1990 | spider |
CREATE TABLE table_69480 (
"Call sign" text,
"Frequency MHz" real,
"City of license" text,
"ERP W" real,
"Class" text,
"FCC info" text
) | When the call sign is wpib, what is lowest ERP W? | SELECT MIN("ERP W") FROM table_69480 WHERE "Call sign" = 'wpib' | wikisql |
CREATE TABLE table_name_26 (
date VARCHAR,
time VARCHAR
) | What date was the episode that aired at 7:30 pm ET? | SELECT date FROM table_name_26 WHERE time = "7:30 pm et" | sql_create_context |
CREATE TABLE table_200_35 (
id number,
"party" text,
"active voters" number,
"inactive voters" number,
"total voters" number,
"percentage" text
) | as of october 25 , 2005 , how many active voters does the democratic party have ? | SELECT "active voters" FROM table_200_35 WHERE "party" = 'democratic' | squall |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
... | for patient id 74032, specify duration of hospital stay and death status. | SELECT demographic.days_stay, demographic.expire_flag FROM demographic WHERE demographic.subject_id = "74032" | mimicsql_data |
CREATE TABLE table_name_59 (
home_team VARCHAR,
date VARCHAR,
away_team VARCHAR
) | What is Home Team, when Date is 18 February 1956, and when Away Team is Blackburn Rovers? | SELECT home_team FROM table_name_59 WHERE date = "18 february 1956" AND away_team = "blackburn rovers" | sql_create_context |
CREATE TABLE table_name_12 (
year INTEGER,
result VARCHAR
) | Tell me the sum of year for 5th result | SELECT SUM(year) FROM table_name_12 WHERE result = "5th" | sql_create_context |
CREATE TABLE table_77755 (
"Player" text,
"Rec." real,
"Yards" real,
"Avg." real,
"TD's" real
) | What is the highest number of TDs when the Avg is larger than 8.5 and the Rec is less than 1? | SELECT MAX("TD's") FROM table_77755 WHERE "Avg." > '8.5' AND "Rec." < '1' | wikisql |
CREATE TABLE table_name_80 (
week_6 VARCHAR,
week_2 VARCHAR
) | What kind of Week 6 has a Week 2 of see notes 2 , 3 , 4? | SELECT week_6 FROM table_name_80 WHERE week_2 = "see notes 2 , 3 , 4" | sql_create_context |
CREATE TABLE table_203_793 (
id number,
"#" number,
"date" text,
"venue" text,
"opponent" text,
"score" text,
"result" text,
"competition" text
) | what year did he score more goals than any other year ? | SELECT "date" FROM table_203_793 GROUP BY "date" ORDER BY COUNT(*) DESC LIMIT 1 | squall |
CREATE TABLE table_20460 (
"Member State sorted by GDP" text,
"GDP in s billion of USD (2012)" text,
"GDP % of EU (2012)" text,
"Annual change % of GDP (2012)" text,
"GDP per capita in PPP US$ (2012)" real,
"Public Debt % of GDP (2013 Q1)" text,
"Deficit (-)/ Surplus (+) % of GDP (2012)" tex... | What is the annual change of GDP with a 20.5% GDP of EU in 2012? | SELECT "Annual change % of GDP (2012)" FROM table_20460 WHERE "GDP % of EU (2012)" = '20.5%' | wikisql |
CREATE TABLE jybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH text,
BGJGDM text,
BGJGMC text,
BGRGH text,
BGRQ time,
BGRXM text,
BGSJ time,
CJRQ time,
JSBBRQSJ time,
JSBBSJ time,
JYBBH text,
JYJGMC text,
JYJSGH text,
JYJSQM text,
JY... | 沈玉堂这个患者所有检验报告单中的标本在2002年6月12日到2006年8月24日期间内采集的都是啥呀? | SELECT jybgb.BBCJBW FROM hz_info JOIN mzjzjlb JOIN jybgb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE hz_info.person_info_XM = '沈玉堂' AND jybgb.BGRQ BETWEEN '2002-06-12' AND '2006-08-24... | css |
CREATE TABLE table_204_261 (
id number,
"rank" number,
"nation" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
) | which countries won more total medals than bulgaria ? | SELECT "nation" FROM table_204_261 WHERE "total" > (SELECT "total" FROM table_204_261 WHERE "nation" = 'bulgaria') | squall |
CREATE TABLE table_47958 (
"Cycle" real,
"Premiere date" text,
"Winner" text,
"Runner-up" text,
"Number of contestants" text,
"International Destinations" text
) | What is the highest Cycle, when the Number of Constestants is 11, and when Premiere Date is September 3, 2012? | SELECT MAX("Cycle") FROM table_47958 WHERE "Number of contestants" = '11' AND "Premiere date" = 'september 3, 2012' | wikisql |
CREATE TABLE table_16801 (
"House Name" text,
"Composition" text,
"Named after" text,
"Founded" real,
"Colours" text
) | What is the name of the green house? | SELECT "House Name" FROM table_16801 WHERE "Colours" = 'Green' | wikisql |
CREATE TABLE table_name_38 (
home_team VARCHAR,
venue VARCHAR
) | What is the home team for punt road oval? | SELECT home_team FROM table_name_38 WHERE venue = "punt road oval" | sql_create_context |
CREATE TABLE table_name_8 (
decision VARCHAR,
date VARCHAR
) | what is the decision on the date march 18? | SELECT decision FROM table_name_8 WHERE date = "march 18" | sql_create_context |
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
) | For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and price , and group by attribute name, rank Name in asc order. | SELECT T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name, T1.Name ORDER BY T1.Name | nvbench |
CREATE TABLE school (
School_ID int,
Grade text,
School text,
Location text,
Type text
)
CREATE TABLE school_bus (
School_ID int,
Driver_ID int,
Years_Working int,
If_full_time bool
)
CREATE TABLE driver (
Driver_ID int,
Name text,
Party text,
Home_city text,
Ag... | Show the party and the number of drivers in each party with a bar chart, display from low to high by the Y. | SELECT Party, COUNT(*) FROM driver GROUP BY Party ORDER BY COUNT(*) | nvbench |
CREATE TABLE table_name_10 (
peak VARCHAR,
prom__m_ VARCHAR,
height__m_ VARCHAR
) | I want to know the peak which is prom less than 147 and height less than 619 | SELECT peak FROM table_name_10 WHERE prom__m_ < 147 AND height__m_ < 619 | sql_create_context |
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,
... | find the minimum age of divorced patients whose primary disease is brain mass;intracranial hemorrhage. | SELECT MIN(demographic.age) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.diagnosis = "BRAIN MASS;INTRACRANIAL HEMORRHAGE" | mimicsql_data |
CREATE TABLE table_10417 (
"7:00 PM" text,
"8:00 PM" text,
"8:30 PM" text,
"9:00 PM" text,
"9:30 PM" text,
"10:00 PM" text
) | What shows for 10:00 PM when the 8:00 PM is tout le monde en parle? | SELECT "10:00 PM" FROM table_10417 WHERE "8:00 PM" = 'tout le monde en parle' | wikisql |
CREATE TABLE table_47446 (
"Series Sorted" text,
"Title" text,
"Doctor" text,
"Featuring" text,
"Released" text
) | who is the featuring when the series sorted is 6eb/b? | SELECT "Featuring" FROM table_47446 WHERE "Series Sorted" = '6eb/b' | wikisql |
CREATE TABLE table_15294880_2 (
team_classification VARCHAR,
winner VARCHAR
) | When the winner was Alessandro Ballan, how many total team classifications were there? | SELECT COUNT(team_classification) FROM table_15294880_2 WHERE winner = "Alessandro Ballan" | sql_create_context |
CREATE TABLE section (
course_id text,
sec_id text,
semester text,
year number,
building text,
room_number text,
time_slot_id text
)
CREATE TABLE time_slot (
time_slot_id text,
day text,
start_hr number,
start_min number,
end_hr number,
end_min number
)
CREATE TABLE... | How many students are in each department? | SELECT COUNT(*), dept_name FROM student GROUP BY dept_name | spider |
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... | what number of patients whose procedure icd9 code is 4610 expired in or before the year 2186? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2186.0" AND procedures.icd9_code = "4610" | mimicsql_data |
CREATE TABLE table_name_4 (
pole_position VARCHAR,
round VARCHAR
) | what is the pole position of Round 9 | SELECT pole_position FROM table_name_4 WHERE round = 9 | sql_create_context |
CREATE TABLE zyb (
CLINIC_ID text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD text,
INPT_AREA_BED text,
INSURED_IDENTITY number,
INSURED_STS text,
INSU_TYPE text,
IN... | 团伙成员43929858最常开的药品排序是什么次序 | SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.PERSON_ID = '43929858' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.ME... | css |
CREATE TABLE table_24070 (
"Game" real,
"Date" text,
"Opponent" text,
"Result" text,
"Sun Devils points" real,
"Opponents" real,
"Record" text
) | How many opponents led to an exactly 7-0 record? | SELECT COUNT("Opponent") FROM table_24070 WHERE "Record" = '7-0' | wikisql |
CREATE TABLE table_204_258 (
id number,
"location" text,
"frequency" number,
"call sign" text,
"network" text,
"call sign meaning" text
) | what is the last frequency on the chart ? | SELECT "frequency" FROM table_204_258 ORDER BY id DESC LIMIT 1 | squall |
CREATE TABLE table_204_734 (
id number,
"first name" text,
"surname" text,
"death year" number,
"beginning of\nservice" text,
"end of\nservice" text,
"notes" text
) | what first name is just previous to kempf ? | SELECT "first name" FROM table_204_734 WHERE id = (SELECT id FROM table_204_734 WHERE "first name" = 'kempf') - 1 | squall |
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
UserId number,
UserDisplayName text,
Comment tex... | Top answers in algorithm tag since 2011. | SELECT Users.DisplayName, COUNT(*) AS UpVotes FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId INNER JOIN Votes ON Votes.PostId = Posts.Id INNER JOIN Users ON Posts.OwnerUserId = Users.Id WHERE Votes.VoteTypeId = 2 AND Posts.CommunityOwnedDate IS NULL AND Ta... | sede |
CREATE TABLE wine (
No INTEGER,
Grape TEXT,
Winery TEXT,
Appelation TEXT,
State TEXT,
Name TEXT,
Year INTEGER,
Price INTEGER,
Score INTEGER,
Cases INTEGER,
Drink TEXT
)
CREATE TABLE appellations (
No INTEGER,
Appelation TEXT,
County TEXT,
State TEXT,
Area... | A bar chart about the average of maximum score of wines each year, bin the year into the weekday interval. | SELECT Year, AVG(MAX(Score)) FROM wine | nvbench |
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_DIRE_CD text,
MED_DIRE_NM text,... | 7734587号医院的42244科室在04年2月19号到21年8月21号期间不是其负责的所有医疗就诊记录哪些? | SELECT * FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '7734587' AND t_kc21.IN_HOSP_DATE BETWEEN '2004-02-19' AND '2021-08-21' EXCEPT SELECT * FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '7734587' AND t_kc21.IN_HOSP_DATE BETWEEN '2004-02-19' AND '2021-08-21' AND t_kc21.MED_ORG_DEPT_CD = '42244' | css |
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate tim... | FROM Posts SELECT Tags WHERE Id = 1. | SELECT Tags FROM Posts WHERE Id = 1 | sede |
CREATE TABLE table_65080 (
"Actor" text,
"Character" text,
"Soap Opera" text,
"Years" text,
"Duration" text
) | what is the soap opera when the years are 2000 2004, 2005 ? | SELECT "Soap Opera" FROM table_65080 WHERE "Years" = '2000–2004, 2005—' | wikisql |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose_val_rx text,
dose_unit_rx text,
route text
... | list the top five most frequent diagnoses of patients who were diagnosed within the same month after receiving reopen recent lap site since 2103. | SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, 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 = admissi... | mimic_iii |
CREATE TABLE table_221375_1 (
municipalities INTEGER,
province_of_1936 VARCHAR
) | Name the most municipalities for alto alentejo province (partly ribatejo) | SELECT MAX(municipalities) FROM table_221375_1 WHERE province_of_1936 = "Alto Alentejo Province (partly Ribatejo)" | sql_create_context |
CREATE TABLE table_52368 (
"Party" text,
"Leader" text,
"Votes" real,
"Percentage" text,
"Seats" real
) | What is the number of votes for the Party of Labour? | SELECT MIN("Votes") FROM table_52368 WHERE "Party" = 'labour' | wikisql |
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fare int
)
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
CREATE TABLE flight (
aircraft_code_sequence text,
airline_code varchar,
airline_fl... | looking for flights in TORONTO to SAN DIEGO | 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 = 'TORONTO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN DI... | atis |
CREATE TABLE table_11173827_1 (
english_title VARCHAR,
premiere VARCHAR,
finale VARCHAR
) | What is the english title where the premiere is less than 30.0 and the finale is bigger than 36.0? | SELECT english_title FROM table_11173827_1 WHERE premiere < 30.0 AND finale > 36.0 | sql_create_context |
CREATE TABLE table_name_46 (
name VARCHAR,
street_address VARCHAR
) | Street Address of 980 n. michigan avenue is what name? | SELECT name FROM table_name_46 WHERE street_address = "980 n. michigan avenue" | sql_create_context |
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... | provide the number of patients whose primary disease is abdominal pain and age is less than 67? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ABDOMINAL PAIN" AND demographic.age < "67" | mimicsql_data |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TA... | count the number of patients who received a ace inhibitor - lisinopril procedure within 2 months following a diagnosis of change in mental status since 2 years ago. | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'change in mental status' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-2 year')) AS t1... | eicu |
CREATE TABLE table_18159601_1 (
collegiate_institution VARCHAR,
city VARCHAR
) | what is the collegiate institution in queens | SELECT collegiate_institution FROM table_18159601_1 WHERE city = "Queens" | sql_create_context |
CREATE TABLE table_name_8 (
bb_pop VARCHAR,
riaa VARCHAR,
year VARCHAR
) | What is the BB Pop for the song with RIAA of G that was in a year earlier than 1961? | SELECT bb_pop FROM table_name_8 WHERE riaa = "g" AND year < 1961 | sql_create_context |
CREATE TABLE table_name_61 (
date VARCHAR,
attendance VARCHAR
) | Where attendance is 79,431 what is date? | SELECT date FROM table_name_61 WHERE attendance = "79,431" | sql_create_context |
CREATE TABLE VoteTypes (
Id number,
Name text
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAc... | Answers that took way too long to accept (single user). Answers that took the longest from being posted to being accepted. Only answers that are currently accepted are counted. This query is for a single user; for all users, see query 695493. | SELECT Posts.Id AS "post_link", DATEDIFF(day, Posts.CreationDate, CreationDate) AS "time_taken_to_accept_in_days", ROUND(DATEDIFF(day, Posts.CreationDate, CreationDate) / 12.0, 0) AS "in_months", ROUND(DATEDIFF(day, Posts.CreationDate, CreationDate) / 365.0, 1) AS "and_in_years" FROM Posts JOIN Votes ON Posts.Id = Vote... | sede |
CREATE TABLE zyjzjlb (
CYBQDM text,
CYBQMC text,
CYCWH text,
CYKSDM text,
CYKSMC text,
CYSJ time,
CYZTDM number,
HZXM text,
JZKSDM text,
JZKSMC text,
JZLSH text,
KH text,
KLX number,
MZBMLX number,
MZJZLSH text,
MZZDBM text,
MZZDMC text,
MZZYZDZZBM... | 沈安娜这位病人在05年2月20日到10年8月10号所开出的检验报告单的全部科室编码以及名称各是什么? | SELECT jybgb.KSBM, jybgb.KSMC FROM person_info JOIN hz_info JOIN zzmzjzjlb JOIN jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE person_... | css |
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
... | what was patient 4401's last time of taking .9% normal saline today? | SELECT inputevents_cv.charttime 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 inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label ... | mimic_iii |
CREATE TABLE table_70289 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text
) | What was the date of the game when the record was 9 5 2? | SELECT "Date" FROM table_70289 WHERE "Record" = '9–5–2' | wikisql |
CREATE TABLE table_27833469_1 (
series__number VARCHAR,
season__number VARCHAR
) | What is the series number for the episode number 10 of the season? | SELECT series__number FROM table_27833469_1 WHERE season__number = "10" | sql_create_context |
CREATE TABLE table_55032 (
"Outcome" text,
"Date" text,
"Surface" text,
"Opponent" text,
"Score" text
) | Which opponent has an Outcome of winner, and a Date of 5 november 2011? | SELECT "Opponent" FROM table_55032 WHERE "Outcome" = 'winner' AND "Date" = '5 november 2011' | wikisql |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
ic... | what are the top three most common diagnoses of people in 20s? | SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 20 AND 29) GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 3 | eicu |
CREATE TABLE table_204_986 (
id number,
"#" number,
"event year" number,
"season" text,
"flag bearer" text
) | what is the total number of years ele opeloge was the samoa flag bearer at the olympics ? | SELECT COUNT("event year") FROM table_204_986 WHERE "flag bearer" = 'ele opeloge' | squall |
CREATE TABLE table_74583 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What is the average crowd size when Collingwood is the away team? | SELECT AVG("Crowd") FROM table_74583 WHERE "Away team" = 'collingwood' | wikisql |
CREATE TABLE table_61815 (
"Opposing Teams" text,
"Against" real,
"Date" text,
"Venue" text,
"Status" text
) | What is the smallest Against with a Date of 18/02/1989? | SELECT MIN("Against") FROM table_61815 WHERE "Date" = '18/02/1989' | wikisql |
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE prescriptions (
row_id number,
subject_id num... | what are the top three most common diagnoses of people in 60 or above until 2104? | 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 diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age >= 60) ... | mimic_iii |
CREATE TABLE table_53052 (
"Code" real,
"Type" text,
"Name" text,
"Area (km 2 )" real,
"Population" real,
"Regional County Municipality" text,
"Region" real
) | What is the highest region number with a 499 population? | SELECT MAX("Region") FROM table_53052 WHERE "Population" = '499' | wikisql |
CREATE TABLE table_16782 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"U.S. viewers (millions)" text
) | How many titles were directed in series 79? | SELECT COUNT("Directed by") FROM table_16782 WHERE "No. in series" = '79' | wikisql |
CREATE TABLE table_11874 (
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text
) | In what venue was the 1978 FIFA world cup qualification played in? | SELECT "Venue" FROM table_11874 WHERE "Competition" = '1978 fifa world cup qualification' | wikisql |
CREATE TABLE table_204_532 (
id number,
"season" text,
"tier" number,
"division" text,
"place" text
) | where did they place the last season ? | SELECT "place" FROM table_204_532 ORDER BY "season" DESC LIMIT 1 | squall |
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
)
... | what is discharge location and discharge time of subject name thomas nazario? | SELECT demographic.discharge_location, demographic.dischtime FROM demographic WHERE demographic.name = "Thomas Nazario" | mimicsql_data |
CREATE TABLE table_name_88 (
founded INTEGER,
joined INTEGER
) | Name the average founded with joined less than 2008 | SELECT AVG(founded) FROM table_name_88 WHERE joined < 2008 | sql_create_context |
CREATE TABLE table_name_82 (
ihsaa_class VARCHAR,
_number___county VARCHAR,
mascot VARCHAR
) | Name the IHSAA class with county 18 delaware and tigers mascot | SELECT ihsaa_class FROM table_name_82 WHERE _number___county = "18 delaware" AND mascot = "tigers" | sql_create_context |
CREATE TABLE table_204_438 (
id number,
"year" number,
"title" text,
"album" text,
"us r&b" number,
"us pop" number,
"us dance" number
) | what was the difference in r & b ranking between come go with me and dance 4 me . ? | SELECT ABS((SELECT "us r&b" FROM table_204_438 WHERE "title" = '"come go with me"') - (SELECT "us r&b" FROM table_204_438 WHERE "title" = '"dance 4 me"')) | squall |
CREATE TABLE table_name_45 (
country VARCHAR,
previous_team__league_ VARCHAR,
player VARCHAR
) | What is Country, when Previous Team (League) is 'Kingston Frontenacs ( OHL )', and when Player is 'Anthony Stewart Category:Articles with hCards'? | SELECT country FROM table_name_45 WHERE previous_team__league_ = "kingston frontenacs ( ohl )" AND player = "anthony stewart category:articles with hcards" | sql_create_context |
CREATE TABLE table_41629 (
"Name" text,
"Career" text,
"Goals" real,
"Appearances" real,
"Goals/Game Ratio" real
) | Which goals/game ratio has fewer than 201 goals and fewer than 170 appearances? | SELECT "Goals/Game Ratio" FROM table_41629 WHERE "Goals" < '201' AND "Appearances" < '170' | wikisql |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Comments (
Id number,... | My suggested edit votes that got overruled. Provides links to the suggested edits that you voted on, where the outcome went against your vote. | SELECT edit.PostId, edit.Id AS "suggested_edit_link" FROM SuggestedEditVotes AS vote, SuggestedEdits AS edit WHERE vote.UserId = @UserId AND vote.SuggestedEditId = edit.Id AND (NOT edit.ApprovalDate IS NULL AND vote.VoteTypeId = 3 OR NOT edit.RejectionDate IS NULL AND vote.VoteTypeId = 2) | sede |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.