context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minutes_distant int
)
CREATE TABLE flight (
aircraft_code_sequence text,
airline_code varchar,
airline_flight text,
arrival_time int,
connections int,
departure_time... | what does restriction AP/80 mean | SELECT DISTINCT advance_purchase, application, maximum_stay, minimum_stay, no_discounts, restriction_code, saturday_stay_required, stopovers FROM restriction WHERE restriction_code = 'AP/80' | atis |
CREATE TABLE table_name_30 (
winning_driver VARCHAR,
winning_team VARCHAR,
pole_position VARCHAR
) | Who is the winning driver of Penske Racing, and what was Rick Mears' pole position? | SELECT winning_driver FROM table_name_30 WHERE winning_team = "penske racing" AND pole_position = "rick mears" | sql_create_context |
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABL... | what exactly was the name of the drug that patient 61591 was prescribed during the same hospital visit after receiving a aortocor bypas-1 cor art procedure in 05/2105? | SELECT t2.drug 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 admissions.subject_id = 61591 AND procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_proce... | mimic_iii |
CREATE TABLE table_204_330 (
id number,
"finished" text,
"horse" text,
"jockey" text,
"trainer" text,
"owner" text,
"time / behind" text
) | how long did spokane take to finish the race ? | SELECT "time / behind" FROM table_204_330 WHERE "horse" = 'spokane' | squall |
CREATE TABLE table_name_17 (
combined_elapsed_time VARCHAR,
skipper VARCHAR
) | Which Combined elapsed time has a Skipper of stephen wilkins? | SELECT combined_elapsed_time FROM table_name_17 WHERE skipper = "stephen wilkins" | sql_create_context |
CREATE TABLE Customer_Orders (
Order_Date VARCHAR,
Order_ID VARCHAR
)
CREATE TABLE ORDER_ITEMS (
Order_ID VARCHAR,
Product_ID VARCHAR
)
CREATE TABLE Products (
Product_ID VARCHAR,
Product_price INTEGER
) | What are the order dates of orders with price higher than 1000? | SELECT T1.Order_Date FROM Customer_Orders AS T1 JOIN ORDER_ITEMS AS T2 ON T1.Order_ID = T2.Order_ID JOIN Products AS T3 ON T2.Product_ID = T3.Product_ID WHERE T3.Product_price > 1000 | 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 procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic ... | what is the number of patients with abnormal lab tests born before the year 2097? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2097" AND lab.flag = "abnormal" | mimicsql_data |
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... | 从0一年七月二十七日开始,截止到一一年六月十八日,将近十年间找医生59717906医治的门诊病人有多少 | SELECT COUNT(hz_info.RYBH) FROM hz_info JOIN zzmzjzjlb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX WHERE zzmzjzjlb.ZZYSGH = '59717906' AND zzmzjzjlb.JZKSRQ BETWEEN '2001-07-27' AND '2011-06-18' UNION SELECT COUNT(hz_info.RYBH) FROM hz_info JOIN fzzmzjzjlb ON hz_inf... | css |
CREATE TABLE t_kc21_t_kc24 (
MED_CLINIC_ID text,
MED_SAFE_PAY_ID number
)
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,
... | 在患者朱飞宇的医疗记录中,医疗费总额不低于1829.32元的入院诊断疾病名是什么?编码呢 | SELECT t_kc21.OUT_DIAG_DIS_CD, t_kc21.OUT_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_NM = '朱飞宇' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT >= 1829.32) | css |
CREATE TABLE table_67990 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text
) | What was the team's record on November 12? | SELECT "Record" FROM table_67990 WHERE "Date" = 'november 12' | 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 of the patients treated with tizanidine had a hospital stay of more than 13 days? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "13" AND prescriptions.drug = "Tizanidine" | mimicsql_data |
CREATE TABLE Nurse (
EmployeeID INTEGER,
Name VARCHAR(30),
Position VARCHAR(30),
Registered BOOLEAN,
SSN INTEGER
)
CREATE TABLE Procedures (
Code INTEGER,
Name VARCHAR(30),
Cost REAL
)
CREATE TABLE Appointment (
AppointmentID INTEGER,
Patient INTEGER,
PrepNurse INTEGER,
... | How many patients do each physician take care of? List their names and number of patients they take care of Show bar chart, sort in asc by the x axis. | SELECT T1.Name, COUNT(*) FROM Physician AS T1 JOIN Patient AS T2 ON T1.EmployeeID = T2.PCP GROUP BY T1.EmployeeID ORDER BY T1.Name | nvbench |
CREATE TABLE table_name_39 (
bronze INTEGER,
silver VARCHAR,
nation VARCHAR
) | How many bronzes are there for the total nation with 112 silver and a total of 72? | SELECT AVG(bronze) FROM table_name_39 WHERE "total" > 72 AND nation = "total" AND silver < 112 | sql_create_context |
CREATE TABLE jyjgzbb (
BGDH text,
BGRQ time,
CKZFWDX text,
CKZFWSX number,
CKZFWXX number,
JCFF text,
JCRGH text,
JCRXM text,
JCXMMC text,
JCZBDM text,
JCZBJGDL number,
JCZBJGDW text,
JCZBJGDX text,
JCZBMC text,
JLDW text,
JYRQ time,
JYZBLSH text,
... | 那个科室开出检验报告单48779954623它的编码是什么? | SELECT zyjybgb.KSBM, zyjybgb.KSMC FROM zyjybgb WHERE zyjybgb.BGDH = '48779954623' UNION SELECT mzjybgb.KSBM, mzjybgb.KSMC FROM mzjybgb WHERE mzjybgb.BGDH = '48779954623' | css |
CREATE TABLE gwyjzb (
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,
... | 这所医院编码是6389409所有非异地结算的医疗就诊记录在2004-09-26到2012-04-01内有哪些个? | SELECT * FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '6389409' AND gwyjzb.IN_HOSP_DATE BETWEEN '2004-09-26' AND '2012-04-01' UNION SELECT * FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '6389409' AND fgwyjzb.IN_HOSP_DATE BETWEEN '2004-09-26' AND '2012-04-01' EXCEPT SELECT * FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '638940... | css |
CREATE TABLE table_14319023_2 (
boys_singles VARCHAR,
mixed_doubles VARCHAR
) | When mixed doubles is danny bawa chrisnanta debby susanto what is the boys singles? | SELECT boys_singles FROM table_14319023_2 WHERE mixed_doubles = "Danny Bawa Chrisnanta Debby Susanto" | sql_create_context |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
CREATE TABLE hz_info_zyjzjlb (
JZLSH number,
YLJGDM number,
zyjzjlb_id number
)
CREATE TABLE zyjzjlb (
CYBQDM text,
CYBQMC text,
CYCWH text,
CYKSDM text,
CYKSMC text,
CYSJ time,
CYZTDM number,
... | 了解一下住院就诊25043466122的病人在哪个病区入住?名称和代码分别是什么?入院的床位号是哪个 | SELECT zyjzjlb.RZBQDM, zyjzjlb.RZBQMC, zyjzjlb.RYCWH FROM zyjzjlb WHERE zyjzjlb.JZLSH = '25043466122' | css |
CREATE TABLE table_55832 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What was the home team score in the game where the away team scored 11.8 (74)? | SELECT "Home team score" FROM table_55832 WHERE "Away team score" = '11.8 (74)' | wikisql |
CREATE TABLE table_name_33 (
points INTEGER,
season VARCHAR
) | What were the lowest amount of points for season 1994? | SELECT MIN(points) FROM table_name_33 WHERE season = "1994" | sql_create_context |
CREATE TABLE table_48745 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | What is the to par of Al Mengert of the United States? | SELECT "To par" FROM table_48745 WHERE "Country" = 'united states' AND "Player" = 'al mengert' | wikisql |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | for patient id 74032, specify the diagnosis and icd9 code. | SELECT diagnoses.short_title, procedures.icd9_code FROM diagnoses INNER JOIN procedures ON diagnoses.hadm_id = procedures.hadm_id WHERE diagnoses.subject_id = "74032" | mimicsql_data |
CREATE TABLE table_16471 (
"Season" real,
"MLS Cup Winner" text,
"MLS Cup Runner-Up" text,
"MLS Supporters Shield Winner" text,
"MLS Supporters Shield Runner-Up" text
) | What is the name of the shield winner in which the mls cup winner and mls supporters shield runner up is Chivas usa? | SELECT "MLS Cup Winner" FROM table_16471 WHERE "MLS Supporters Shield Runner-Up" = 'Chivas USA' | wikisql |
CREATE TABLE table_name_69 (
score VARCHAR,
year VARCHAR
) | What is the score for 2004? | SELECT score FROM table_name_69 WHERE year = 2004 | sql_create_context |
CREATE TABLE film (
film_id SMALLINT UNSIGNED,
title VARCHAR(255),
description TEXT,
release_year YEAR,
language_id TINYINT UNSIGNED,
original_language_id TINYINT UNSIGNED,
rental_duration TINYINT UNSIGNED,
rental_rate DECIMAL(4,2),
length SMALLINT UNSIGNED,
replacement_cost DECI... | What are the payment dates for any payments that have an amount greater than 10 or were handled by a staff member with the first name Elsa, and count them by a bar chart | SELECT payment_date, COUNT(payment_date) FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa' | nvbench |
CREATE TABLE table_23990 (
"Round" real,
"Pick #" real,
"Player" text,
"Position" text,
"Height" text,
"Weight" text,
"College" text,
"Status" text
) | how many players played running back where status is made 53-man roster at start of 2009 season | SELECT COUNT("Player") FROM table_23990 WHERE "Status" = 'Made 53-man roster at start of 2009 season' AND "Position" = 'Running back' | wikisql |
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 prescriptions (
subject_id text,
hadm_id... | how many of the widowed patients were aged below 47? | SELECT MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "WIDOWED" AND demographic.age >= "47" | mimicsql_data |
CREATE TABLE t_kc21_t_kc22 (
MED_CLINIC_ID text,
MED_EXP_DET_ID number
)
CREATE TABLE t_kc21 (
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 ... | 从2008年3月19日到2008年8月22日期间里,统计医院6314589的科室小儿肛肠外科涉及的医疗费总额一共是多少? | SELECT SUM(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '6314589' AND t_kc21.MED_ORG_DEPT_NM = '小儿肛肠外科') AND t_kc24.CLINIC_SLT_DATE BETWEEN '2008-03-19' AND '2008-08-22' | css |
CREATE TABLE table_41448 (
"Rank" real,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | How many totals have a rank greater than 4, czech Republic as the nation, and a bronze greater than 0? | SELECT SUM("Total") FROM table_41448 WHERE "Rank" > '4' AND "Nation" = 'czech republic' AND "Bronze" > '0' | wikisql |
CREATE TABLE table_47620 (
"Portfolio" text,
"Minister" text,
"Took office" text,
"Left office" text,
"Party" text
) | What is Left Office, when Party is 'UDC', and when Took Office is '11 June 2001'? | SELECT "Left office" FROM table_47620 WHERE "Party" = 'udc' AND "Took office" = '11 june 2001' | wikisql |
CREATE TABLE table_name_31 (
record VARCHAR,
date VARCHAR
) | On the date of june 7 what was the score? | SELECT record FROM table_name_31 WHERE date = "june 7" | sql_create_context |
CREATE TABLE table_18847692_2 (
opponents INTEGER
) | What is the minimum number of opponents? | SELECT MIN(opponents) FROM table_18847692_2 | sql_create_context |
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number,
Name text,
Body text,... | Count questions with answers never accepted by a user.. | SELECT COUNT(*) FROM Posts INNER JOIN Users ON Posts.OwnerUserId = Users.Id WHERE Users.Id = '##UserId##' AND Posts.PostTypeId = 1 AND Posts.AnswerCount > 0 AND Posts.ClosedDate IS NULL AND Posts.AcceptedAnswerId IS NULL | sede |
CREATE TABLE candidate (
Candidate_ID int,
People_ID int,
Poll_Source text,
Date text,
Support_rate real,
Consider_rate real,
Oppose_rate real,
Unsure_rate real
)
CREATE TABLE people (
People_ID int,
Sex text,
Name text,
Date_of_Birth text,
Height real,
Weight re... | Give me the comparison about the sum of Weight over the Sex , and group by attribute Sex by a bar chart, show names in descending order. | SELECT Sex, SUM(Weight) FROM people GROUP BY Sex ORDER BY Sex DESC | nvbench |
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,
... | list the top three most common outputs in 2101? | SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%output%' AND STRFTIME('%y', intakeoutput.intakeoutputtime) = '2101' GROUP BY intakeoutput.celllabel) AS t1 WHERE t1.c1 <= 3 | eicu |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE medication (
medicatio... | how many times has vasopressors - dopamine 5-15 micrograms/kg/min procedure been done? | SELECT COUNT(*) FROM treatment WHERE treatment.treatmentname = 'vasopressors - dopamine 5-15 micrograms/kg/min' | eicu |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)... | what is the top five most frequent diagnoses for the patients 50s in 2101? | 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 50 AND 59) AND STRFTIME('%y', diagnosis.diagnosistime) = '2101' GROUP BY diagnosis.d... | eicu |
CREATE TABLE table_9726 (
"Tournament" text,
"Surface" text,
"Week" text,
"Winner" text,
"Finalist" text,
"Semi finalists" text
) | Which Semi finalists had a Week of may 15? | SELECT "Semi finalists" FROM table_9726 WHERE "Week" = 'may 15' | wikisql |
CREATE TABLE table_40817 (
"1935" text,
"1936" text,
"1937" text,
"1938" text,
"1939" text,
"1940" text,
"1941" text,
"1943" text,
"1945" text,
"1946" text,
"1947" text,
"1948" text,
"1949" text,
"1950" text,
"1951" text,
"1952" text,
"1953" text
) | What 1935 has 4 as a 1953? | SELECT "1935" FROM table_40817 WHERE "1953" = '4' | wikisql |
CREATE TABLE table_60942 (
"Line Name" text,
"Date Closed" text,
"NIMT Junction" text,
"Terminus" text,
"Length" text
) | What line has Junction of Huntly NIMT | SELECT "Line Name" FROM table_60942 WHERE "NIMT Junction" = 'huntly' | wikisql |
CREATE TABLE table_name_45 (
year VARCHAR,
position VARCHAR
) | Which year had a position of 9? | SELECT year FROM table_name_45 WHERE position = "9" | 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 demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | Count the number of patients who were admitted to the hospital before the year 2157 and have diagnosis short title as intermediate coronary syndrome | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2157" AND diagnoses.short_title = "Intermed coronary synd" | mimicsql_data |
CREATE TABLE people (
people_id number,
name text,
height number,
weight number,
birth_date text,
birth_place text
)
CREATE TABLE body_builder (
body_builder_id number,
people_id number,
snatch number,
clean_jerk number,
total number
) | What are the clean and jerk score of the body builder with the highest total score? | SELECT clean_jerk FROM body_builder ORDER BY total DESC LIMIT 1 | spider |
CREATE TABLE table_13779832_1 (
country_region VARCHAR,
seasons_and_winners VARCHAR
) | what's the country/region with seasons and winners being season 1, 2012: demetra malalan | SELECT country_region FROM table_13779832_1 WHERE seasons_and_winners = "Season 1, 2012: Demetra Malalan" | sql_create_context |
CREATE TABLE table_49030 (
"Season" real,
"Level" text,
"Division" text,
"Administration" text,
"Position" text
) | What is the most recent year with a finish in 2nd position? | SELECT MAX("Season") FROM table_49030 WHERE "Position" = '2nd' | 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 demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | what is the number of patients whose drug name is esmolol? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Esmolol" | mimicsql_data |
CREATE TABLE table_name_83 (
location VARCHAR,
opponent VARCHAR
) | Opponent of chicago bulls had what location? | SELECT location FROM table_name_83 WHERE opponent = "chicago bulls" | sql_create_context |
CREATE TABLE table_11408 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" real,
"Record" text
) | On what date was the record 21-25? | SELECT "Date" FROM table_11408 WHERE "Record" = '21-25' | wikisql |
CREATE TABLE gyb (
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... | 在2013-02-18到2018-01-29期间,患者对医疗项目自付比例的平均值在医疗机构3382984里是多少? | SELECT AVG(t_kc22.SELF_PAY_PRO) FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.MED_SER_ORG_NO = '3382984' AND t_kc22.STA_DATE BETWEEN '2013-02-18' AND '2018-01-29' UNION SELECT AVG(t_kc22.SELF_PAY_PRO) FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gyb.MED_SER_ORG_NO ... | css |
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 products with a price between 60 and 120, find name and price , and visualize them by a bar chart, and sort in ascending by the X-axis please. | SELECT Name, Price FROM Products WHERE Price BETWEEN 60 AND 120 ORDER BY Name | nvbench |
CREATE TABLE table_1530 (
"Club" text,
"Played" text,
"Won" text,
"Drawn" text,
"Lost" text,
"Points for" text,
"Points against" text,
"Points difference" text,
"Points" text
) | How many losses does Cross Keys RFC have? | SELECT COUNT("Lost") FROM table_1530 WHERE "Club" = 'Cross Keys RFC' | wikisql |
CREATE TABLE table_28059992_2 (
position VARCHAR,
college VARCHAR
) | Name the position for british columbia | SELECT position FROM table_28059992_2 WHERE college = "British Columbia" | sql_create_context |
CREATE TABLE table_42603 (
"Week" real,
"Date" text,
"Result" text,
"Record" text,
"Opponent" text,
"Points For" real,
"Points Against" real,
"First Downs" real,
"Attendance" real
) | What is the average First Downs for december 4? | SELECT AVG("First Downs") FROM table_42603 WHERE "Date" = 'december 4' | wikisql |
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 (
... | provide the health insurance and patients name for patient id 2560. | SELECT demographic.name, demographic.insurance FROM demographic WHERE demographic.subject_id = "2560" | mimicsql_data |
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE Tags (
Id number,
TagName text,
Cou... | Attrition: Reputation>10K Last post < 2012. | SELECT u.DisplayName, u.Reputation, u.LastAccessDate, p.LastPost FROM Users AS u INNER JOIN (SELECT OwnerUserId, MAX(CreationDate) AS LastPost FROM Posts WHERE CreationDate < '2012-01-01' GROUP BY OwnerUserId) AS p ON u.Id = p.OwnerUserId WHERE Reputation > 10000 AND u.LastAccessDate < '2012-01-01' ORDER BY Reputation ... | sede |
CREATE TABLE table_16438 (
"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 is the title of the episode directed by Mark Tinker? | SELECT "Title" FROM table_16438 WHERE "Directed by" = 'Mark Tinker' | wikisql |
CREATE TABLE table_28211103_1 (
hawthorn_score VARCHAR,
year VARCHAR
) | What is the hawthorn score at the year 2000? | SELECT hawthorn_score FROM table_28211103_1 WHERE year = 2000 | sql_create_context |
CREATE TABLE table_name_25 (
club VARCHAR,
founded VARCHAR
) | Which club was founded in 1962? | SELECT club FROM table_name_25 WHERE founded = 1962 | sql_create_context |
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 admitted before the year 2198 are diagnosed with primary disease aortic insufficiency\re-do sternotomy; aortic valve replacement? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "AORTIC INSUFFICIENCY\RE-DO STERNOTOMY; AORTIC VALVE REPLACEMENT " AND demographic.admityear < "2198" | mimicsql_data |
CREATE TABLE table_37060 (
"Player" text,
"Team" text,
"Score" text,
"Versus" text,
"Year" real
) | what is the team that played in 2006? | SELECT "Team" FROM table_37060 WHERE "Year" = '2006' | wikisql |
CREATE TABLE table_61351 (
"Res." text,
"Record" text,
"Opponent" text,
"Method" text,
"Event" text,
"Round" real,
"Time" text,
"Location" text
) | What is the record of the match with a win res., a 5:00 time, and more than 3 rounds? | SELECT "Record" FROM table_61351 WHERE "Res." = 'win' AND "Time" = '5:00' AND "Round" > '3' | wikisql |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGui... | Questions with [data-processing] as only tag. | SELECT Id AS "post_link", CreationDate, Tags FROM Posts WHERE Tags = '<data-processing>' ORDER BY Score DESC LIMIT 1000 | sede |
CREATE TABLE table_name_5 (
score VARCHAR,
to_par VARCHAR,
player VARCHAR
) | What is the score of player brian watts, who has a to par of 5? | SELECT score FROM table_name_5 WHERE to_par = 5 AND player = "brian watts" | sql_create_context |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id... | give me the number of patients whose admission type is urgent and admission year is less than 2194? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.admityear < "2194" | mimicsql_data |
CREATE TABLE table_name_75 (
date VARCHAR,
event VARCHAR
) | On what date was a record set in the team pursuit (8 laps) event? | SELECT date FROM table_name_75 WHERE event = "team pursuit (8 laps)" | sql_create_context |
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 was the monthly minimum amount of output amt-blake drain given to patient 007-4119 since 89 months ago? | SELECT MIN(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-4119')) AND intakeoutput.celllabel = 'output... | eicu |
CREATE TABLE table_70491 (
"Year" real,
"Chassis" text,
"Engine" text,
"Tyres" text,
"Pts. \u2021" text
) | What year was the Honda ra168e 1.5 v6 t engine used? | SELECT "Year" FROM table_70491 WHERE "Engine" = 'honda ra168e 1.5 v6 t' | wikisql |
CREATE TABLE table_name_76 (
staying_councillors INTEGER,
new_council VARCHAR,
election_result VARCHAR,
party VARCHAR
) | What is the mean amount of staying councilors with an election result amounting to less than 10 with the Green party, and a new council bigger than 0? | SELECT AVG(staying_councillors) FROM table_name_76 WHERE election_result < 10 AND party = "green" AND new_council > 0 | sql_create_context |
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
UserId number,
UserDisplayName text,
Comment text,
Text text,
ContentLicense... | Number of users with reputation at least N. | SELECT COUNT(Id) AS "number_of_users" FROM Users WHERE Reputation >= '##minrep##' AND CreationDate > @months_ago | sede |
CREATE TABLE table_204_585 (
id number,
"year" text,
"player" text,
"high school" text,
"college" text,
"nba/aba draft" text
) | how many players went to indiana | SELECT COUNT("player") FROM table_204_585 WHERE "college" = 'indiana' | squall |
CREATE TABLE table_22941863_19 (
stage INTEGER,
winner VARCHAR
) | If the winner is Bernhard Eisel, what is the stage maximum? | SELECT MAX(stage) FROM table_22941863_19 WHERE winner = "Bernhard Eisel" | sql_create_context |
CREATE TABLE table_250309_1 (
company VARCHAR,
plant VARCHAR
) | what is the name ofhte company where the plant is in burnaston? | SELECT company FROM table_250309_1 WHERE plant = "Burnaston" | sql_create_context |
CREATE TABLE table_name_17 (
week INTEGER,
points_against VARCHAR,
points_for VARCHAR,
opponent VARCHAR
) | Which Week has Points For larger than 19, and an Opponent of philadelphia eagles, and Points Against larger than 7? | SELECT MAX(week) FROM table_name_17 WHERE points_for > 19 AND opponent = "philadelphia eagles" AND points_against > 7 | sql_create_context |
CREATE TABLE table_name_48 (
date VARCHAR,
name VARCHAR
) | What is Date, when Name is 'Guay, Albert , 32'? | SELECT date FROM table_name_48 WHERE name = "guay, albert , 32" | sql_create_context |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
h... | how many hours have passed since patient 006-2586 was admitted to the intensive care unit? | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '006-2586' AND patient.unitdischargetime IS NULL | eicu |
CREATE TABLE Document_Sections_Images (
section_id INTEGER,
image_id INTEGER
)
CREATE TABLE Documents (
document_code VARCHAR(15),
document_structure_code VARCHAR(15),
document_type_code VARCHAR(15),
access_count INTEGER,
document_name VARCHAR(80)
)
CREATE TABLE Document_Sections (
sec... | What are the different role codes for users, and how many users have each Show bar chart, and rank by the total number in ascending please. | SELECT role_code, COUNT(*) FROM Users GROUP BY 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 demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | How many patients had a joint fluid lab test done and were diagnosed with acute/chronic systolic/diastolic heart failure? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Ac/chr syst/dia hrt fail" AND lab.fluid = "Joint Fluid" | 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... | find out the short title of diagnoses and long title of diagnoses for patient with patient id 11221. | SELECT diagnoses.short_title, procedures.long_title FROM diagnoses INNER JOIN procedures ON diagnoses.hadm_id = procedures.hadm_id WHERE diagnoses.subject_id = "11221" | mimicsql_data |
CREATE TABLE table_59815 (
"Member" text,
"Party" text,
"Electorate" text,
"State" text,
"Term of office" text
) | What is the Electorate when the term of office was 1955 1972, for Peter Howson? | SELECT "Electorate" FROM table_59815 WHERE "Term of office" = '1955–1972' AND "Member" = 'peter howson' | wikisql |
CREATE TABLE ReviewTaskResultTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBase... | Distribution of bounties over tags. | SELECT TagName, COUNT(BountyAmount) AS nrOfBounties, SUM(BountyAmount) AS bountyHeight, AVG(BountyAmount) AS avgBounty FROM (SELECT VoteTypeId, BountyAmount, TagName FROM Votes AS v INNER JOIN PostTags AS m ON v.PostId = m.PostId INNER JOIN Tags AS t ON m.TagId = t.Id) AS P WHERE NOT BountyAmount IS NULL AND VoteTypeId... | sede |
CREATE TABLE table_44376 (
"Solvent" text,
"Chemical Formula" text,
"Boiling point" text,
"Dielectric constant" text,
"Density" text,
"Dipole moment ( D )" text
) | What dipole moment has a density of 1.092 g/ml? | SELECT "Dipole moment ( D )" FROM table_44376 WHERE "Density" = '1.092 g/ml' | wikisql |
CREATE TABLE debate (
debate_id number,
date text,
venue text,
num_of_audience number
)
CREATE TABLE people (
people_id number,
district text,
name text,
party text,
age number
)
CREATE TABLE debate_people (
debate_id number,
affirmative number,
negative number,
if_... | Show different parties of people along with the number of people in each party. | SELECT party, COUNT(*) FROM people GROUP BY party | spider |
CREATE TABLE Rating (
rID int,
mID int,
stars int,
ratingDate date
)
CREATE TABLE Reviewer (
rID int,
name text
)
CREATE TABLE Movie (
mID int,
title text,
year int,
director text
) | Visualize the total smallest rating of different movie title using a bar chart, and could you order from high to low by the y axis? | SELECT T2.title, SUM(MIN(T1.stars)) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T2.title ORDER BY SUM(MIN(T1.stars)) DESC | nvbench |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE cost (
costid number,
... | how many patients were diagnosed with cardiac arrest and did not come back to hospital within the same month in 2105? | SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'cardiac arrest' AND STRFTIME('%y', diagnosis.diagnosistime) = '2105') AS t1) - (SELECT COUNT(DISTINC... | eicu |
CREATE TABLE table_34899 (
"Number" real,
"Name of administrative unit" text,
"Telephone (052)" text,
"Area (km 2 )" real,
"Population (people)" real
) | Which area has a telephone of (052) of 3862279? | SELECT "Area (km 2 )" FROM table_34899 WHERE "Telephone (052)" = '3862279' | wikisql |
CREATE TABLE table_25734 (
"Rank" real,
"Team" text,
"Total Points" real,
"2008-09 Points" real,
"2007-08 Points" real,
"2006-07 Points" real,
"2005-06 Points" real
) | If the team is Worcester, what is the 2005-2006 points? | SELECT "2005-06 Points" FROM table_25734 WHERE "Team" = 'Worcester' | wikisql |
CREATE TABLE table_78695 (
"Seat Order (Right to Left)" real,
"Series 1" text,
"Series 2" text,
"Series 3" text,
"Series 5" text,
"Series 9" text,
"Series 11" text
) | How many Seat Orders (Right to Left) have a Series 3 of deborah meaden? | SELECT COUNT("Seat Order (Right to Left)") FROM table_78695 WHERE "Series 3" = 'deborah meaden' | 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,... | give me the number of patients whose days of hospital stay is greater than 0 and drug name is heparin sodium (preservative free)? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "0" AND prescriptions.drug = "Heparin Sodium (Preservative Free)" | mimicsql_data |
CREATE TABLE table_train_203 (
"id" int,
"gender" string,
"perforation" bool,
"hemoglobin_a1c_hba1c" float,
"peptic_ulcer_disease" bool,
"serum_c_peptide" float,
"gastrointestinal_disease" bool,
"serum_creatinine" float,
"age" float,
"NOUSE" float
) | serum creatinine < 1.5 mg / dl for male and < 1.4 mg / dl for female | SELECT * FROM table_train_203 WHERE (gender = 'male' AND serum_creatinine < 1.5) OR (gender = 'female' AND serum_creatinine < 1.4) | criteria2sql |
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... | Self-answered questions with no other answers. | SELECT q.Id AS "post_link", q.CreationDate, q.Score FROM ((SELECT Posts.* FROM Posts WHERE PostTypeId = 1 AND AnswerCount = 1 AND CommunityOwnedDate IS NULL) AS q JOIN (SELECT Posts.* FROM Posts WHERE PostTypeId = 2 AND CommunityOwnedDate IS NULL) AS a ON q.Id = a.ParentId) WHERE q.OwnerUserId = a.OwnerUserId AND q.Ans... | sede |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_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 TABLE diagnoses_icd (
row... | what is the total maximum cost of a hospital that includes a drug called dexamethasone until 4 years ago? | SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'dexamethasone') AND DATETIME(cost.chargetime) <= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY cost.hadm_id) AS t1 | mimic_iii |
CREATE TABLE table_name_30 (
championship VARCHAR,
year VARCHAR
) | What championship was in 1985? | SELECT championship FROM table_name_30 WHERE year = 1985 | sql_create_context |
CREATE TABLE photos (
id int,
camera_lens_id int,
mountain_id int,
color text,
name text
)
CREATE TABLE mountain (
id int,
name text,
Height real,
Prominence real,
Range text,
Country text
)
CREATE TABLE camera_lens (
id int,
brand text,
name text,
focal_len... | What are the id and name of the mountains that have at least 2 photos Show bar chart, order from low to high by the y axis. | SELECT T1.name, T1.id FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id ORDER BY T1.id | nvbench |
CREATE TABLE table_name_12 (
internet VARCHAR,
position INTEGER
) | What is the internet when the position is more than 13? | SELECT internet FROM table_name_12 WHERE position > 13 | sql_create_context |
CREATE TABLE table_27733258_2 (
game VARCHAR,
high_rebounds VARCHAR
) | How many games had Robin Lopez (10) for the most rebounds? | SELECT COUNT(game) FROM table_27733258_2 WHERE high_rebounds = "Robin Lopez (10)" | sql_create_context |
CREATE TABLE table_49931 (
"Date" text,
"Venue" text,
"Score" text,
"Comp" text,
"Paraguay scorers" text,
"Report" text
) | Who were the Paraguay scorers on June 15, 2008? | SELECT "Paraguay scorers" FROM table_49931 WHERE "Date" = 'june 15, 2008' | wikisql |
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 ... | 在2004年4月22日到2008年12月14日期间在医疗机构1540750有多少新生儿有过门诊就诊记录? | SELECT COUNT(*) FROM mzjzjlb WHERE mzjzjlb.YLJGDM = '1540750' AND mzjzjlb.JZKSRQ BETWEEN '2004-04-22' AND '2008-12-14' AND mzjzjlb.ZSEBZ > 0 | css |
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... | how many patients whose admission year is less than 2124 and lab test category is blood gas? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2124" AND lab."CATEGORY" = "Blood Gas" | mimicsql_data |
CREATE TABLE table_name_75 (
song_title VARCHAR,
time VARCHAR
) | Name the song title with time of 1:51 | SELECT song_title FROM table_name_75 WHERE time = "1:51" | sql_create_context |
CREATE TABLE table_name_7 (
result VARCHAR,
year VARCHAR,
location VARCHAR
) | what is the result for 1970 at yankee stadium? | SELECT result FROM table_name_7 WHERE year = 1970 AND location = "yankee stadium" | sql_create_context |
CREATE TABLE table_name_68 (
course VARCHAR,
edition VARCHAR
) | What was the course called that had an Edition of 117th? | SELECT course FROM table_name_68 WHERE edition = "117th" | sql_create_context |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.