context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
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... | calculate the average days of hospital stay of patients who are 49 years old or older than that. | SELECT AVG(demographic.days_stay) FROM demographic WHERE demographic.age >= "49" | mimicsql_data |
CREATE TABLE t_kc22 (
MED_EXP_DET_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
MED_CLINIC_ID text,
MED_EXP_BILL_ID text,
SOC_SRT_DIRE_CD text,
SOC_SRT_DIRE_NM text,
DIRE_TYPE number,
CHA_ITEM_LEV number,
MED_INV_ITEM_TYPE text,
MED_DIRE_CD text,
MED_DIRE_NM text,... | 一共多少人患脑梗死后遗症? | SELECT COUNT(DISTINCT PERSON_ID) FROM t_kc21 WHERE IN_DIAG_DIS_NM = '脑梗死后遗症' | css |
CREATE TABLE table_name_13 (
game VARCHAR,
opponent VARCHAR,
march VARCHAR
) | Which Game has an Opponent of detroit red wings, and a March smaller than 12? | SELECT COUNT(game) FROM table_name_13 WHERE opponent = "detroit red wings" AND march < 12 | sql_create_context |
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Percent text,
ACC_Home text,
ACC_Road text,
All_Games text,
All_Games_Percent int,
All_Home text,
All_Road text,
All_Neutral text
)
CREATE TABLE university (
Scho... | A bar chart shows the distribution of ACC_Regular_Season and All_Games_Percent , and display from low to high by the bars. | SELECT ACC_Regular_Season, All_Games_Percent FROM basketball_match ORDER BY ACC_Regular_Season | nvbench |
CREATE TABLE shipment_items (
shipment_id number,
order_item_id number
)
CREATE TABLE shipments (
shipment_id number,
order_id number,
invoice_number number,
shipment_tracking_number text,
shipment_date time,
other_shipment_details text
)
CREATE TABLE order_items (
order_item_id nu... | Which customers have both 'On Road' and 'Shipped' as order status? List the customer ids. | SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "On Road" INTERSECT SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "Shipped" | spider |
CREATE TABLE table_18862490_2 (
player VARCHAR,
score VARCHAR
) | What player(s) had the score of 64-70-67-69=270? | SELECT player FROM table_18862490_2 WHERE score = 64 - 70 - 67 - 69 = 270 | sql_create_context |
CREATE TABLE table_name_7 (
result VARCHAR,
venue VARCHAR,
game VARCHAR
) | What is the result of the game with a game number greater than 6 and an away venue? | SELECT result FROM table_name_7 WHERE venue = "away" AND game > 6 | sql_create_context |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | what is the lab test name of the patient id 6983? | SELECT lab.label FROM lab WHERE lab.subject_id = "6983" | mimicsql_data |
CREATE TABLE table_39178 (
"Date" real,
"Opponent" text,
"Venue" text,
"Result" text,
"Attendance" real,
"Competition" text
) | How many people attended the game that lost 2-4 and the date was higher than 15? | SELECT COUNT("Attendance") FROM table_39178 WHERE "Result" = 'lost 2-4' AND "Date" > '15' | wikisql |
CREATE TABLE table_59439 (
"Nat." text,
"Name" text,
"Moving to" text,
"Type" text,
"Transfer window" text
) | Where is moving to the type loaned out under the name tragodara? | SELECT "Moving to" FROM table_59439 WHERE "Type" = 'loaned out' AND "Name" = 'tragodara' | wikisql |
CREATE TABLE tags (
index number,
id number,
tag text
)
CREATE TABLE torrents (
groupname text,
totalsnatched number,
artist text,
groupyear number,
releasetype text,
groupid number,
id number
) | Name the most popular release on houston. | SELECT T2.groupname FROM torrents AS T2 JOIN tags AS T1 ON T1.id = T2.id WHERE T1.tag = "houston" ORDER BY totalsnatched DESC LIMIT 1 | whatcdhiphop |
CREATE TABLE table_name_96 (
capacity INTEGER,
stadium VARCHAR
) | What is the lowest capacity that has stadion mladina as the stadium? | SELECT MIN(capacity) FROM table_name_96 WHERE stadium = "stadion mladina" | sql_create_context |
CREATE TABLE hz_info_zyjzjlb (
JZLSH number,
YLJGDM number,
zyjzjlb_id number
)
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 tim... | 10年8月23日-21年8月22日,这11年,患者90117993的956786指标情况 | SELECT * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz_info.RYBH = '... | css |
CREATE TABLE table_28017 (
"Class" text,
"Firebox" text,
"Cylinder size" text,
"Valves" text,
"Valve gear" text,
"Number built" text,
"Years built" text
) | This engine with a cylinder size of 20 x 26 and a firebox of radial-stay was built when? | SELECT "Years built" FROM table_28017 WHERE "Cylinder size" = '20 ½” x 26”' AND "Firebox" = 'Radial-stay' | wikisql |
CREATE TABLE table_44849 (
"Tournament" text,
"2004" text,
"2005" text,
"2006" text,
"2007" text,
"2008" text,
"2009" text,
"2010" text,
"2011" text
) | What is 2004, when 2009 is 'A'? | SELECT "2004" FROM table_44849 WHERE "2009" = 'a' | wikisql |
CREATE TABLE table_name_65 (
winner VARCHAR,
third_place VARCHAR
) | What is the name of the winner when Goran Ivani evi was in third place? | SELECT winner FROM table_name_65 WHERE third_place = "goran ivanišević" | sql_create_context |
CREATE TABLE table_28213 (
"Countries and Territories" text,
"Conditions of access" text,
"Length of stay permitted" text,
"Fee (if applicable)" text,
"Access using a Croatian identity card" text
) | What is the permitted length of stay in the Jersey territory? | SELECT "Length of stay permitted" FROM table_28213 WHERE "Countries and Territories" = 'Jersey' | wikisql |
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,
... | 在04年4月10日到2021年8月16日之间患者15314573买西药的次数共是多少? | SELECT COUNT(*) FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_ID = '15314573' AND t_kc22.STA_DATE BETWEEN '2004-04-10' AND '2021-08-16' AND t_kc22.MED_INV_ITEM_TYPE = '西药费' UNION SELECT COUNT(*) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE f... | css |
CREATE TABLE table_204_416 (
id number,
"chip" text,
"flash size" text,
"eeprom" number,
"sram" number,
"frequency\n[mhz]" number,
"package" text
) | how many chips total are there ? | SELECT COUNT("chip") FROM table_204_416 | squall |
CREATE TABLE table_22715 (
"Rank" real,
"Peak" text,
"Country" text,
"Island" text,
"Elevation (m)" real,
"Prominence (m)" real,
"Col (m)" real
) | What is the lowest elevation(m) for the peak Mount Taylor? | SELECT MIN("Elevation (m)") FROM table_22715 WHERE "Peak" = 'Mount Taylor' | wikisql |
CREATE TABLE table_name_71 (
original_name VARCHAR,
language VARCHAR,
country VARCHAR
) | What was the original name of the Spanish song in Spain? | SELECT original_name FROM table_name_71 WHERE language = "spanish" AND country = "spain" | sql_create_context |
CREATE TABLE table_23528223_2 (
no_in_series VARCHAR,
directed_by VARCHAR
) | What's the series number of the episode directed by Skipp Sudduth? | SELECT no_in_series FROM table_23528223_2 WHERE directed_by = "Skipp Sudduth" | sql_create_context |
CREATE TABLE PersonFriend (
name varchar(20),
friend varchar(20),
year INTEGER
)
CREATE TABLE Person (
name varchar(20),
age INTEGER,
city TEXT,
gender TEXT,
job TEXT
) | Draw a bar chart for how many people are under 40 for each gender? | SELECT gender, COUNT(*) FROM Person WHERE age < 40 GROUP BY gender | nvbench |
CREATE TABLE table_39378 (
"Year" real,
"English title" text,
"Original title" text,
"Country" text,
"Director" text
) | Director of christophe barratier had what highest year? | SELECT MAX("Year") FROM table_39378 WHERE "Director" = 'christophe barratier' | wikisql |
CREATE TABLE t_kc21 (
MED_CLINIC_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
COMP_ID text,
PERSON_ID text,
PERSON_NM text,
IDENTITY_CARD text,
SOC_SRT_CARD text,
PERSON_SEX number,
PERSON_AGE number,
IN_HOSP_DATE time,
OUT_HOSP_DATE time,
DIFF_PLACE_FLG numb... | 排出葛晴画患者医疗记录医疗费总额不少于6196.22元的中出院诊断疾病的编码是什么?其名称叫什么? | SELECT OUT_DIAG_DIS_CD, OUT_DIAG_DIS_NM FROM t_kc21 WHERE PERSON_NM = '葛晴画' AND MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc24 WHERE MED_AMOUT >= 6196.22) | css |
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
)
... | how many patients whose procedure icd9 code is 8321? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.icd9_code = "8321" | mimicsql_data |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
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,
... | 84485404154这次住院就诊的住院中医诊断如何?编码又是什么 | SELECT zyjzjlb.ZYZYZDZZBM, zyjzjlb.ZYZYZDZZMC FROM zyjzjlb WHERE zyjzjlb.JZLSH = '84485404154' | css |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40)... | Group and count the state province attribute of the location table to visualize a bar chart, and show in descending by the y axis. | SELECT STATE_PROVINCE, COUNT(STATE_PROVINCE) FROM locations GROUP BY STATE_PROVINCE ORDER BY COUNT(STATE_PROVINCE) DESC | 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 are with admission location transfer from hosp/extram and with admission year before 2164? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.admityear < "2164" | mimicsql_data |
CREATE TABLE table_name_83 (
bronze INTEGER,
silver VARCHAR,
total VARCHAR
) | With silver medals less than 1, and total medals less than 2, what is the most bronze medals? | SELECT MAX(bronze) FROM table_name_83 WHERE silver < 1 AND total < 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 diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE chartevent... | count the number of patients who were prescribed sodium bicarbonate during the same month after being diagnosed with alcohol abuse-unspec in the last year. | SELECT COUNT(DISTINCT t1.subject_id) 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 d_icd_diagnoses.short_title = 'alcohol abuse-unsp... | mimic_iii |
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Percent text,
ACC_Home text,
ACC_Road text,
All_Games text,
All_Games_Percent int,
All_Home text,
All_Road text,
All_Neutral text
)
CREATE TABLE university (
Scho... | A bar chart shows the distribution of Team_Name and ACC_Percent , could you order by the Team_Name in desc? | SELECT Team_Name, ACC_Percent FROM basketball_match ORDER BY Team_Name DESC | nvbench |
CREATE TABLE zzmzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH number,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
KH text,
KLX number,
MJZH text,
ML number,
MZZYZDZZBM text,
MZZYZDZ... | 列出在05年2月7日到2015年9月7日内03628207患者被开出的所有检验报告单的检验报告单号是多少? | SELECT jybgb.BGDH FROM hz_info JOIN zzmzjzjlb JOIN jybgb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE hz_info.RYBH = '03628207' AND jybgb.BGRQ BETWEEN '2005-02-07' AND '2015-... | css |
CREATE TABLE table_name_23 (
nfl_team VARCHAR,
pick__number VARCHAR,
player VARCHAR
) | Which NFL team has a pick# less than 200 for Travis Davis? | SELECT nfl_team FROM table_name_23 WHERE pick__number < 200 AND player = "travis davis" | 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,
... | tell me the average cost of a hospital if base deficit is involved since 2105? | SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT lab.patientunitstayid FROM lab WHERE lab.labname = 'base deficit')) AND STRFTIME('%y', cost.chargetime) >= '2105' GROUP ... | eicu |
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
... | when had patient 69895 had foley output for the first time? | SELECT outputevents.charttime FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 69895)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'fole... | mimic_iii |
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 born before 2058 have been prescribed base drug type? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2058" AND prescriptions.drug_type = "BASE" | mimicsql_data |
CREATE TABLE table_204_597 (
id number,
"main author" text,
"no. of patients" number,
"duration of follow-up years" number,
"linearized rate of infection" text,
"actuarial freedom from infective endocarditis" text
) | how many looked at more than 500 patients ? | SELECT COUNT(*) FROM table_204_597 WHERE "no. of patients" > 500 | squall |
CREATE TABLE table_54389 (
"Entrant" text,
"Constructor" text,
"Chassis" text,
"Engine" text,
"Tyres" text,
"Driver" text,
"Rounds" text
) | Tell me the driver for ford cosworth dfv 3.0 v8 and chassis of ts19 ts20 | SELECT "Driver" FROM table_54389 WHERE "Engine" = 'ford cosworth dfv 3.0 v8' AND "Chassis" = 'ts19 ts20' | wikisql |
CREATE TABLE table_11817 (
"Date" text,
"Location" text,
"Lineup" text,
"Assist/pass" text,
"Score" text,
"Result" text,
"Competition" text
) | In guangzhou, who won the game with a score of 1-0? | SELECT "Result" FROM table_11817 WHERE "Location" = 'guangzhou' AND "Score" = '1-0' | wikisql |
CREATE TABLE table_204_400 (
id number,
"district" number,
"senator" text,
"party" text,
"caucus" text,
"first elected" number,
"counties represented" text
) | have at least 5 democrats from brooklyn been elected ? | SELECT (SELECT COUNT(*) FROM table_204_400 WHERE "party" = 'democratic' AND "counties represented" = 'brooklyn') >= 5 | squall |
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate time,
Score number,
ViewCount number,
... | Search for not an answer posts. | SELECT * FROM information_schema.tables | sede |
CREATE TABLE table_23918997_1 (
written_by VARCHAR,
us_viewers__million_ VARCHAR
) | Who were all the writers whose episodes had 0.97 million viewers? | SELECT written_by FROM table_23918997_1 WHERE us_viewers__million_ = "0.97" | 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... | count the number of patients whose diagnosis short title is ventricular fibrillation and drug route is replace. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Ventricular fibrillation" AND prescriptions.route = "REPLACE" | mimicsql_data |
CREATE TABLE Catalog_Structure (
catalog_level_number INTEGER,
catalog_id INTEGER,
catalog_level_name VARCHAR(50)
)
CREATE TABLE Attribute_Definitions (
attribute_id INTEGER,
attribute_name VARCHAR(30),
attribute_data_type VARCHAR(10)
)
CREATE TABLE Catalog_Contents (
catalog_entry_id INTE... | Find the dates on which more than one revisions were made, and the bin the date of latest revision into weekday interval and count them as a bar chart, and I want to list in desc by the Y-axis. | SELECT date_of_latest_revision, COUNT(date_of_latest_revision) FROM Catalogs ORDER BY COUNT(date_of_latest_revision) DESC | nvbench |
CREATE TABLE table_name_75 (
university_of_dublin INTEGER,
industrial_and_commercial_panel VARCHAR,
national_university_of_ireland VARCHAR
) | What is the average for the university of dublin when the industrial and commercial panel is greater than 4 and the total of the national university of ireland is larger than 3? | SELECT AVG(university_of_dublin) FROM table_name_75 WHERE industrial_and_commercial_panel > 4 AND national_university_of_ireland > 3 | sql_create_context |
CREATE TABLE table_name_89 (
play_by_play VARCHAR,
studio_host VARCHAR
) | Who gave the play by play commentary with studio host Ward Cornell? | SELECT play_by_play FROM table_name_89 WHERE studio_host = "ward cornell" | sql_create_context |
CREATE TABLE table_15342 (
"Client" text,
"Years of Operation" text,
"Area of Operation" text,
"Country" text,
"Services" text
) | What services were in the area of operation Wadi Borjuj? | SELECT "Services" FROM table_15342 WHERE "Area of Operation" = 'wadi borjuj' | wikisql |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | How many patients were admitted before the year 2146 with a diagnoses icd9 code of 3004. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2146" AND diagnoses.icd9_code = "3004" | mimicsql_data |
CREATE TABLE Accounts (
account_id INTEGER,
customer_id INTEGER,
account_name VARCHAR(50),
other_account_details VARCHAR(255)
)
CREATE TABLE Customers (
customer_id INTEGER,
customer_first_name VARCHAR(20),
customer_last_name VARCHAR(20),
customer_address VARCHAR(255),
customer_phon... | What are the different card types, and how many cards are there of each, and display by the bar from high to low. | SELECT card_type_code, COUNT(*) FROM Customers_Cards GROUP BY card_type_code ORDER BY card_type_code DESC | nvbench |
CREATE TABLE table_22333 (
"District" text,
"s Barangay" real,
"Population (2010 census)" real,
"Area ( has .)" text,
"Pop. density (per km2)" text
) | What is the population (2010 census) if the area is 66.11? | SELECT MIN("Population (2010 census)") FROM table_22333 WHERE "Area ( has .)" = '66.11' | wikisql |
CREATE TABLE event (
ID int,
Name text,
Stadium_ID int,
Year text
)
CREATE TABLE stadium (
ID int,
name text,
Capacity int,
City text,
Country text,
Opening_year int
)
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
CREATE TABLE swimme... | Draw a bar chart about the distribution of Nationality and the average of ID , and group by attribute Nationality, and could you display in ascending by the Y please? | SELECT Nationality, AVG(ID) FROM swimmer GROUP BY Nationality ORDER BY AVG(ID) | nvbench |
CREATE TABLE customers_policies (
customer_id number,
policy_id number,
date_opened time,
date_closed time
)
CREATE TABLE customers (
customer_id number,
customer_name text
)
CREATE TABLE services (
service_id number,
service_name text
)
CREATE TABLE available_policies (
policy_id... | What is the effective date of the claim that has the largest amount of total settlement? | SELECT t1.effective_date FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id ORDER BY SUM(t2.settlement_amount) DESC LIMIT 1 | spider |
CREATE TABLE table_name_36 (
detroit__dtw_ VARCHAR,
year VARCHAR,
kalamazoo__azo_ VARCHAR
) | Before the year 2010, and when Kalamazoo had a passenger fare of $517.32, what was the passenger fare for Detroit? | SELECT detroit__dtw_ FROM table_name_36 WHERE year < 2010 AND kalamazoo__azo_ = "$517.32" | sql_create_context |
CREATE TABLE table_203_756 (
id number,
"year" number,
"title" text,
"role" text,
"network" text,
"notes" text
) | how long until there was an appearance on the cts network ? | SELECT (SELECT MIN("year") FROM table_203_756 WHERE "network" = 'cts') - (SELECT MIN("year") FROM table_203_756) | squall |
CREATE TABLE table_52218 (
"Year" text,
"Builder" text,
"Motors" text,
"Trailers" text,
"Control Trailers" text
) | I want the trailers for 1931 and builder of mccw | SELECT "Trailers" FROM table_52218 WHERE "Year" = '1931' AND "Builder" = 'mccw' | wikisql |
CREATE TABLE table_6426 (
"Make/ Model" text,
"length" text,
"Year" real,
"Numbers (Quantity Ordered)" text,
"Fuel Propulsion" text
) | Which Make/ Model that Numbers (Quantity Ordered) of 1461 1500 (40 buses)? | SELECT "Make/ Model" FROM table_6426 WHERE "Numbers (Quantity Ordered)" = '1461–1500 (40 buses)' | wikisql |
CREATE TABLE table_name_42 (
game INTEGER,
october VARCHAR
) | Name the least game for october 21 | SELECT MIN(game) FROM table_name_42 WHERE october = 21 | sql_create_context |
CREATE TABLE table_name_74 (
date VARCHAR,
week INTEGER
) | What was the date for the game after week 16? | SELECT date FROM table_name_74 WHERE week > 16 | sql_create_context |
CREATE TABLE table_name_41 (
points INTEGER,
entrant VARCHAR,
chassis VARCHAR
) | What is the sum of all the points won by Peter Whitehead in an alta f2 Chassis? | SELECT SUM(points) FROM table_name_41 WHERE entrant = "peter whitehead" AND chassis = "alta f2" | sql_create_context |
CREATE TABLE table_54848 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | What was the time recorded for grid 18? | SELECT "Time/Retired" FROM table_54848 WHERE "Grid" = '18' | wikisql |
CREATE TABLE table_79267 (
"Driver" text,
"Navigator" text,
"Vehicle" text,
"Class" text,
"Capacity" real,
"Total Time" text,
"Margin" text
) | What driver had a total time of 16:58? | SELECT "Driver" FROM table_79267 WHERE "Total Time" = '16:58' | wikisql |
CREATE TABLE table_62888 (
"Name" text,
"Tests" real,
"Club" text,
"Career caps" real,
"Tour Apps" real,
"Position" text
) | What is the tour Apps when the career caps show 15? | SELECT "Tour Apps" FROM table_62888 WHERE "Career caps" = '15' | wikisql |
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId number,
ApprovalDate time
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name tex... | WHERE filtering with multiple fields. | SELECT * FROM dbo.Users WHERE CreationDate >= '2016/01/01' AND DisplayName LIKE '%Brent%' ORDER BY CreationDate DESC | sede |
CREATE TABLE table_60838 (
"Tie no" text,
"Home team" text,
"Score" text,
"Away team" text,
"Date" text
) | Who was the away team when the home team was Norwich City? | SELECT "Away team" FROM table_60838 WHERE "Home team" = 'norwich city' | wikisql |
CREATE TABLE table_name_4 (
total VARCHAR
) | What shows for 209 when the 2000 is , and a Total of 3, and a 2004 of 9th? | SELECT 2009 FROM table_name_4 WHERE 2000 = "–" AND total = 3 AND 2004 = "9th" | sql_create_context |
CREATE TABLE table_8348 (
"Date" text,
"Tournament" text,
"Surface" text,
"Opponent in the final" text,
"Score" text
) | What score has jim courier as the opponent in the final? | SELECT "Score" FROM table_8348 WHERE "Opponent in the final" = 'jim courier' | wikisql |
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,... | when was patient 16572 last tested until 11/2103 for chloride, whole blood? | SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'chloride, whole blood') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 16572) AND STRFTIME('%y-%m', labevents.charttime) <= '2103-11'... | mimic_iii |
CREATE TABLE table_39168 (
"Date" text,
"Tournament" text,
"Surface" text,
"Opponent" text,
"Score" text
) | What is the surface when the tournament is manta, ecuador? | SELECT "Surface" FROM table_39168 WHERE "Tournament" = 'manta, ecuador' | wikisql |
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,
... | 患者秦茉莉在门诊诊断为疾病O29.001时的二氧化碳结果定量及单位分别是多少? | SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN zyjybgb 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 = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZ... | css |
CREATE TABLE table_78303 (
"Driver" text,
"Team" text,
"Laps" real,
"Time/Retired" text,
"Grid" real,
"Points" real
) | How many average laps for Alex Tagliani with more than 17 points? | SELECT AVG("Laps") FROM table_78303 WHERE "Driver" = 'alex tagliani' AND "Points" > '17' | wikisql |
CREATE TABLE table_name_22 (
heat INTEGER,
nationality VARCHAR,
lane VARCHAR
) | What is the highest heat when the nationality is poland, and the lane is smaller than 6? | SELECT MAX(heat) FROM table_name_22 WHERE nationality = "poland" AND lane < 6 | sql_create_context |
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 text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
C... | count the number of patients on base drug type prescription who have had automatic implantable cardiac defibrillator in situ procedure. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Status autm crd dfbrltr" AND prescriptions.drug_type = "BASE" | mimicsql_data |
CREATE TABLE table_21321804_3 (
college VARCHAR,
cfl_team VARCHAR
) | What college did the player for the Hamilton Tiger-Cats go to? | SELECT college FROM table_21321804_3 WHERE cfl_team = "Hamilton Tiger-Cats" | sql_create_context |
CREATE TABLE table_name_62 (
song VARCHAR,
votes VARCHAR,
draw VARCHAR
) | Which song has votes greater than 640 and a draw of 1? | SELECT song FROM table_name_62 WHERE votes > 640 AND draw = 1 | sql_create_context |
CREATE TABLE table_25156 (
"Outcome" text,
"Year" real,
"Championship" text,
"Surface" text,
"Partner" text,
"Opponents in the final" text,
"Score in the final" text
) | What was the year date when one of the opponents in the final was bahrami leconte and score in the final is 7 6 2 , 6 1? | SELECT MIN("Year") FROM table_25156 WHERE "Opponents in the final" = 'Bahrami Leconte' AND "Score in the final" = '7–6 2 , 6–1' | wikisql |
CREATE TABLE table_35587 (
"Year" text,
"Winners" text,
"Score" text,
"Runner-up" text,
"Venue" text
) | What is the score during the 2006-2007 year? | SELECT "Score" FROM table_35587 WHERE "Year" = '2006-2007' | wikisql |
CREATE TABLE Catalog_Contents_Additional_Attributes (
catalog_entry_id INTEGER,
catalog_level_number INTEGER,
attribute_id INTEGER,
attribute_value VARCHAR(255)
)
CREATE TABLE Catalog_Contents (
catalog_entry_id INTEGER,
catalog_level_number INTEGER,
parent_entry_id INTEGER,
previous_en... | What are the names of catalog entries with level number 8, and count them by a bar chart, and rank Y in asc order. | SELECT catalog_entry_name, COUNT(catalog_entry_name) FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = "8" GROUP BY catalog_entry_name ORDER BY COUNT(catalog_entry_name) | nvbench |
CREATE TABLE table_train_99 (
"id" int,
"mini_mental_state_examination_mmse" int,
"language" string,
"renal_disease" bool,
"hepatic_disease" bool,
"allergy_to_formoterol" bool,
"geriatric_depression_scale_gds" int,
"NOUSE" float
) | mini _ mental status exam score > 16 and < 25 . | SELECT * FROM table_train_99 WHERE mini_mental_state_examination_mmse >= 16 AND mini_mental_state_examination_mmse <= 25 | criteria2sql |
CREATE TABLE table_name_39 (
page_count VARCHAR,
author VARCHAR
) | How many pages were in the book by Stefano D'Arrigo? | SELECT page_count FROM table_name_39 WHERE author = "stefano d'arrigo" | sql_create_context |
CREATE TABLE table_54894 (
"Block A" text,
"Kaz Hayashi" text,
"NOSAWA Rongai" text,
"Super Crazy" text,
"Toshizo" text
) | Name the kaz hayashi with block A of Shuji Kondo | SELECT "Kaz Hayashi" FROM table_54894 WHERE "Block A" = 'shuji kondo' | wikisql |
CREATE TABLE table_14287 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" real
) | what is the highest attendance when the week is smaller than 1? | SELECT MAX("Attendance") FROM table_14287 WHERE "Week" < '1' | wikisql |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TA... | since 2105 has patient 009-16880 undergone a vasodilator? | 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 = '009-16880')) AND treatment.treatmentname = 'vasodilator' AND STRFTIME('%y', ... | 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 demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | Which patients were ordered to get a lymphocytes percent lab test? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "Lymphocytes, Percent" | mimicsql_data |
CREATE TABLE mzb (
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... | 一共有多少患者患疾病J69.249? | SELECT COUNT(qtb.PERSON_ID) FROM qtb WHERE qtb.IN_DIAG_DIS_CD = 'J69.249' UNION SELECT COUNT(gyb.PERSON_ID) FROM gyb WHERE gyb.IN_DIAG_DIS_CD = 'J69.249' UNION SELECT COUNT(zyb.PERSON_ID) FROM zyb WHERE zyb.IN_DIAG_DIS_CD = 'J69.249' UNION SELECT COUNT(mzb.PERSON_ID) FROM mzb WHERE mzb.IN_DIAG_DIS_CD = 'J69.249' | 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... | count the number of patients whose discharge location is left against medical advi and procedure icd9 code is 9960? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "LEFT AGAINST MEDICAL ADVI" AND procedures.icd9_code = "9960" | mimicsql_data |
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... | 23887920这个患者的身高和体重是多少? | SELECT txmzjzjlb.SG, txmzjzjlb.TZ FROM hz_info JOIN txmzjzjlb ON hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX WHERE hz_info.RYBH = '23887920' UNION SELECT ftxmzjzjlb.SG, ftxmzjzjlb.TZ FROM hz_info JOIN ftxmzjzjlb ON hz_info.YLJGDM = ftxmzjzjlb.YLJGDM AND hz_info.KH = f... | css |
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
) | For those records from the products and each product's manufacturer, show me about the distribution of headquarter and the average of revenue , and group by attribute headquarter in a bar chart, order Headquarter in descending order. | SELECT Headquarter, AVG(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY Headquarter DESC | nvbench |
CREATE TABLE table_19317584_2 (
date VARCHAR
) | How many placed 4th on April 25? | SELECT COUNT(4 AS th_placed) FROM table_19317584_2 WHERE date = "April 25" | sql_create_context |
CREATE TABLE table_name_19 (
position INTEGER,
against VARCHAR,
team VARCHAR
) | What is the average Position with less than 57 against and the team is Juventus? | SELECT AVG(position) FROM table_name_19 WHERE against < 57 AND team = "juventus" | sql_create_context |
CREATE TABLE Organizations (
organization_id INTEGER,
parent_organization_id INTEGER,
organization_details VARCHAR(255)
)
CREATE TABLE Residents_Services (
resident_id INTEGER,
service_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DA... | Give me a stacked bar chart to show how many things in different types of each thing, and the details of the organization that owns it, list from low to high by the x axis please. | SELECT Type_of_Thing_Code, COUNT(Type_of_Thing_Code) FROM Things AS T1 JOIN Organizations AS T2 ON T1.organization_id = T2.organization_id GROUP BY organization_details, Type_of_Thing_Code ORDER BY Type_of_Thing_Code | nvbench |
CREATE TABLE table_39401 (
"Airdate" text,
"Celebrities" text,
"Rating" real,
"Share" real,
"18\u201349" text,
"Viewers (millions)" real,
"Weekly rank" text,
"Prod. code" real
) | Name the weekly rank for sunday, june 14, 2009 | SELECT "Weekly rank" FROM table_39401 WHERE "Airdate" = 'sunday, june 14, 2009' | wikisql |
CREATE TABLE table_57917 (
"Race" text,
"Circuit" text,
"Date" text,
"Pole position" text,
"Fastest lap" text,
"Winning driver" text,
"Constructor" text,
"Tyre" text,
"Report" text
) | On what date is there a Tryre of d at the Circuit of monaco? | SELECT "Date" FROM table_57917 WHERE "Tyre" = 'd' AND "Circuit" = 'monaco' | wikisql |
CREATE TABLE table_68143 (
"Year" text,
"Start" text,
"Qual" text,
"Rank" text,
"Finish" text,
"Laps" real
) | What year had 134 laps? | SELECT "Year" FROM table_68143 WHERE "Laps" = '134' | wikisql |
CREATE TABLE table_1469 (
"C/W 15+" real,
"Oblast\\Age" text,
"15 to 17" real,
"18 to 19" real,
"20 to 24" real,
"25 to 29" real,
"30 to 34" real,
"35 to 39" real,
"40 to 44" real,
"45 to 49" real,
"50 to 54" real,
"55 to 59" real,
"60 to 64" real,
"65 to 69" real... | What is the minimum of 25 to 29? | SELECT MIN("25 to 29") FROM table_1469 | wikisql |
CREATE TABLE hz_info_mzjzjlb (
JZLSH number,
YLJGDM number,
mzjzjlb_id number
)
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,
... | 在编号为3373155的医院中,55748768病患在科室名有推拿的科室的就诊记录流水号有哪些 | SELECT mzjzjlb.JZLSH FROM hz_info JOIN mzjzjlb JOIN hz_info_mzjzjlb ON hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzj... | css |
CREATE TABLE table_63870 (
"Date" text,
"Venue" text,
"Score" text,
"Comp" text,
"Report" text
) | What's the report in King Baudouin Stadium Brussels, Belgium? | SELECT "Report" FROM table_63870 WHERE "Venue" = 'king baudouin stadium brussels, belgium' | wikisql |
CREATE TABLE jyjgzbb (
JYZBLSH text,
YLJGDM text,
BGDH text,
BGRQ time,
JYRQ time,
JCRGH text,
JCRXM text,
SHRGH text,
SHRXM text,
JCXMMC text,
JCZBDM text,
JCFF text,
JCZBMC text,
JCZBJGDX text,
JCZBJGDL number,
JCZBJGDW text,
SBBM text,
YQBH text... | 检验申请机构名称和检验机构名称在检验报告单23234207206上是什么? | SELECT JYSQJGMC, JYJGMC FROM jybgb WHERE BGDH = '23234207206' | css |
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE cost (
costid num... | last time patient 011-31229 was diagnosed with lower urinary tract infection - likely bacterial during this year? | SELECT diagnosis.diagnosistime FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '011-31229')) AND diagnosis.diagnosisname = 'lower urinary tract i... | eicu |
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 procedures (
... | Which patients diagnosed with a seroma complicating a procedure have drugs administered via both eyes? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Seroma complicting proc" AND prescriptions.route = "BOTH EYES" | mimicsql_data |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.