context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE table_name_4 (
goal_difference VARCHAR,
goals_against VARCHAR,
played VARCHAR
) | Tell me the totla number of goal difference for goals against of 30 and played less than 18 | SELECT COUNT(goal_difference) FROM table_name_4 WHERE goals_against = 30 AND played < 18 | sql_create_context |
CREATE TABLE table_204_59 (
id number,
"rank" number,
"athlete" text,
"nationality" text,
"time" text
) | anna zagorska recieved 2nd place , what was her time ? | SELECT "time" FROM table_204_59 WHERE "athlete" = 'anna zagorska' | squall |
CREATE TABLE table_14984050_1 (
result VARCHAR,
game_site VARCHAR
) | Name the result for milwaukee county stadium | SELECT result FROM table_14984050_1 WHERE game_site = "Milwaukee County Stadium" | sql_create_context |
CREATE TABLE table_13375 (
"Position" text,
"Name" text,
"Party" text,
"First Election" text,
"District" text
) | What Position does First Elected in 2003 William D. Euille hold ? | SELECT "Position" FROM table_13375 WHERE "First Election" = '2003' AND "Name" = 'william d. euille' | wikisql |
CREATE TABLE table_name_59 (
attendance VARCHAR,
record VARCHAR
) | How many attended the game with a record of 43-34? | SELECT COUNT(attendance) FROM table_name_59 WHERE record = "43-34" | sql_create_context |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
... | what is the last value of urea nitrogen laboratory test of patient 75762 on their first hospital encounter? | SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 75762 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'urea ... | mimic_iii |
CREATE TABLE table_29486 (
"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
) | What's the highest season number with a series number of 47? | SELECT MAX("No. in Season") FROM table_29486 WHERE "No. in Series" = '47' | wikisql |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime t... | had patient 030-47098 been treated since 4 years ago in other hospitals with a administration of electrolytes - intravenous procedure? | SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '030-47098' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '030-47098' AND patient.hospitaldischargetime IS NULL)) AND tr... | eicu |
CREATE TABLE table_name_80 (
result VARCHAR,
date VARCHAR
) | What was the final game result that was played on December 2? | SELECT result FROM table_name_80 WHERE date = "december 2" | sql_create_context |
CREATE TABLE table_name_55 (
weight_division VARCHAR,
method VARCHAR
) | What was the weight division for the fight that ended in a TKO (strikes)? | SELECT weight_division FROM table_name_55 WHERE method = "tko (strikes)" | sql_create_context |
CREATE TABLE train_station (
Train_ID int,
Station_ID int
)
CREATE TABLE station (
Station_ID int,
Name text,
Annual_entry_exit real,
Annual_interchanges real,
Total_Passengers real,
Location text,
Main_Services text,
Number_of_Platforms int
)
CREATE TABLE train (
Train_ID ... | Show the names and total passengers for all train stations not in London Visualize by bar chart, and show by the X-axis from high to low. | SELECT Name, Total_Passengers FROM station WHERE Location <> 'London' ORDER BY Name DESC | nvbench |
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total_gpa float,
entered_as varchar,
a... | 7 credits are for which upper-level classes ? | SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.credits = 7 AND program_course.category LIKE 'ULCS' | advising |
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,
... | what is the maximum age of patients with admission location trsf within this facility and diagnosed with primary disease liver transplant? | SELECT MAX(demographic.age) FROM demographic WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.diagnosis = "LIVER TRANSPLANT" | mimicsql_data |
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TABLE food_service (
meal_code text,
meal_number int,
compartment text,
meal_description varchar
)
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name var... | i need a sunday flight from TAMPA to 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, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'CHARLOTTE' AND date_day.day_number = 27 AND date_day.month_number = 8 AND... | atis |
CREATE TABLE table_49034 (
"Name" text,
"Team" text,
"Qual 1" text,
"Qual 2" text,
"Best" text
) | What is Team when Qual 1 is 1:20.139? | SELECT "Team" FROM table_49034 WHERE "Qual 1" = '1:20.139' | wikisql |
CREATE TABLE table_2248784_3 (
rank_world VARCHAR,
rank_subcontinent VARCHAR
) | Name the rank world for 7 rank subcontinent | SELECT rank_world FROM table_2248784_3 WHERE rank_subcontinent = 7 | sql_create_context |
CREATE TABLE table_55810 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | When was the game played at the Western Oval venue? | SELECT "Date" FROM table_55810 WHERE "Venue" = 'western oval' | wikisql |
CREATE TABLE table_name_51 (
priority_entry_rights_to_derby VARCHAR,
race_name VARCHAR
) | What is the Priority-entry-rights to Derby in rank 4? | SELECT priority_entry_rights_to_derby FROM table_name_51 WHERE NOT race_name = 4 | sql_create_context |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
... | how many patients are under age 55 and tested with lab item id 51026? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "55" AND lab.itemid = "51026" | mimicsql_data |
CREATE TABLE table_name_30 (
storage_stability INTEGER,
field_stability VARCHAR,
toxicity_as_blood_agent VARCHAR,
agent VARCHAR
) | What is the storage stability of Arsine with a toxicity of 8, and field stability less than 5? | SELECT MIN(storage_stability) FROM table_name_30 WHERE toxicity_as_blood_agent > 8 AND agent = "arsine" AND field_stability < 5 | sql_create_context |
CREATE TABLE mzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH text,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
KH text,
KLX number,
MJZH text,
ML number,
MZZYZDZZBM text,
MZZYZDZZMC ... | 列出患者柳阳文所有检验结果指标记录的检测人为61543019的检验指标流水号有多少在在2007-05-14到2020-07-28内? | SELECT jyjgzbb.JYZBLSH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jyjgzbb.jybgb_YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jyjgzbb.jybgb_JZLSH_MZJZJLB WHERE person_i... | css |
CREATE TABLE table_name_66 (
rank VARCHAR,
chassis VARCHAR,
year VARCHAR
) | What rank did the chassis reynard 94i have in 1996? | SELECT rank FROM table_name_66 WHERE chassis = "reynard 94i" AND year = "1996" | sql_create_context |
CREATE TABLE hz_info_mzjzjlb (
JZLSH number,
YLJGDM number,
mzjzjlb_id number
)
CREATE TABLE person_info (
CSD text,
CSRQ time,
GJDM text,
GJMC text,
JGDM text,
JGMC text,
MZDM text,
MZMC text,
RYBH text,
XBDM number,
XBMC text,
XLDM text,
XLMC text,
... | 在门诊就诊中开出的检验报告单编号是18617943504对应的患者姓名可以告诉我吗? | SELECT person_info.XM FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZ... | css |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE cost (
costid number,
u... | did patient 013-33898 undergone oxygen therapy (40% to 60%) - non-rebreather mask procedure since 2100? | SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-33898')) AND treatment.treatmentname = 'oxygen therapy (40% to 60%) - no... | eicu |
CREATE TABLE table_47456 (
"Election" text,
"Candidate" text,
"Number of votes" text,
"Share of votes" text,
"Outcome of election" text
) | What is the outcome of the election with 43.3% share of votes? | SELECT "Outcome of election" FROM table_47456 WHERE "Share of votes" = '43.3%' | wikisql |
CREATE TABLE table_name_86 (
name VARCHAR,
age_as_of_1_february_2014 VARCHAR
) | Who is 111years, 358days Age as of 1 February 2014? | SELECT name FROM table_name_86 WHERE age_as_of_1_february_2014 = "111years, 358days" | sql_create_context |
CREATE TABLE table_1404984_1 (
call_sign VARCHAR,
virtual_channel VARCHAR
) | What is channel 33.7's official call sign? | SELECT call_sign FROM table_1404984_1 WHERE virtual_channel = "33.7" | sql_create_context |
CREATE TABLE Ref_Document_Types (
document_type_code CHAR(15),
document_type_description VARCHAR(255)
)
CREATE TABLE Employees (
employee_id INTEGER,
role_code CHAR(15),
employee_name VARCHAR(255),
other_details VARCHAR(255)
)
CREATE TABLE Addresses (
address_id INTEGER,
address_detail... | Show a bar chart about how many employees does each role have?, and I want to display Y in ascending order please. | SELECT role_description, COUNT(*) FROM Roles AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code GROUP BY T2.role_code ORDER BY COUNT(*) | nvbench |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
... | how many of the patients admitted on transfer from hosp/extram had a hospital stay of more than 26 days? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.days_stay > "26" | mimicsql_data |
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
UserId number,
UserDisplayName text,
Comment text,
Text text,
ContentLicense text
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous... | all posts with all fields. | SELECT * FROM PostHistoryTypes | sede |
CREATE TABLE copyright (
id int,
msid int,
cid int
)
CREATE TABLE producer (
pid int,
gender text,
name text,
nationality text,
birth_city text,
birth_year int
)
CREATE TABLE movie (
mid int,
title text,
release_year int,
title_aka text,
budget text
)
CREATE TA... | Find all movies in which ' Robin Wright ' appears | SELECT movie.title FROM actor, cast, movie WHERE actor.name = 'Robin Wright' AND cast.aid = actor.aid AND movie.mid = cast.msid | imdb |
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
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,
lan... | how many times do patient 55360's visit the icu in 2105? | SELECT COUNT(DISTINCT icustays.icustay_id) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 55360) AND STRFTIME('%y', icustays.intime) = '2105' | mimic_iii |
CREATE TABLE table_name_33 (
player VARCHAR,
place VARCHAR,
score VARCHAR
) | Can you tell me the Player that has the Place of t5, and the Score of 73-72-71-75=291? | SELECT player FROM table_name_33 WHERE place = "t5" AND score = 73 - 72 - 71 - 75 = 291 | sql_create_context |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
... | what is drug type of drug name sodium chloride 3% inhalation soln? | SELECT prescriptions.drug_type FROM prescriptions WHERE prescriptions.drug = "Sodium Chloride 3% Inhalation Soln" | mimicsql_data |
CREATE TABLE table_name_90 (
rank VARCHAR,
height__ft_ VARCHAR,
city VARCHAR,
floors VARCHAR
) | what is the rank for the city of cologne, floors is 34 and height (ft) is more than 452.8? | SELECT COUNT(rank) FROM table_name_90 WHERE city = "cologne" AND floors = 34 AND height__ft_ > 452.8 | sql_create_context |
CREATE TABLE table_name_84 (
capacity INTEGER,
team VARCHAR
) | What is the smallest capacity for Fandok? | SELECT MIN(capacity) FROM table_name_84 WHERE team = "fandok" | sql_create_context |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime t... | count the number of patients who received insulin - continuous infusion in the same hospital encounter after their respiratory arrest was diagnosed during this year. | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'respiratory arrest' AND DATETIME(diagnosis.diagnosistime, 'start of year'... | eicu |
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 are the three most commonly ordered specimen tests for patients who had previously been diagnosed with acute respiratory failure - due to neurological process in the same month, since 4 years ago? | SELECT t3.culturesite FROM (SELECT t2.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'acute respiratory failure - due to neurologi... | eicu |
CREATE TABLE table_19210115_1 (
affiliation VARCHAR,
nickname VARCHAR
) | What is the affiliation of the University called Explorers? | SELECT affiliation FROM table_19210115_1 WHERE nickname = "Explorers" | sql_create_context |
CREATE TABLE table_31296 (
"Round" real,
"Country" text,
"Circuit" text,
"Date" text,
"Pole Position" text,
"Fastest Lap" text,
"Winning Rider" text,
"Winning Team" text,
"Report" text
) | what is the circuit where the fastest lap is sam lowes and the winning rider is luca scassa? | SELECT "Circuit" FROM table_31296 WHERE "Fastest Lap" = 'Sam Lowes' AND "Winning Rider" = 'Luca Scassa' | wikisql |
CREATE TABLE table_train_249 (
"id" int,
"gender" string,
"allergy_to_dapagliflozin" bool,
"body_weight" float,
"estimated_glomerular_filtration_rate_egfr" int,
"body_mass_index_bmi" float,
"age" float,
"NOUSE" float
) | glomerular filtration rate ( gfr ) < 60 ml / min / 1.73 m2 | SELECT * FROM table_train_249 WHERE estimated_glomerular_filtration_rate_egfr < 60 | criteria2sql |
CREATE TABLE table_62575 (
"Team 1" text,
"Score" text,
"Team 2" text,
"1st round" text,
"2nd round" text
) | What shows for the 1st round when the team 1 was Lb Ch teauroux (d2)? | SELECT "1st round" FROM table_62575 WHERE "Team 1" = 'lb châteauroux (d2)' | wikisql |
CREATE TABLE table_2538117_5 (
type VARCHAR,
letters VARCHAR
) | What type is ? | SELECT type FROM table_2538117_5 WHERE letters = "ΣΑΕΠ" | sql_create_context |
CREATE TABLE table_203_761 (
id number,
"pos" number,
"no" number,
"driver" text,
"team" text,
"laps" number,
"time/retired" text,
"grid" number,
"points" number
) | who placed next after paul tracy ? | SELECT "driver" FROM table_203_761 WHERE "pos" = (SELECT "pos" FROM table_203_761 WHERE "driver" = 'paul tracy') + 1 | squall |
CREATE TABLE mission (
Mission_ID int,
Ship_ID int,
Code text,
Launched_Year int,
Location text,
Speed_knots int,
Fate text
)
CREATE TABLE ship (
Ship_ID int,
Name text,
Type text,
Nationality text,
Tonnage int
) | What is the total number of each fate? Give me the result in a bar graph, and display in desc by the the number of fate please. | SELECT Fate, COUNT(Fate) FROM mission GROUP BY Fate ORDER BY COUNT(Fate) DESC | nvbench |
CREATE TABLE table_name_42 (
colour VARCHAR,
built VARCHAR
) | What is the color of the locomotive built by Minirail 1954? | SELECT colour FROM table_name_42 WHERE built = "minirail 1954" | sql_create_context |
CREATE TABLE table_30047613_12 (
date VARCHAR,
streak VARCHAR
) | in which date the strea was w 2 | SELECT date FROM table_30047613_12 WHERE streak = "W 2" | sql_create_context |
CREATE TABLE company (
rank VARCHAR,
company VARCHAR,
market_value VARCHAR,
main_industry VARCHAR,
sales_billion VARCHAR,
profits_billion VARCHAR
) | find the rank, company names, market values of the companies in the banking industry order by their sales and profits in billion. | SELECT rank, company, market_value FROM company WHERE main_industry = 'Banking' ORDER BY sales_billion, profits_billion | sql_create_context |
CREATE TABLE table_10557 (
"Year" real,
"Butterfly" text,
"Artist" text,
"Mintage" real,
"Issue Price" text,
"Finish" text
) | Which artist's work is the butterfly Tiger Swallowtail? | SELECT "Artist" FROM table_10557 WHERE "Butterfly" = 'tiger swallowtail' | wikisql |
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit text,
first_wardid number,
last_wardid number,
intime time,
outtime time
)
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
... | what is the procedure, which patient 63676 underwent two or more times in 04/this year? | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 636... | mimic_iii |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wa... | count the number of times that patient 031-22988 in their first hospital encounter had a gastric (ng) output. | SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-22988' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.... | eicu |
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... | Find the number of female patients that survived. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.expire_flag = "0" | mimicsql_data |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | count the number of patients whose religion is greek orthodox and diagnoses long title is drug-induced delirium? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.religion = "GREEK ORTHODOX" AND diagnoses.long_title = "Drug-induced delirium" | mimicsql_data |
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
dual_airline varchar,
service_name text
)
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fare int
)
CREATE TABLE airline (
airline_code... | show me the flights from BOSTON to DENVER | 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 = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER'... | atis |
CREATE TABLE Part_Faults (
part_fault_id INTEGER,
part_id INTEGER,
fault_short_name VARCHAR(20),
fault_description VARCHAR(255),
other_fault_details VARCHAR(255)
)
CREATE TABLE Assets (
asset_id INTEGER,
maintenance_contract_id INTEGER,
supplier_company_id INTEGER,
asset_details VAR... | How many engineers did each staff contact? List both the contact staff name and number of engineers contacted Plot them as bar chart, I want to order in desc by the y axis. | SELECT staff_name, COUNT(*) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id GROUP BY T1.staff_name ORDER BY COUNT(*) DESC | nvbench |
CREATE TABLE table_name_86 (
total INTEGER,
country VARCHAR
) | What is Australia's highest total? | SELECT MAX(total) FROM table_name_86 WHERE country = "australia" | sql_create_context |
CREATE TABLE table_name_89 (
segment_d VARCHAR,
series_ep VARCHAR
) | What is Segment D of 20-08 series Ep.? | SELECT segment_d FROM table_name_89 WHERE series_ep = "20-08" | sql_create_context |
CREATE TABLE table_name_6 (
record VARCHAR,
home VARCHAR
) | What is the record of the team from chicago? | SELECT record FROM table_name_6 WHERE home = "chicago" | sql_create_context |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id t... | what is the number of patients whose primary disease is aortic valve insuffiency\aortic valve replacement /sda and days of hospital stay is greater than 27? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" AND demographic.days_stay > "27" | mimicsql_data |
CREATE TABLE table_203_330 (
id number,
"year of election" number,
"candidates elected" number,
"# of seats available" number,
"# of votes" number,
"% of popular vote" text
) | how many candidates were elected in 1971 ? | SELECT "candidates elected" FROM table_203_330 WHERE "year of election" = 1971 | squall |
CREATE TABLE table_49717 (
"Year" real,
"U.S." text,
"U.S. R&B" text,
"U.S. Rap" text,
"Album" text
) | What is the U.S. rap ranking in 2000 of the U.S. 105 single? | SELECT "U.S. Rap" FROM table_49717 WHERE "Year" = '2000' AND "U.S." = '105' | wikisql |
CREATE TABLE table_53160 (
"Rd #" real,
"Pick #" real,
"Player" text,
"Team (League)" text,
"Reg GP" real,
"Pl GP" real
) | What is the highest PL GP for a round greater than 9? | SELECT MAX("Pl GP") FROM table_53160 WHERE "Rd #" > '9' | wikisql |
CREATE TABLE Companies (
Id VARCHAR
) | How many companies are there? | SELECT COUNT(*) FROM Companies | sql_create_context |
CREATE TABLE table_29029 (
"Season" real,
"Series" text,
"Team Name" text,
"Races" real,
"Poles" real,
"Wins" real,
"Podiums" real,
"F/Laps" real,
"Points" text,
"Final Placing" text
) | When there were 30 races and the final placing was 13th, how many points were scored? | SELECT "Points" FROM table_29029 WHERE "Final Placing" = '13th' AND "Races" = '30' | wikisql |
CREATE TABLE table_name_50 (
season VARCHAR,
acquisition_via VARCHAR,
number VARCHAR
) | What is the Season with an Acquisition via of rookie draft, and the number is 15? | SELECT season FROM table_name_50 WHERE acquisition_via = "rookie draft" AND number = "15" | sql_create_context |
CREATE TABLE table_50249 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text,
"Money ( $ )" real
) | What is the lowest amount of money player jim colbert has? | SELECT MIN("Money ( $ )") FROM table_50249 WHERE "Player" = 'jim colbert' | wikisql |
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 Votes (
Id number,
PostId number,
VoteTypeId nu... | top hundred user for rajkot. | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%Bengalore%' OR UPPER(Location) LIKE '%BENGALORE' ORDER BY Reputation DESC LIMIT 100 | sede |
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,... | what is the cheapest flight from DENVER to PITTSBURGH | 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, fare, flight, flight_fare WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.... | atis |
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
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,
insuranc... | on 12/24/2105 the arterial bp [systolic] of patient 12775 had been normal? | SELECT COUNT(*) > 0 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 = 12775)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [syst... | mimic_iii |
CREATE TABLE table_203_257 (
id number,
"week" number,
"date" text,
"opponent" text,
"result" text,
"attendance" number
) | how many people attended the new york giants game on october 25 , 1981 ? | SELECT "attendance" FROM table_203_257 WHERE "opponent" = 'new york giants' AND "date" = 'october 25, 1981' | squall |
CREATE TABLE table_14465 (
"Year" real,
"Entrant" text,
"Chassis" text,
"Engine" text,
"Points" real
) | What is the number of points for the maserati straight-4 engine, later than 1959? | SELECT COUNT("Points") FROM table_14465 WHERE "Engine" = 'maserati straight-4' AND "Year" > '1959' | wikisql |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic (... | how many female patients were born before the year 1821? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.dob_year < "1821" | mimicsql_data |
CREATE TABLE Block (
BlockFloor INTEGER,
BlockCode INTEGER
)
CREATE TABLE Physician (
EmployeeID INTEGER,
Name VARCHAR(30),
Position VARCHAR(30),
SSN INTEGER
)
CREATE TABLE Medication (
Code INTEGER,
Name VARCHAR(30),
Brand VARCHAR(30),
Description VARCHAR(30)
)
CREATE TABLE P... | How many medications are prescribed for each brand Visualize by bar chart, I want to display in desc by the x axis. | SELECT Name, COUNT(*) FROM Medication AS T1 JOIN Prescribes AS T2 ON T1.Code = T2.Medication GROUP BY T1.Brand ORDER BY Name DESC | nvbench |
CREATE TABLE paper (
paperid int,
title varchar,
venueid int,
year int,
numciting int,
numcitedby int,
journalid int
)
CREATE TABLE venue (
venueid int,
venuename varchar
)
CREATE TABLE journal (
journalid int,
journalname varchar
)
CREATE TABLE writes (
paperid int,
... | highly cited sentiment analysis papers | SELECT DISTINCT cite.citedpaperid, COUNT(cite.citedpaperid) FROM cite, keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'sentiment analysis' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = cite.citedpaperid AND paper.paperid = paperkeyphrase.paperid GROUP BY cite.citedpaperid ... | scholar |
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
) | For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of name and code , and group by attribute headquarter, and list in ascending by the Y-axis. | SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name ORDER BY T1.Code | 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 with private insurance had spinal canal explor nec? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.short_title = "Spinal canal explor NEC" | mimicsql_data |
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId... | What would my uncapped reputation be?. | SELECT SUM(CASE WHEN VoteTypeId = 1 THEN 15 WHEN VoteTypeId = 2 AND PostTypeId = 1 THEN 5 WHEN VoteTypeId = 2 AND PostTypeId = 2 THEN 10 WHEN VoteTypeId = 3 THEN -2 WHEN VoteTypeId = 9 THEN BountyAmount END) AS UncappedReputation FROM Votes INNER JOIN Posts ON Posts.Id = Votes.PostId WHERE Posts.OwnerUserId = @UserId | sede |
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 month (
... | what are your flights from PITTSBURGH to BALTIMORE | 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 = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BAL... | atis |
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... | 查一查医院9861939全部医疗就诊的记录里按科室和入院时的诊断不同算出病人平均岁数有多大,然后把其中平均值小于3岁的记录留下 | SELECT qtb.MED_ORG_DEPT_NM, qtb.IN_DIAG_DIS_NM, AVG(qtb.PERSON_AGE) FROM qtb WHERE qtb.MED_SER_ORG_NO = '9861939' GROUP BY qtb.MED_ORG_DEPT_NM, qtb.IN_DIAG_DIS_NM HAVING AVG(qtb.PERSON_AGE) < 3 UNION SELECT gyb.MED_ORG_DEPT_NM, gyb.IN_DIAG_DIS_NM, AVG(gyb.PERSON_AGE) FROM gyb WHERE gyb.MED_SER_ORG_NO = '9861939' GROUP ... | css |
CREATE TABLE table_204_337 (
id number,
"festival" text,
"year" number,
"award" text,
"nominee" text,
"result" text
) | how many more winners were there than nominees ? | SELECT (SELECT COUNT(*) FROM table_204_337 WHERE "result" = 'won') - (SELECT COUNT(*) FROM table_204_337 WHERE "result" = 'nominated') | squall |
CREATE TABLE status (
station_id number,
bikes_available number,
docks_available number,
time text
)
CREATE TABLE trip (
id number,
duration number,
start_date text,
start_station_name text,
start_station_id number,
end_date text,
end_station_name text,
end_station_id nu... | For each zip code, find the ids of all trips that have a higher average mean temperature above 60? | SELECT T1.id FROM trip AS T1 JOIN weather AS T2 ON T1.zip_code = T2.zip_code GROUP BY T2.zip_code HAVING AVG(T2.mean_temperature_f) > 60 | spider |
CREATE TABLE table_203_131 (
id number,
"pos." number,
"car #" number,
"driver" text,
"make" text,
"team" text
) | how many chevrolets were in the top 10 ? | SELECT COUNT(*) FROM table_203_131 WHERE "make" = 'chevrolet' | squall |
CREATE TABLE airport (
airport_code varchar,
airport_name text,
airport_location text,
state_code varchar,
country_name varchar,
time_zone_code varchar,
minimum_connect_time int
)
CREATE TABLE compartment_class (
compartment varchar,
class_type varchar
)
CREATE TABLE restriction (
... | please list the morning flights from KANSAS CITY to ATLANTA | 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 = 'KANSAS CITY' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'A... | atis |
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE VoteTypes (
Id number,
Name text
)
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate... | Average number of undeleted questions per day per month since site inception. | SELECT DATEFROMPARTS(YEAR('date'), MONTH('date'), 1) AS "month", AVG('count') AS "average_questions_/_day_/_month" FROM (SELECT DATEFROMPARTS(YEAR(CreationDate), MONTH(CreationDate), DAY(CreationDate)) AS "date", COUNT(*) AS "count" FROM Posts WHERE PostTypeId = 1 GROUP BY YEAR(CreationDate), MONTH(CreationDate), DAY(C... | sede |
CREATE TABLE table_name_38 (
week VARCHAR,
opponent VARCHAR
) | What is the total for the week in the game against the Chicago Bears | SELECT COUNT(week) FROM table_name_38 WHERE opponent = "chicago bears" | sql_create_context |
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id num... | what is the number of hours since patient 3125 was admitted to the hospital? | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', admissions.admittime)) FROM admissions WHERE admissions.subject_id = 3125 AND admissions.dischtime IS NULL | mimic_iii |
CREATE TABLE table_40438 (
"Band" text,
"Value" text,
"Ratio" text,
"Ratio as %" text,
"Average" text
) | Which Ratio has a Ratio as % of 78%? | SELECT "Ratio" FROM table_40438 WHERE "Ratio as %" = '78%' | wikisql |
CREATE TABLE table_58880 (
"Year" real,
"Award" text,
"Category" text,
"Show" text,
"Character" text,
"Results" text
) | Which Character has a Category of favourite naya sadasya? | SELECT "Character" FROM table_58880 WHERE "Category" = 'favourite naya sadasya' | wikisql |
CREATE TABLE table_name_9 (
rank INTEGER,
bronze INTEGER
) | What is the rank with 0 bronze? | SELECT AVG(rank) FROM table_name_9 WHERE bronze < 0 | sql_create_context |
CREATE TABLE table_train_225 (
"id" int,
"heart_disease" bool,
"diabetic" string,
"creatinine_clearance_cl" float,
"panel_reactive_antibodies" int,
"age" float,
"NOUSE" float
) | symptomatic congestive heart failure | SELECT * FROM table_train_225 WHERE heart_disease = 1 | criteria2sql |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE prescriptions (
... | how many times did patient 14054 have lipids 20% in his system the previous month? | SELECT COUNT(*) 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 = 14054)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'lipids 20%' ... | mimic_iii |
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... | 患者编号是52382275之前在哪个医疗机构就诊啊? | SELECT zzmzjzjlb.YLJGDM FROM hz_info JOIN zzmzjzjlb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX WHERE hz_info.RYBH = '52382275' UNION SELECT fzzmzjzjlb.YLJGDM FROM hz_info JOIN fzzmzjzjlb ON hz_info.YLJGDM = fzzmzjzjlb.YLJGDM AND hz_info.KH = fzzmzjzjlb.KH AND hz_i... | css |
CREATE TABLE table_name_89 (
film_title_used_in_nomination VARCHAR,
director VARCHAR
) | What was the film title used in nomination for the film directed by Gheorghe Vitanidis? | SELECT film_title_used_in_nomination FROM table_name_89 WHERE director = "gheorghe vitanidis" | sql_create_context |
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABL... | Which upper elective classes are available for CS ? | SELECT DISTINCT course.department, course.name, course.number FROM course, program_course WHERE program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id | advising |
CREATE TABLE table_11964154_7 (
score VARCHAR,
high_assists VARCHAR,
date VARCHAR
) | How many times was the high assists earl watson (5) and the date of the game was december 2? | SELECT COUNT(score) FROM table_11964154_7 WHERE high_assists = "Earl Watson (5)" AND date = "December 2" | sql_create_context |
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
value... | patient 60136 has been tested for granular casts in this hospital encounter? | SELECT COUNT(*) > 0 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'granular casts') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 60136 AND admissions.dischtime IS NULL) | mimic_iii |
CREATE TABLE table_name_54 (
heat INTEGER,
rank VARCHAR
) | What is the average heat ranked at 30? | SELECT AVG(heat) FROM table_name_54 WHERE rank = 30 | sql_create_context |
CREATE TABLE table_79151 (
"Res." text,
"Record" text,
"Opponent" text,
"Method" text,
"Event" text,
"Round" real,
"Location" text
) | What's was the location for fight against Liam Mccarty? | SELECT "Location" FROM table_79151 WHERE "Opponent" = 'liam mccarty' | wikisql |
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE labevents (
row_id number,
subje... | how much did patient 5849 pay in their last hospital encounter for his hospital stay? | SELECT SUM(cost.cost) FROM cost WHERE cost.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5849 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) | mimic_iii |
CREATE TABLE table_8945 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Ground" text,
"Crowd" real,
"Date" text,
"Time" text
) | When was the match with an away team score of 13.15 (93)? | SELECT "Date" FROM table_8945 WHERE "Away team score" = '13.15 (93)' | wikisql |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.