context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE table_13473 (
"Event" text,
"Record" text,
"Nationality" text,
"Date" text,
"Games" text
) | On which date was the record of 43.89 m set? | SELECT "Date" FROM table_13473 WHERE "Record" = '43.89 m' | wikisql |
CREATE TABLE table_name_61 (
mpg_us_urban INTEGER,
mpg_uk_urban__cold_ VARCHAR,
mpg_uk_extra_urban VARCHAR
) | What's the mpg-US urban when the mpg-UK urban is 20 and the mpg-UK extra urban is less than 37.2? | SELECT SUM(mpg_us_urban) FROM table_name_61 WHERE mpg_uk_urban__cold_ = 20 AND mpg_uk_extra_urban < 37.2 | sql_create_context |
CREATE TABLE table_22824324_2 (
three_pointers INTEGER,
player VARCHAR
) | What is the lowest number of three pointers in games that kendall gill played? | SELECT MIN(three_pointers) FROM table_22824324_2 WHERE player = "Kendall Gill" | sql_create_context |
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number,
Name text,
Body text,
IsHidden boolean,
Predefined boolean,
PostNoticeDurationId number
)
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
Deletio... | Non-questions with title or tags. | SELECT * FROM Posts WHERE PostTypeId != 1 AND (NOT Title IS NULL OR NOT Tags IS NULL) | sede |
CREATE TABLE table_27181 (
"Year" text,
"Amiga demo" text,
"PC demo" text,
"C64 demo" text,
"Amiga intro" text,
"PC intro" text
) | What won best pc demo when tower power (camelot) won best c64 demo? | SELECT "PC demo" FROM table_27181 WHERE "C64 demo" = 'Tower Power (Camelot)' | wikisql |
CREATE TABLE student_record (
student_id int,
course_id int,
semester int,
grade varchar,
how varchar,
transfer_source varchar,
earn_credit varchar,
repeat_term varchar,
test_id varchar
)
CREATE TABLE course_tags_count (
course_id int,
clear_grading int,
pop_quiz int,
... | Next semester , is ARABAM 311 available ? | SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ARABAM' AND course.number = 311 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016 | advising |
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 PostsWithDeleted (
Id number,
PostTypeId number,
... | Find Gaps in Post IDs. Sample for SO Question 3788552 SQL interview question | SELECT low, high FROM (SELECT Id, low FROM (SELECT n1.Id AS ID, MIN(n2.Id) + 1 AS low FROM Posts AS n1 INNER JOIN Posts AS n2 ON n1.Id < n2.Id WHERE n1.Id < 5000 AND n2.Id < 5000 GROUP BY n1.Id) AS t WHERE t.low NOT IN (SELECT Id FROM Posts) AND t.low < (SELECT MAX(Id) FROM Posts)) AS t INNER JOIN (SELECT Id - 1 AS ID,... | sede |
CREATE TABLE table_78400 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What is the home team score at lake oval? | SELECT "Home team score" FROM table_78400 WHERE "Venue" = 'lake oval' | wikisql |
CREATE TABLE table_16670746_2 (
winning_driver VARCHAR,
circuit VARCHAR
) | Who was the winning driver at Okayama International Circuit? | SELECT winning_driver FROM table_16670746_2 WHERE circuit = "Okayama International circuit" | sql_create_context |
CREATE TABLE table_2374 (
"Title/Subject" text,
"Public Office" text,
"Artist" text,
"Date Painted/Created" text,
"Medium" text
) | Who was the subject of the sculpture created in 1982? | SELECT "Title/Subject" FROM table_2374 WHERE "Date Painted/Created" = '1982' | wikisql |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
wardid number,
intime time,
outtime time
)
... | among the patients prescribed with heparin (crrt machine priming), what are the three most commonly prescribed drugs at the same time, a year before? | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'heparin (crrt machine priming)' AND DATETIME(prescriptions.startd... | mimic_iii |
CREATE TABLE table_name_22 (
building VARCHAR,
status VARCHAR,
floors VARCHAR
) | what is a building that is proposed and will have 32 floors? | SELECT building FROM table_name_22 WHERE status = "proposed" AND floors = 32 | sql_create_context |
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 code_description (
code varchar,
description text
)
CREATE TABLE airline (
airline_co... | show me the flights from BOSTON to PITTSBURGH leaving WEDNESDAY and THURSDAY | 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, days AS DAYS_0, days AS DAYS_1, flight WHERE ((DAYS_0.day_name = 'WEDNESDAY' AND DAYS_1.day_name = 'THURSDAY' AND flight.flight_days = DAYS_0.days_code AND flight.flight_days... | atis |
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 female patients were treated with main drug? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "F" AND prescriptions.drug_type = "MAIN" | mimicsql_data |
CREATE TABLE table_65342 (
"Author / Editor / Source" text,
"Year of publication" text,
"Countries sampled" real,
"World Ranking (1)" text,
"Ranking in Latin America (2)" real
) | How many countries sampled has a world ranking of 33 in 2010 and less than 3 ranking in Latin America? | SELECT SUM("Countries sampled") FROM table_65342 WHERE "Year of publication" = '2010' AND "World Ranking (1)" = '33' AND "Ranking in Latin America (2)" < '3' | wikisql |
CREATE TABLE table_76256 (
"Date From" text,
"Date To" text,
"Position" text,
"Name" text,
"From" text
) | What was the Date From for Theo Robinson, who was with the team until the end of season? | SELECT "Date From" FROM table_76256 WHERE "Date To" = 'end of season' AND "Name" = 'theo robinson' | wikisql |
CREATE TABLE table_40484 (
"Name" text,
"Rank" real,
"Out of" text,
"Source" text,
"Year" real
) | Can you tell me the Out of that has the Source of united nations, and the Rank larger than 47, and the Year smaller than 2003? | SELECT "Out of" FROM table_40484 WHERE "Source" = 'united nations' AND "Rank" > '47' AND "Year" < '2003' | wikisql |
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 admissions (
row_id number,
subject_id number,
hadm_id number,
... | in this year, what was the five most common drugs prescribed to patients within the same month after the diagnosis of dmii wo cmp nt st uncntr? | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ... | mimic_iii |
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 weight change of patient 12927 from the second value measured on the current hospital visit compared to the first value measured on the current hospital visit? | SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12927 AND admissions.dischtime IS NULL)) AND chartevents.itemid IN (SELECT d_items.itemid FROM... | mimic_iii |
CREATE TABLE fare (
fare_id int,
from_airport varchar,
to_airport varchar,
fare_basis_code text,
fare_airline text,
restriction_code text,
one_direction_cost int,
round_trip_cost int,
round_trip_required varchar
)
CREATE TABLE food_service (
meal_code text,
meal_number int,
... | find me the latest flight leaving ATLANTA 8 7 and arriving in 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, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND date_day.day_number = 7 AND date_day.month_number = 8 AND da... | atis |
CREATE TABLE table_name_95 (
transmitter_location VARCHAR,
city VARCHAR
) | What is the transmitter location for city of Maryborough? | SELECT transmitter_location FROM table_name_95 WHERE city = "maryborough" | sql_create_context |
CREATE TABLE table_name_27 (
tournament VARCHAR
) | What is 2007, when Tournament is 'Madrid'? | SELECT 2007 FROM table_name_27 WHERE tournament = "madrid" | sql_create_context |
CREATE TABLE table_3737 (
"Club" text,
"Played" text,
"Won" text,
"Drawn" text,
"Lost" text,
"Points for" text,
"Points against" text,
"Bonus points" text,
"Points" text
) | How many bonus points did the club who had 18 losses have? | SELECT "Bonus points" FROM table_3737 WHERE "Lost" = '18' | wikisql |
CREATE TABLE table_17012 (
"Institution" text,
"Location" text,
"Founded" real,
"Type" text,
"Enrollment" real,
"Nickname" text,
"Joined" real,
"Left" real,
"Current Conference" text
) | What year did the school from mars hill, north carolina join? | SELECT "Joined" FROM table_17012 WHERE "Location" = 'Mars Hill, North Carolina' | wikisql |
CREATE TABLE table_203_871 (
id number,
"#" number,
"player" text,
"pos" text,
"pts" number,
"tries" number,
"conv" number,
"pens" number,
"drop" number,
"opposition" text,
"venue" text,
"date" text
) | how many times was 24 points or more achieved by an italian player before 2000 ? | SELECT COUNT(*) FROM table_203_871 WHERE "pts" >= 24 AND "date" < 2000 | squall |
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
CREATE TABLE fare (
fare_id int,
from_airport varchar,
to_airport varchar,
fare_basis_code text,
fare_airline text,
restriction_code text,
one_direction_cost int,
round_trip_cost int,
... | give me the flights from SAN FRANCISCO to WASHINGTON for 12 1 | 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 = 'WASHINGTON' AND date_day.day_number = 1 AND date_day.month_number = 12 AN... | atis |
CREATE TABLE table_name_32 (
city VARCHAR,
floors VARCHAR
) | In what city does the tallest building have 35 floors? | SELECT city FROM table_name_32 WHERE floors = 35 | sql_create_context |
CREATE TABLE table_27408 (
"Book series" text,
"Author" text,
"Original language" text,
"No. of installments" text,
"First published" text,
"Approximate sales" text
) | What is every original language for book series Little House on the Prairie? | SELECT "Original language" FROM table_27408 WHERE "Book series" = 'Little House on the Prairie' | wikisql |
CREATE TABLE Reservations (
Code INTEGER,
Room TEXT,
CheckIn TEXT,
CheckOut TEXT,
Rate REAL,
LastName TEXT,
FirstName TEXT,
Adults INTEGER,
Kids INTEGER
)
CREATE TABLE Rooms (
RoomId TEXT,
roomName TEXT,
beds INTEGER,
bedType TEXT,
maxOccupancy INTEGER,
baseP... | For each bed type, find the average base price of different bed type. Show bar chart. | SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType | nvbench |
CREATE TABLE table_name_9 (
total INTEGER,
to_par VARCHAR,
year_s__won VARCHAR
) | What was the total for the golfer who had a To par of +10 and year won of 1971? | SELECT SUM(total) FROM table_name_9 WHERE to_par = "+10" AND year_s__won = "1971" | sql_create_context |
CREATE TABLE table_17041 (
"Player" text,
"Position" text,
"School" text,
"Hometown" text,
"MLB Draft" text
) | What MLB Drafts have the position pitcher/infielder? | SELECT "MLB Draft" FROM table_17041 WHERE "Position" = 'Pitcher/Infielder' | wikisql |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
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,... | 门诊诊断患者为结膜炎的尿素的参考值范围有什么下限和上限? | SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM ... | css |
CREATE TABLE Products (
product_id INTEGER,
parent_product_id INTEGER,
production_type_code VARCHAR(15),
unit_price DECIMAL(19,4),
product_name VARCHAR(80),
product_color VARCHAR(20),
product_size VARCHAR(20)
)
CREATE TABLE Orders (
order_id INTEGER,
customer_id INTEGER,
date_or... | Show first name and id for all customers with at least 2 accounts. Plot them as pie chart. | SELECT T2.customer_first_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id | nvbench |
CREATE TABLE table_22671 (
"Game" real,
"Date" text,
"Opponent" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location/Attendance" text,
"Record" text
) | Name the game for june 7 | SELECT "Game" FROM table_22671 WHERE "Date" = 'June 7' | wikisql |
CREATE TABLE table_name_94 (
no_10 VARCHAR,
no_8 VARCHAR,
no_9 VARCHAR
) | Name the No. 10 which has a No. 8 of jackson, and a No. 9 of jayden? | SELECT no_10 FROM table_name_94 WHERE no_8 = "jackson" AND no_9 = "jayden" | sql_create_context |
CREATE TABLE table_19763199_3 (
result VARCHAR,
artist VARCHAR
) | What is the result for Normativa Vigente? | SELECT result FROM table_19763199_3 WHERE artist = "Normativa Vigente" | sql_create_context |
CREATE TABLE table_2444 (
"Round" real,
"Date" text,
"Home Team" text,
"Score" text,
"Away Team" text,
"Attendance" real,
"Stadium" text,
"Match Details" text
) | When 0 - 1 barbiero 78' is the score how many measurements of attendance are there? | SELECT COUNT("Attendance") FROM table_2444 WHERE "Score" = '0 - 1 Barbiero 78' | wikisql |
CREATE TABLE table_name_48 (
european_competitions VARCHAR,
tier VARCHAR,
pos VARCHAR
) | What European competitions have a tier of 2 and a position of 3? | SELECT european_competitions FROM table_name_48 WHERE tier = 2 AND pos = 3 | sql_create_context |
CREATE TABLE table_49745 (
"Model number" text,
"Frequency" text,
"L1 Cache" text,
"Mult." real,
"Voltage" text
) | What is the L1 Cache, when the Model Number is X5-133 ADY? | SELECT "L1 Cache" FROM table_49745 WHERE "Model number" = 'x5-133 ady' | wikisql |
CREATE TABLE table_2226817_9 (
title VARCHAR,
no_in_series VARCHAR
) | What is the name of episode 165? | SELECT title FROM table_2226817_9 WHERE no_in_series = 165 | sql_create_context |
CREATE TABLE table_6512 (
"Year" real,
"Class" text,
"Team" text,
"Points" real,
"Rank" text,
"Wins" real
) | What is the average points with a year higher than 1989, and a rank of 7th? | SELECT AVG("Points") FROM table_6512 WHERE "Year" > '1989' AND "Rank" = '7th' | wikisql |
CREATE TABLE table_name_10 (
status VARCHAR,
athlete VARCHAR
) | What is the status of ren hoppe? | SELECT status FROM table_name_10 WHERE athlete = "rené hoppe" | sql_create_context |
CREATE TABLE table_name_6 (
team VARCHAR,
winner VARCHAR
) | Which Team has a Winner of 1? | SELECT team FROM table_name_6 WHERE winner = "1" | sql_create_context |
CREATE TABLE table_20887670_1 (
year_joined INTEGER
) | What is the most recent year joined? | SELECT MAX(year_joined) FROM table_20887670_1 | sql_create_context |
CREATE TABLE table_203_416 (
id number,
"school name" text,
"city" text,
"grades" text,
"establishment" number,
"charter" text
) | which public middle school in hawaii was established most closely after washington middle school ? | SELECT "school name" FROM table_203_416 WHERE "establishment" > (SELECT "establishment" FROM table_203_416 WHERE "school name" = 'washington middle school') ORDER BY "establishment" LIMIT 1 | squall |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
sy... | have patient 015-180 been at the hospital since 2105? | SELECT COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '015-180' AND STRFTIME('%y', patient.hospitaladmittime) >= '2105' | eicu |
CREATE TABLE table_56962 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | Who was the away team at the game held at Arden Street Oval? | SELECT "Away team" FROM table_56962 WHERE "Venue" = 'arden street oval' | wikisql |
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... | 从2002年12月8日开始,截止到2017年9月12日,请把51526647的这位患者总共被开出的所有药物的编码、名称、数量、单价、金额给列出来 | SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM, t_kc22.QTY, t_kc22.UNIVALENT, t_kc22.AMOUNT FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_ID = '51526647' AND t_kc22.t_kc21_IN_HOSP_DATE BETWEEN '2002-12-08' AND '2017-09-12' | css |
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total_gpa float,
entered_as varchar,
admit_term int,
predicted_graduation_semester int,
degree varchar,
minor varchar,
internship varch... | Is lab also included in 451 ? | SELECT COUNT(*) > 0 FROM course WHERE department = 'EECS' AND has_lab = 'Y' AND number = 451 | advising |
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... | 一共有多少人得过癫痫 | SELECT COUNT(t_kc21.PERSON_ID) FROM t_kc21 WHERE t_kc21.IN_DIAG_DIS_NM = '癫痫' | css |
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... | tell me the gender and name of patient with patient id 2560. | SELECT demographic.name, demographic.gender FROM demographic WHERE demographic.subject_id = "2560" | mimicsql_data |
CREATE TABLE table_56630 (
"Pick #" real,
"CFL Team" text,
"Player" text,
"Position" text,
"College" text
) | Which Player has a CFL Team of montreal alouettes (via hamilton via winnipeg)? | SELECT "Player" FROM table_56630 WHERE "CFL Team" = 'montreal alouettes (via hamilton via winnipeg)' | 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 procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
... | provide the number of patients whose ethnicity is black/haitian and diagnoses long title is personal history of antineoplastic chemotherapy? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "BLACK/HAITIAN" AND diagnoses.long_title = "Personal history of antineoplastic chemotherapy" | mimicsql_data |
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... | give me the number of patients born before 2066 who had wheelchair dependence diagnosis. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dob_year < "2066" AND diagnoses.short_title = "Wheelchair dependence" | mimicsql_data |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtim... | in the case of patients who received intravenous diuretic - iv diuretic - bolus infusion in 2102, what are the three most common diagnoses that followed in the same hospital visit? | SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'intra... | eicu |
CREATE TABLE table_204_72 (
id number,
"election year" number,
"# of\nconstituency votes" number,
"# of\nparty list votes" number,
"% of\nparty list votes" number,
"# of\noverall seats won" text,
"+/-" number
) | which year had less votes ,1994 or 2009 ? | SELECT "election year" FROM table_204_72 WHERE "election year" IN (1994, 2009) ORDER BY "# of\nconstituency votes" LIMIT 1 | squall |
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 labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
chart... | what is patient 25814 last diagnosis time of long-term use meds nec since 2105? | SELECT diagnoses_icd.charttime FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'long-term use meds nec') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25814) AND STRFTIME... | mimic_iii |
CREATE TABLE table_79887 (
"Game" real,
"Date" text,
"Location" text,
"Time" text,
"Attendance" real
) | What is the location of the game that has a number smaller than 2? | SELECT "Location" FROM table_79887 WHERE "Game" < '2' | wikisql |
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 d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABL... | what were the top three most frequent drugs that followed during the same hospital visit for patients who were receiving sm bowel stoma closure in 2102? | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id 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 table_75729 (
"Name" text,
"Position" text,
"Number" real,
"School/Club Team" text,
"Season" text,
"Acquisition via" text
) | What number has an acquisition via the Rookie Draft, and is part of a School/club team at Cal State Fullerton? | SELECT "Number" FROM table_75729 WHERE "Acquisition via" = 'rookie draft' AND "School/Club Team" = 'cal state fullerton' | wikisql |
CREATE TABLE table_name_19 (
long INTEGER,
avg_g VARCHAR,
loss VARCHAR,
gain VARCHAR
) | What's the total long for more than 24 loss, a gain over 273, and an avg/g of 207.8? | SELECT SUM(long) FROM table_name_19 WHERE loss > 24 AND gain > 273 AND avg_g = 207.8 | sql_create_context |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetake... | what's patient 030-31704's length of stay in the first intensive care unit stay? | SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-31704') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime LIMIT 1 | eicu |
CREATE TABLE table_203_808 (
id number,
"rank" number,
"peak name" text,
"elevation" text,
"location" text,
"notes" text
) | how many peaks h ave an elevation of at least 3,200 feet . | SELECT COUNT("peak name") FROM table_203_808 WHERE "elevation" > 3200 | squall |
CREATE TABLE table_23563375_11 (
against VARCHAR,
w_l VARCHAR,
round VARCHAR
) | Who was played against when there was a loss and in the gi po round? | SELECT against FROM table_23563375_11 WHERE w_l = "Loss" AND round = "GI PO" | sql_create_context |
CREATE TABLE table_54310 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What was the date of the footscray home game? | SELECT "Date" FROM table_54310 WHERE "Home team" = 'footscray' | 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 diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | give me the number of patients whose gender is f and drug name is aspirin ec? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "F" AND prescriptions.drug = "Aspirin EC" | mimicsql_data |
CREATE TABLE table_203_771 (
id number,
"#" number,
"artist" text,
"featuring" text,
"title" text,
"version" text,
"length" text
) | what is the total number of tracks on 2005 best of benassi bros. featuring dhany ? | SELECT COUNT("title") FROM table_203_771 WHERE "featuring" = 'dhany' | squall |
CREATE TABLE table_72240 (
"#" real,
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Leading scorer" text,
"Attendance" text,
"Record" text,
"Streak" text
) | what records have a score of l 109 116 2 ot | SELECT "Record" FROM table_72240 WHERE "Score" = 'L 109–116 2 OT' | wikisql |
CREATE TABLE table_5119 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" text,
"Record" text
) | What was the loss details for the team with an attendance of 15,298? | SELECT "Loss" FROM table_5119 WHERE "Attendance" = '15,298' | wikisql |
CREATE TABLE table_name_71 (
date VARCHAR,
score VARCHAR,
location VARCHAR
) | What was the date of the tournament in Scotland with a score of 270 ( 18)? | SELECT date FROM table_name_71 WHERE score = "270 (–18)" AND location = "scotland" | sql_create_context |
CREATE TABLE table_52189 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | Who was the away team at Lake Oval? | SELECT "Away team score" FROM table_52189 WHERE "Venue" = 'lake oval' | wikisql |
CREATE TABLE table_name_66 (
origin VARCHAR,
number INTEGER
) | What is the origin of the one with a number larger than 161? | SELECT origin FROM table_name_66 WHERE number > 161 | sql_create_context |
CREATE TABLE table_10395 (
"Launch Vehicle" text,
"Launch date" text,
"Institutional authority" text,
"Launch site" text,
"Results" text
) | Name the launch vehicle with Institutional authority of ndc | SELECT "Launch Vehicle" FROM table_10395 WHERE "Institutional authority" = 'ndc' | wikisql |
CREATE TABLE table_60395 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | What player scored 73-68-66=207? | SELECT "Player" FROM table_60395 WHERE "Score" = '73-68-66=207' | wikisql |
CREATE TABLE table_11630008_6 (
series__number INTEGER,
season__number VARCHAR
) | What is the most series number with season 3? | SELECT MAX(series__number) FROM table_11630008_6 WHERE season__number = 3 | sql_create_context |
CREATE TABLE table_204_320 (
id number,
"rank" number,
"nation" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
) | which countries have the least amount of total medals ? | SELECT "nation" FROM table_204_320 WHERE "total" = (SELECT MIN("total") FROM table_204_320) | squall |
CREATE TABLE table_25295 (
"Station" text,
"Extension" text,
"City/Neighborhood" text,
"Projected opening" real,
"Transit Connections" text,
"Park and ride?" text
) | Name the transit connections for capitol hill u | SELECT "Transit Connections" FROM table_25295 WHERE "Station" = 'Capitol Hill U' | wikisql |
CREATE TABLE table_train_138 (
"id" int,
"mini_mental_state_examination_mmse" int,
"stroke" bool,
"body_weight" float,
"cranial_neurosurgery" bool,
"first_degree_relative" bool,
"seizure_disorder" bool,
"alcohol_abuse" bool,
"body_mass_index_bmi" float,
"aneurysm" bool,
"NOUS... | body mass index bmi between 18 and 32 kg per m2, body weight less than 300 pounds. | SELECT * FROM table_train_138 WHERE body_mass_index_bmi >= 18 AND body_mass_index_bmi <= 32 AND body_weight < 300 | criteria2sql |
CREATE TABLE table_36378 (
"Pick #" real,
"MLS Team" text,
"Player" text,
"Position" text,
"Affiliation" text
) | Name the player with pick number of 7 | SELECT "Player" FROM table_36378 WHERE "Pick #" = '7' | wikisql |
CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_description varchar,
manufacturer varchar,
basic_type varchar,
engines int,
pro... | what flights go from CHICAGO to SEATTLE on CO on saturday | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SEATTLE' AND date_day.day_number = 26 AND date_day.month_number = 7 AND ... | atis |
CREATE TABLE table_20087 (
"First District" text,
"Second District" text,
"Third District" text,
"Fourth District" text,
"Fifth District" text
) | Name the fifth district for steve rudoni | SELECT "Fifth District" FROM table_20087 WHERE "Fourth District" = 'Steve Rudoni' | wikisql |
CREATE TABLE fgwyjzb (
CLINIC_ID text,
CLINIC_TYPE 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,
... | 二零零四年六月十八日二零一一年六月十三日,在9385529医院有多少科室涉及医疗费总额低于4.11元 | SELECT COUNT(*) FROM (SELECT gwyjzb.MED_ORG_DEPT_CD FROM gwyjzb JOIN t_kc24 ON gwyjzb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE gwyjzb.MED_SER_ORG_NO = '9385529' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2004-06-18' AND '2011-06-13' GROUP BY gwyjzb.MED_ORG_DEPT_CD HAVING SUM(t_kc24.MED_AMOUT) < 4.11 UNION SELECT fgwyjzb.MED... | css |
CREATE TABLE Track (
TrackId integer,
Name varchar(200),
AlbumId integer,
MediaTypeId integer,
GenreId integer,
Composer varchar(220),
Milliseconds integer,
Bytes integer,
UnitPrice decimal(10,2)
)
CREATE TABLE Genre (
GenreId integer,
Name varchar(120)
)
CREATE TABLE Media... | Return a histogram on what are the titles and ids for albums containing tracks with unit price greater than 1? | SELECT T1.Title, T1.AlbumId FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 | nvbench |
CREATE TABLE table_name_11 (
agg VARCHAR
) | What was the 1st leg of the match that had an aggregate of 4-3? | SELECT 1 AS st_leg FROM table_name_11 WHERE agg = "4-3" | sql_create_context |
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... | 在11年7月15日到2014年12月18日之间病患17045983经过了哪些仪器的检查,在检验结果指标记录中仪器的编号是什么? | SELECT jyjgzbb.YQBH, jyjgzbb.YQMC FROM hz_info JOIN txmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH ... | css |
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(... | For all employees who have the letters D or S in their first name, find job_id and the average of salary , and group by attribute job_id, and visualize them by a bar chart, and list in descending by the X-axis. | SELECT JOB_ID, AVG(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY JOB_ID DESC | nvbench |
CREATE TABLE table_name_56 (
top_10 INTEGER,
cuts_made VARCHAR,
wins VARCHAR
) | What is the average number of top-10s for events with more than 12 cuts made and 0 wins? | SELECT AVG(top_10) FROM table_name_56 WHERE cuts_made > 12 AND wins < 0 | sql_create_context |
CREATE TABLE jybgb_jyjgzbb (
JYZBLSH number,
YLJGDM text,
jyjgzbb_id number
)
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
CREATE TABLE mzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
... | 张采文这个病人在零六年七月十七日以后的检验报告单是在哪些住院就诊的?查一下这些住院就诊流水编码 | SELECT zyjzjlb.JZLSH FROM person_info JOIN hz_info JOIN zyjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE person_info.XM = '张采文' AND NOT zyjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ <= '2006-07-17') | css |
CREATE TABLE table_3029 (
"Position" text,
"Name" text,
"Nationality" text,
"Event 1 Medley" text,
"Event 2 Truck Pull" text,
"Event 3 Squat Lift" text,
"Event 4 Carwalk" text,
"Event 5 Dumbbell Press" text,
"Event 6 Atlas Stones" text
) | How many men from the Ukraine? | SELECT COUNT("Event 4 Carwalk") FROM table_3029 WHERE "Nationality" = 'Ukraine' | wikisql |
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
) | how many products are there for each manufacturer?, I want to list in desc by the the total number . | SELECT T2.Name, COUNT(*) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY COUNT(*) DESC | nvbench |
CREATE TABLE table_name_57 (
density VARCHAR,
population INTEGER
) | What's the total number of density for the place with a population over 393,390? | SELECT COUNT(density) FROM table_name_57 WHERE population > 393 OFFSET 390 | sql_create_context |
CREATE TABLE table_name_75 (
clock_speed__mhz_ INTEGER,
introduced VARCHAR
) | What is the least clock speed (MHz) with January 1986 as introduced? | SELECT MIN(clock_speed__mhz_) FROM table_name_75 WHERE introduced = "january 1986" | sql_create_context |
CREATE TABLE table_name_7 (
attendance VARCHAR,
away_team VARCHAR
) | What was the date of the game that was played against the away team of York City? | SELECT attendance FROM table_name_7 WHERE away_team = "york city" | sql_create_context |
CREATE TABLE table_5872 (
"city" text,
"area 1996 km\u00b2" real,
"area 2006 km\u00b2" real,
"pop. 1999" text,
"pop. 2003" text,
"pop. 2006" real
) | Which area 2006 km has an area 1996 km smaller than 17.31? | SELECT MAX("area 2006 km\u00b2") FROM table_5872 WHERE "area 1996 km\u00b2" < '17.31' | wikisql |
CREATE TABLE table_25304 (
"Country" text,
"Type of Protection" text,
"Maximum Term" text,
"PCT route available" text,
"Conversion from Patent Application" text
) | In Tonga, what is the conversion from patent application? | SELECT "Conversion from Patent Application" FROM table_25304 WHERE "Country" = 'Tonga' | wikisql |
CREATE TABLE table_64446 (
"Rank" real,
"Metropolitan area" text,
"Country" text,
"GDP (PPP) (2008) Billions of US$" real,
"Metropolitan population (2006) Millions" real,
"GDP (PPP) US$ per capita" real
) | What is the average 2006 metropolitan population of Lima with a GDP per capita over $13,100? | SELECT AVG("Metropolitan population (2006) Millions") FROM table_64446 WHERE "Metropolitan area" = 'lima' AND "GDP (PPP) US$ per capita" > '13,100' | 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 d_icd_procedures (
row_id number,
icd9_code text,
s... | how many prescriptions were ordered for the drug glucagon in 2103? | SELECT COUNT(*) FROM prescriptions WHERE prescriptions.drug = 'glucagon' AND STRFTIME('%y', prescriptions.startdate) = '2103' | mimic_iii |
CREATE TABLE table_52717 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" real,
"Record" text
) | Name the record on june 22 | SELECT "Record" FROM table_52717 WHERE "Date" = 'june 22' | wikisql |
CREATE TABLE table_25531 (
"Name" text,
"Platform" text,
"License" text,
"Windows builders" text,
"Java builders" text,
"Other builders" text,
"SCM system" text,
"Notification" text,
"IDE Integration" text,
"Other Integration" text
) | Name the number of other builders for nant, visual studio | SELECT COUNT("Other builders") FROM table_25531 WHERE "Windows builders" = 'NAnt, Visual Studio' | wikisql |
CREATE TABLE city (
city_code varchar,
city_name varchar,
state_code varchar,
country_name varchar,
time_zone_code varchar
)
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minutes_distant int
)
CREATE TABLE code_des... | flight information on 1 23 from DENVER to SAN FRANCISCO | 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 = 'SAN FRANCISCO' AND date_day.day_number = 23 AND date_day.month_number = 1... | atis |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.