context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
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 (
... | what is the number of patients whose year of birth is less than 2078 and item id is 50981? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2078" AND lab.itemid = "50981" | mimicsql_data |
CREATE TABLE table_67567 (
"Date" text,
"Location" text,
"Opponenent" text,
"Result" text,
"Match type" text
) | When was the opponent Poland and the match type EC -qualifier? | SELECT "Date" FROM table_67567 WHERE "Opponenent" = 'poland' AND "Match type" = 'ec -qualifier' | wikisql |
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
CREATE TABL... | What is the course CSP 100 ? | SELECT DISTINCT name FROM course WHERE department = 'CSP' AND number = 100 | advising |
CREATE TABLE table_name_14 (
total VARCHAR,
silver INTEGER
) | What is the total number that 0 silver? | SELECT COUNT(total) FROM table_name_14 WHERE silver < 0 | sql_create_context |
CREATE TABLE table_name_49 (
gold INTEGER,
bronze INTEGER
) | What is the fewest gold medals when the bronze medals is greater than 5? | SELECT MIN(gold) FROM table_name_49 WHERE bronze > 5 | sql_create_context |
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additio... | What are the names of the upper-level BIOPHYS classes that can be taken in the Winter ? | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND course.department = 'BIOPHYS' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Win... | advising |
CREATE TABLE table_203_303 (
id number,
"tribunal" text,
"number of autos da fe" number,
"executions in persona" number,
"executions in effigie" number,
"penanced" number,
"total" number
) | which spanish tribunal had 36 executions in persona and 47 executions in effigie during this time period ? | SELECT "tribunal" FROM table_203_303 WHERE "executions in persona" = 36 AND "executions in effigie" = 47 | squall |
CREATE TABLE table_57251 (
"Born" text,
"Became oldest MP" text,
"Left House" text,
"Age on leaving" text,
"Died" text,
"Political Party" text
) | How old was the conservative party member that left the house in 2001? | SELECT "Age on leaving" FROM table_57251 WHERE "Political Party" = 'conservative' AND "Left House" = '2001' | wikisql |
CREATE TABLE table_name_77 (
event VARCHAR,
long_course_short_course VARCHAR,
year_set VARCHAR
) | What event had a short course in 2010? | SELECT event FROM table_name_77 WHERE long_course_short_course = "short course" AND year_set = 2010 | sql_create_context |
CREATE TABLE table_25678 (
"Stage" real,
"Winner" text,
"General classification" text,
"Mountains classification" text,
"Points classification" text,
"Youth classification" text,
"Team Classification" text
) | Who won the race with Tom Zirbel as Mountains Classification and Thomas Soladay as Points Classification? | SELECT "Winner" FROM table_25678 WHERE "Mountains classification" = 'Tom Zirbel' AND "Points classification" = 'Thomas Soladay' | wikisql |
CREATE TABLE table_72979 (
"Outcome" text,
"Edition" real,
"Round" text,
"Opponent Team" text,
"Surface" text,
"Opponent" text,
"Score" text
) | What was the score when the opposing team was from Belgium? | SELECT "Score" FROM table_72979 WHERE "Opponent Team" = 'Belgium' | wikisql |
CREATE TABLE reviewer (
rid number,
name text
)
CREATE TABLE movie (
mid number,
title text,
year number,
director text
)
CREATE TABLE rating (
rid number,
mid number,
stars number,
ratingdate time
) | What are the names of all movies directed by Steven Spielberg? | SELECT title FROM movie WHERE director = 'Steven Spielberg' | spider |
CREATE TABLE t_kc22 (
AMOUNT number,
CHA_ITEM_LEV number,
DATA_ID text,
DIRE_TYPE number,
DOSE_FORM text,
DOSE_UNIT text,
EACH_DOSAGE text,
EXP_OCC_DATE time,
FLX_MED_ORG_ID text,
FXBZ number,
HOSP_DOC_CD text,
HOSP_DOC_NM text,
MED_CLINIC_ID text,
MED_DIRE_CD tex... | 按照出院诊断出来的疾病编号和科室名称的不相同为条件,把医院1383573全部医疗就诊记录中患者的年龄列出来得到的平均数是多些? | SELECT t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_CD, AVG(t_kc21.PERSON_AGE) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '1383573' GROUP BY t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_CD | css |
CREATE TABLE table_41902 (
"Station" text,
"Year opened" text,
"Metropolitan borough [c ]" text,
"Zone" real,
"Station users 2006\u201307" real,
"Station users 2007\u201308" real
) | Can you tell me the total number of Zone than has the Station users 2007-08 larger than 243,800, and the Year opened of 1855? | SELECT COUNT("Zone") FROM table_41902 WHERE "Station users 2007\u201308" > '243,800' AND "Year opened" = '1855' | wikisql |
CREATE TABLE person_info_hz_info (
RYBH text,
KH number,
KLX number,
YLJGDM 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,
JSB... | 二零零三年二月七号到二零零八年三月二十四号这期间,曹俊郎的降钙素原指标记录 | SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN person_info_hz_info ON person_info.RYBH = person_info_hz_info.RYBH AND 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_MZJZ... | css |
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 ... | 这个患者15591984往昔有什么住院诊断结果如何呢? | SELECT zyjzjlb.ZYZDBM, zyjzjlb.ZYZDMC FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE hz_info.RYBH = '15591984' | css |
CREATE TABLE Assessment_Notes (
student_id VARCHAR
)
CREATE TABLE Students (
first_name VARCHAR,
student_id VARCHAR
) | Find the id and first name of the student that has the most number of assessment notes? | SELECT T1.student_id, T2.first_name FROM Assessment_Notes AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1 | sql_create_context |
CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minutes_distant int
)
CREATE TABLE class_of_service (
booking_class varchar,
rank int,
class_descriptio... | show me a list of flights from BOSTON to WASHINGTON arriving before 900 on 7 22 | 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 (((((flight.arrival_time < flight.departure_time) AND flight.arrival_time < 900) AND date_day.day_number = 21 AND date_day.month_number = 7 AND d... | 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... | what is the number of patients whose diagnoses long title is osteoarthrosis, unspecified whether generalized or localized, site unspecified and lab test abnormal status is abnormal? | 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.long_title = "Osteoarthrosis, unspecified whether generalized or localized, site unspecified" AND lab.flag = "abnormal" | mimicsql_data |
CREATE TABLE table_58522 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | Tell me the highest laps for toyota and grid of 13 | SELECT MAX("Laps") FROM table_58522 WHERE "Constructor" = 'toyota' AND "Grid" = '13' | 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 diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions... | give me the number of patients whose lab test name is free calcium? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "Free Calcium" | mimicsql_data |
CREATE TABLE degrees (
year number,
campus number,
degrees number
)
CREATE TABLE faculty (
campus number,
year number,
faculty number
)
CREATE TABLE campuses (
id number,
campus text,
location text,
county text,
year number
)
CREATE TABLE csu_fees (
campus number,
... | What campus started in year 1956, has more than 200 full time students, and more than 400 students enrolled? | SELECT T1.campus FROM campuses AS t1 JOIN enrollments AS t2 ON t1.id = t2.campus WHERE t2.year = 1956 AND totalenrollment_ay > 400 AND fte_ay > 200 | spider |
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAd... | Who has the most copies of one badge?. Determines the ranking of who has the most of one badge, for example Nice Question. | SELECT UserId AS "user_link", COUNT(*) AS Count FROM Badges WHERE Name = @Badge GROUP BY UserId ORDER BY Count DESC | sede |
CREATE TABLE table_18310 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" real,
"Result" text,
"Candidates" text
) | What year was the earliest first elected? | SELECT MIN("First elected") FROM table_18310 | wikisql |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
CREATE TABLE person_info (
CSD text,
CSRQ time,
GJDM text,
GJMC text,
JGDM text,
JGMC text,
MZDM text,
MZMC text,
RYBH text,
XBDM number,
XBMC text,
XLDM text,
XLMC text,
XM text... | 患有疾病M60.726的患者的在确诊时其D2聚体(柠檬酸盐)的含量参考值范围的下限与上限的数值都是多少? | SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM txmzjzjlb JOIN jybgb JOIN jyjgzbb ON txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE txmzjzjlb.JZZDBM = 'M60.726' AND jyjgzbb.JCZBMC = 'D2聚体(柠檬酸盐)' UNION SELECT jyjgzbb.CK... | css |
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... | How many of the patients born before the year 2137 were treated with midazbase? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2137" AND prescriptions.formulary_drug_cd = "MIDAZBASE" | mimicsql_data |
CREATE TABLE table_name_29 (
total_points VARCHAR,
match_points VARCHAR,
games VARCHAR,
bonus_points VARCHAR
) | What are the total points that had 68 match points, 9 bonus points and 30 games? | SELECT total_points FROM table_name_29 WHERE games = "30" AND bonus_points = "9" AND match_points = "68" | sql_create_context |
CREATE TABLE table_53085 (
"Height (m.)" text,
"No. of times visited" real,
"No. of HC climbs" real,
"First time as HC climb" real,
"Most recent" real
) | When was the first HC climb before 2013 with more than 3 times visited, more than 4 HC climbs, and a height of 1669? | SELECT "First time as HC climb" FROM table_53085 WHERE "No. of times visited" > '3' AND "No. of HC climbs" = '4' AND "Most recent" < '2013' AND "Height (m.)" = '1669' | wikisql |
CREATE TABLE table_57998 (
"Rank" text,
"Name" text,
"Height ft / m" text,
"Floors" real,
"Year" real
) | What is the oldest year listed with the 1500 Louisiana Street name? | SELECT MIN("Year") FROM table_57998 WHERE "Name" = '1500 louisiana street' | wikisql |
CREATE TABLE table_22918 (
"Version" text,
"Code name" text,
"Release date" text,
"Desktops" text,
"Servers" text,
"Kernel Version" text
) | What is the status of the desktop version of the OS with kernel version 2.6.31? | SELECT "Desktops" FROM table_22918 WHERE "Kernel Version" = '2.6.31' | wikisql |
CREATE TABLE table_1341577_43 (
incumbent VARCHAR,
candidates VARCHAR
) | Who is the incumbent that is listed with the candidates listed as marilyn lloyd (d) 57.4% harold w. coker (r) 42.6%? | SELECT incumbent FROM table_1341577_43 WHERE candidates = "Marilyn Lloyd (D) 57.4% Harold W. Coker (R) 42.6%" | sql_create_context |
CREATE TABLE table_76825 (
"Game" text,
"Date" text,
"Home Team" text,
"Result" text,
"Road Team" text
) | WHAT GAME HAD A SCORE OF 99-112? | SELECT "Game" FROM table_76825 WHERE "Result" = '99-112' | wikisql |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREA... | when was the first time patient 006-2586 had the maximum heartrate the previous day. | SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-2586')) AND NOT vitalperiodic.heartrate IS NULL... | eicu |
CREATE TABLE table_name_10 (
score_time VARCHAR,
date VARCHAR
) | What was the score of the game on June 10? | SELECT score_time FROM table_name_10 WHERE date = "june 10" | sql_create_context |
CREATE TABLE table_test_30 (
"id" int,
"ejection_fraction_ef" int,
"multiple_long_bone_fractures" bool,
"extracellular_volume_expansion" bool,
"pregnancy_or_lactation" bool,
"bleeding" int,
"serum_potassium" float,
"prosthetic_heart_valve" bool,
"hbg" int,
"anticoagulation" bool,... | patients with one or more of the following indications for chronic warfarin anticoagulation ( the patient may either be a new candidate for anticoagulation or may already be receiving warfarin ) : atrial fibrillation ( paroxysmal, persistent or permanent, not due to a reversible cause, documented by ecg ) or atrial flu... | SELECT * FROM table_test_30 WHERE (chronic_warfarin_therapy = 1 OR (anticoagulation = 1 OR chronic_warfarin_therapy = 1)) OR atrial_fibrillation = 1 OR atrial_flutter = 1 OR (prosthetic_heart_valve = 1 AND (aortic = 1 OR mitral = 1) AND chronic_anticoagulation = 1) OR (venous_thromboembolic_disease = 1 OR (dvt = 1 OR p... | criteria2sql |
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE ReviewTaskStates (
Id number,
Na... | Users who Downvote but don't post. | SELECT Users.DisplayName, COUNT(Posts.Id) AS Posts, Users.DownVotes, Users.DownVotes / CAST(s.Total AS FLOAT) AS "% of All Downvotes", Users.DownVotes / CAST(COUNT(Posts.Id) AS FLOAT) AS "Downvotes/Posts", Users.DownVotes / CAST(Users.UpVotes AS FLOAT) AS "Downvotes/upvotes" FROM Users JOIN Posts ON Users.Id = Posts.Ow... | sede |
CREATE TABLE table_name_24 (
solo_blocks INTEGER,
assists VARCHAR,
season VARCHAR,
errors VARCHAR,
kills VARCHAR
) | When there are more than 126 errors, more than 551 kills, and more than 40 assists for the 2007 season, what is the total of Solo Blocks? | SELECT SUM(solo_blocks) FROM table_name_24 WHERE errors > 126 AND kills > 551 AND season = "2007" AND assists > 40 | sql_create_context |
CREATE TABLE table_75181 (
"Pick #" real,
"Round" text,
"Player" text,
"Position" text,
"College" text
) | Which college had Tony Leiker in round 7? | SELECT "College" FROM table_75181 WHERE "Round" = 'round 7' AND "Player" = 'tony leiker' | wikisql |
CREATE TABLE list (
lastname text,
firstname text,
grade number,
classroom number
)
CREATE TABLE teachers (
lastname text,
firstname text,
classroom number
) | Which students study under the teacher named OTHA MOYER? Give me the first and last names of the students. | SELECT T1.firstname, T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "OTHA" AND T2.lastname = "MOYER" | spider |
CREATE TABLE t_kc21_t_kc24 (
MED_CLINIC_ID text,
MED_SAFE_PAY_ID number
)
CREATE TABLE t_kc22 (
AMOUNT number,
CHA_ITEM_LEV number,
DATA_ID text,
DIRE_TYPE number,
DOSE_FORM text,
DOSE_UNIT text,
EACH_DOSAGE text,
EXP_OCC_DATE time,
FLX_MED_ORG_ID text,
FXBZ number,
... | 是否退费结算都好了,就是20997914113的那次医疗就诊 | SELECT t_kc24.REF_SLT_FLG FROM t_kc24 JOIN t_kc21_t_kc24 JOIN t_kc21 ON t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID AND t_kc21_t_kc24.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '20997914113' | css |
CREATE TABLE Faculty (
fname VARCHAR,
lname VARCHAR,
Rank VARCHAR
) | Show the first name and last name for all the instructors. | SELECT fname, lname FROM Faculty WHERE Rank = "Instructor" | sql_create_context |
CREATE TABLE table_203_739 (
id number,
"rank" number,
"nation" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
) | how many more more bronze medals did russia earn than china ? | SELECT (SELECT "bronze" FROM table_203_739 WHERE "nation" = 'russia') - (SELECT "bronze" FROM table_203_739 WHERE "nation" = 'china') | squall |
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_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE cost (
row_id... | on their last hospital visit, when was the last time patient 80120 had the maximum po2? | SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 80120 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = ... | mimic_iii |
CREATE TABLE table_20297668_1 (
ply__uk VARCHAR,
_nz VARCHAR,
_au_ VARCHAR,
yarn_type__us_ VARCHAR
) | Name the ply (uk, nz, au) for fingering | SELECT ply__uk, _nz, _au_ FROM table_20297668_1 WHERE yarn_type__us_ = "Fingering" | sql_create_context |
CREATE TABLE table_name_10 (
total INTEGER,
gold VARCHAR,
bronze VARCHAR
) | Name the sum of total with gold more than 1 and bronze more than 0 | SELECT SUM(total) FROM table_name_10 WHERE gold > 1 AND bronze > 0 | sql_create_context |
CREATE TABLE table_33616 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | Who is the away side at windy hill? | SELECT "Away team" FROM table_33616 WHERE "Venue" = 'windy hill' | wikisql |
CREATE TABLE table_name_72 (
song_choice VARCHAR,
episode VARCHAR
) | What song was chosen for the episode with the top 8? | SELECT song_choice FROM table_name_72 WHERE episode = "top 8" | sql_create_context |
CREATE TABLE table_39355 (
"Outcome" text,
"Year" real,
"Championship" text,
"Surface" text,
"Partner" text,
"Opponents in the final" text,
"Score in the final" text
) | Who was the partner when the championship was us open on a hard surface? | SELECT "Partner" FROM table_39355 WHERE "Surface" = 'hard' AND "Championship" = 'us open' | wikisql |
CREATE TABLE table_310 (
"Player" text,
"Position" text,
"School" text,
"Hometown" text,
"College" text
) | How many players' hometown was Akron, Ohio? | SELECT COUNT("School") FROM table_310 WHERE "Hometown" = 'Akron, Ohio' | wikisql |
CREATE TABLE table_name_50 (
bronze VARCHAR,
silver VARCHAR,
total VARCHAR,
gold VARCHAR
) | What is the bronze when silver is 4 and gold is 1 and the total is more than 2 | SELECT bronze FROM table_name_50 WHERE total > 2 AND gold = "1" AND silver = "4" | sql_create_context |
CREATE TABLE ship (
Ship_ID int,
Name text,
Type text,
Nationality text,
Tonnage int
)
CREATE TABLE mission (
Mission_ID int,
Ship_ID int,
Code text,
Launched_Year int,
Location text,
Speed_knots int,
Fate text
) | Show different types of ships and the average tonnage of ships of each type in a bar chart. | SELECT Type, AVG(Tonnage) FROM ship GROUP BY Type | nvbench |
CREATE TABLE table_name_53 (
week INTEGER,
game_site VARCHAR
) | what week number was at memorial stadium? | SELECT AVG(week) FROM table_name_53 WHERE game_site = "memorial stadium" | sql_create_context |
CREATE TABLE artist (
name VARCHAR,
country VARCHAR,
artist_id VARCHAR
)
CREATE TABLE exhibition (
artist_id VARCHAR
) | What is the name and country for the artist with most number of exhibitions? | SELECT T2.name, T2.country FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id ORDER BY COUNT(*) DESC LIMIT 1 | sql_create_context |
CREATE TABLE table_60725 (
"County" text,
"Per capita income" text,
"Median household income" text,
"Median family income" text,
"Population" real,
"Number of households" real
) | What is Per Capita Income, when Population is greater than 9,563, and when Median Family Income is '$49,310'? | SELECT "Per capita income" FROM table_60725 WHERE "Population" > '9,563' AND "Median family income" = '$49,310' | wikisql |
CREATE TABLE table_73744 (
"Position" real,
"Driver" text,
"Points" real,
"Winnings" text,
"Series" text
) | In what series did Bobby Labonte drive? | SELECT "Series" FROM table_73744 WHERE "Driver" = 'Bobby Labonte' | wikisql |
CREATE TABLE table_name_98 (
release_date VARCHAR,
developer_s_ VARCHAR
) | When did Masthead Studios release their game? | SELECT release_date FROM table_name_98 WHERE developer_s_ = "masthead studios" | sql_create_context |
CREATE TABLE table_24348134_3 (
conference VARCHAR,
tournament_winner VARCHAR
) | List the tournament that kent state won? | SELECT conference AS Tournament FROM table_24348134_3 WHERE tournament_winner = "Kent State" | sql_create_context |
CREATE TABLE transactions (
transaction_id number,
investor_id number,
transaction_type_code text,
date_of_transaction time,
amount_of_transaction number,
share_count text,
other_details text
)
CREATE TABLE purchases (
purchase_transaction_id number,
purchase_details text
)
CREATE ... | Show the average share count of transactions each each investor, ordered by average share count. | SELECT investor_id, AVG(share_count) FROM transactions GROUP BY investor_id ORDER BY AVG(share_count) | spider |
CREATE TABLE table_27366772_3 (
armenian VARCHAR,
area__km²_ VARCHAR
) | What is the Armenian name of the district that is 8.37 km large? | SELECT armenian FROM table_27366772_3 WHERE area__km²_ = "8.37" | sql_create_context |
CREATE TABLE table_24263 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" real,
"U.S. viewers (millions)" text
) | Who directed the episode with a production code greater than 4301103.585233785 that was written by Curtis Kheel? | SELECT "Directed by" FROM table_24263 WHERE "Production code" > '4301103.585233785' AND "Written by" = 'Curtis Kheel' | 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... | give me the number of private insurance patients who have procedure icd9 code 8960. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.icd9_code = "8960" | mimicsql_data |
CREATE TABLE table_19943 (
"#" real,
"Season" real,
"Bowl game" text,
"Result" text,
"Opponent" text,
"Stadium" text,
"Location" text,
"Attendance" text
) | What is the location of #1? | SELECT "Location" FROM table_19943 WHERE "#" = '1' | wikisql |
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId n... | Average upvotes vs downvotes per post per month over time. | SELECT DATE(CONCAT(y, '-', m, '-', '01')), (upvotes - downvotes) / numposts FROM (SELECT YEAR(CreationDate) AS py, MONTH(CreationDate) AS pm, COUNT(*) AS numposts FROM Posts GROUP BY YEAR(CreationDate), MONTH(CreationDate)) AS p JOIN (SELECT y, m, SUM(upvote) AS upvotes, SUM(downvote) AS downvotes FROM (SELECT YEAR(Cre... | sede |
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE offering_instructor (
... | Are any 100 -level classes being offered in the Spring or Summer term ? | SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number BETWEEN 100 AND 100 + 100 AND semester.semester IN ('SP', 'SS', 'SU') AND semester.semester_id = cou... | advising |
CREATE TABLE table_name_79 (
goals_against INTEGER,
wins VARCHAR,
goals_for VARCHAR
) | Which highest 'goals against' number had wins of 19 and a 'goals for' number that was bigger than 53? | SELECT MAX(goals_against) FROM table_name_79 WHERE wins = 19 AND goals_for > 53 | sql_create_context |
CREATE TABLE table_17636 (
"State" text,
"Preliminaries" text,
"Interview" text,
"Swimsuit" text,
"Evening Gown" text,
"Average" text
) | Which interview score belongs to the state of Nevada contestant? | SELECT "Interview" FROM table_17636 WHERE "State" = 'Nevada' | wikisql |
CREATE TABLE table_204_579 (
id number,
"code" text,
"district" text,
"headquarters" text,
"population (as of 2011)" number,
"area (km2)" number,
"density (/km2)" number
) | what is the last code listed ? | SELECT "code" FROM table_204_579 ORDER BY id DESC LIMIT 1 | squall |
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,
... | 最长医疗住院时长少于3天的科室在医院5322577里一共有多少个啊? | SELECT COUNT(*) FROM (SELECT t_kc21.MED_ORG_DEPT_CD FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '5322577' GROUP BY t_kc21.MED_ORG_DEPT_CD HAVING MAX(t_kc21.IN_HOSP_DAYS) < 3) AS T | css |
CREATE TABLE table_65515 (
"Shirt No" real,
"Nationality" text,
"Player" text,
"Birth Date" text,
"Height" real,
"Position" text
) | What shirt No has a Birth Date of April 12, 1986 (age27)? | SELECT MIN("Shirt No") FROM table_65515 WHERE "Birth Date" = 'april 12, 1986 (age27)' | wikisql |
CREATE TABLE table_27913160_3 (
race VARCHAR,
most_laps_led VARCHAR
) | What race did Simon Pagenaud have the most laps in? | SELECT race FROM table_27913160_3 WHERE most_laps_led = "Simon Pagenaud" | sql_create_context |
CREATE TABLE table_51053 (
"Channel" real,
"Video" text,
"Aspect" text,
"PSIP Short Name" text,
"Programming" text
) | What Aspect has a Programming of Saigon Network Television? | SELECT "Aspect" FROM table_51053 WHERE "Programming" = 'saigon network television' | wikisql |
CREATE TABLE table_22437 (
"Rank" real,
"Title" text,
"Release Date" text,
"Franchise" text,
"Developer(s)" text,
"Platform" text,
"Units sold (in Millions)" text
) | What platform sold 11.18 million units? | SELECT "Platform" FROM table_22437 WHERE "Units sold (in Millions)" = '11.18' | wikisql |
CREATE TABLE table_name_12 (
rank INTEGER,
mountain_peak VARCHAR
) | What is the highest rank Mount Elbert has? | SELECT MAX(rank) FROM table_name_12 WHERE mountain_peak = "mount elbert" | sql_create_context |
CREATE TABLE table_name_62 (
overall INTEGER,
position VARCHAR,
college VARCHAR
) | What is the College of Rice's highest overall for the guard position? | SELECT MAX(overall) FROM table_name_62 WHERE position = "guard" AND college = "rice" | sql_create_context |
CREATE TABLE student (
ID varchar(5),
name varchar(20),
dept_name varchar(20),
tot_cred numeric(3,0)
)
CREATE TABLE instructor (
ID varchar(5),
name varchar(20),
dept_name varchar(20),
salary numeric(8,2)
)
CREATE TABLE department (
dept_name varchar(20),
building varchar(15),
... | How many students are in each department Plot them as bar chart, and order by the x axis from low to high. | SELECT dept_name, COUNT(*) FROM student GROUP BY dept_name ORDER BY dept_name | nvbench |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Na... | Most popular StackOverflow tags July2016. | SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS MayRank, ROW_NUMBER() OVER (ORDER BY num.Num DESC) AS TotalRank, rate.Rate AS QuestionsInMay, num.Num AS QuestionsTotal FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = PostId AN... | sede |
CREATE TABLE table_49330 (
"Name" text,
"Built" text,
"Listed" text,
"Location" text,
"County" text
) | When was the sargent bridge built? | SELECT "Built" FROM table_49330 WHERE "Name" = 'sargent bridge' | wikisql |
CREATE TABLE table_name_41 (
opponent VARCHAR,
date VARCHAR
) | Who was the opponent on September 17? | SELECT opponent FROM table_name_41 WHERE date = "september 17" | sql_create_context |
CREATE TABLE table_12734 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | What country is Lee Trevino from? | SELECT "Country" FROM table_12734 WHERE "Player" = 'lee trevino' | wikisql |
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
) | For those records from the products and each product's manufacturer, find name and the average of revenue , and group by attribute name, and visualize them by a bar chart, and order y axis in asc order please. | SELECT T1.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T2.Revenue | nvbench |
CREATE TABLE table_51168 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" text
) | How many weeks had a Result of w 20 6? | SELECT SUM("Week") FROM table_51168 WHERE "Result" = 'w 20–6' | wikisql |
CREATE TABLE table_46000 (
"Pick" real,
"Player" text,
"Team" text,
"Position" text,
"Hometown/School" text
) | What number pick was the player with the hometown school of concordia college? | SELECT "Pick" FROM table_46000 WHERE "Hometown/School" = 'concordia college' | wikisql |
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE S... | top users with default user name. | SELECT DisplayName, Reputation FROM Users WHERE SUBSTRING(DisplayName, 1, 4) = 'user' ORDER BY Reputation DESC | sede |
CREATE TABLE table_70967 (
"Index" text,
"Name" text,
"Chinese Name" text,
"Country" text,
"Status" text
) | What is the name of the player from Malaysia, Kuala Lumpur in Index f8? | SELECT "Name" FROM table_70967 WHERE "Country" = 'malaysia, kuala lumpur' AND "Index" = 'f8' | wikisql |
CREATE TABLE wine (
No INTEGER,
Grape TEXT,
Winery TEXT,
Appelation TEXT,
State TEXT,
Name TEXT,
Year INTEGER,
Price INTEGER,
Score INTEGER,
Cases INTEGER,
Drink TEXT
)
CREATE TABLE appellations (
No INTEGER,
Appelation TEXT,
County TEXT,
State TEXT,
Area... | Visualize the general trend of maximal price over the year, list X in desc order. | SELECT Year, MAX(Price) FROM wine GROUP BY Year ORDER BY Year DESC | nvbench |
CREATE TABLE table_name_22 (
gold INTEGER,
rank VARCHAR
) | How many total Gold medals did the nation ranked #3 receive? | SELECT SUM(gold) FROM table_name_22 WHERE rank = "3" | sql_create_context |
CREATE TABLE t_kc22 (
AMOUNT number,
CHA_ITEM_LEV number,
DATA_ID text,
DIRE_TYPE number,
DOSE_FORM text,
DOSE_UNIT text,
EACH_DOSAGE text,
EXP_OCC_DATE time,
FLX_MED_ORG_ID text,
FXBZ number,
HOSP_DOC_CD text,
HOSP_DOC_NM text,
MED_DIRE_CD text,
MED_DIRE_NM text,... | 7764485的医疗机构哪些项目的金额排在前27名 | SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.MED_SER_ORG_NO = '7764485' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY SUM(t_kc22.AMOUNT) DESC LIMIT 2... | css |
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE Po... | percentage of homework tagged questions that are closed. | SELECT Posts.Id AS "post_link", Posts.PostTypeId, Posts.ClosedDate, Posts.Tags FROM PostHistory JOIN Posts ON Posts.Id = PostHistory.PostId WHERE PostHistoryTypeId IN (3, 6) AND PostHistory.Text LIKE '%homework-and-exercises%' AND ClosedDate != '' | sede |
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... | Show me about the distribution of ACC_Regular_Season and All_Games_Percent in a bar chart. | SELECT ACC_Regular_Season, All_Games_Percent FROM basketball_match | nvbench |
CREATE TABLE table_5526 (
"Venue" text,
"Home" text,
"Guest" text,
"Score" text,
"Attendance" real
) | In what venue did FK Crvena Stijena play at home? | SELECT "Venue" FROM table_5526 WHERE "Home" = 'fk crvena stijena' | wikisql |
CREATE TABLE ship (
Name VARCHAR,
Nationality VARCHAR
) | List the name of ships whose nationality is not 'United States'. | SELECT Name FROM ship WHERE Nationality <> "United States" | sql_create_context |
CREATE TABLE table_1059 (
"Stage" real,
"Winner" text,
"General classification" text,
"Points classification" text,
"Mountains classification" text,
"Young rider classification" text,
"Team classification" text,
"Combativity award" text
) | Who won the stage when Mark Cavendish led the points classification, Rinaldo Nocentini led the general classification, and the stage was less than 11.0? | SELECT "Winner" FROM table_1059 WHERE "Points classification" = 'Mark Cavendish' AND "General classification" = 'Rinaldo Nocentini' AND "Stage" < '11.0' | wikisql |
CREATE TABLE table_name_63 (
drawn VARCHAR,
lost VARCHAR,
bonus_points VARCHAR
) | What is Drawn, when Lost is 14, and when Bonus Points is 12? | SELECT drawn FROM table_name_63 WHERE lost = "14" AND bonus_points = "12" | sql_create_context |
CREATE TABLE station_company (
Station_ID int,
Company_ID int,
Rank_of_the_Year int
)
CREATE TABLE company (
Company_ID int,
Rank int,
Company text,
Headquarters text,
Main_Industry text,
Sales_billion real,
Profits_billion real,
Assets_billion real,
Market_Value real
)
... | What are the main indstries and total market value for each industry Visualize by bar chart, I want to order sum market value in asc order. | SELECT Main_Industry, SUM(Market_Value) FROM company GROUP BY Main_Industry ORDER BY SUM(Market_Value) | nvbench |
CREATE TABLE zyjzjlb (
YLJGDM text,
JZLSH text,
MZJZLSH text,
KH text,
KLX number,
HZXM text,
WDBZ number,
RYDJSJ time,
RYTJDM number,
RYTJMC text,
JZKSDM text,
JZKSMC text,
RZBQDM text,
RZBQMC text,
RYCWH text,
CYKSDM text,
CYKSMC text,
CYBQDM tex... | 病人在医疗机构6930782就诊,住院天数超过23天的有多少人 | SELECT COUNT(DISTINCT hz_info.RYBH) FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE zyjzjlb.YLJGDM = '6930782' AND DATEDIFF(zyjzjlb.CYSJ, zyjzjlb.RYSJ) > 23 | css |
CREATE TABLE table_60285 (
"Year to April" real,
"Revenue (US $million)" real,
"EBIT (US $m)" real,
"Net profit (US $m)" real,
"Earnings per share (\u00a2)" real
) | Name the number of Earnings per share ( ) which has a Net profit (US $m) larger than 66, and a Year to April smaller than 2010? | SELECT COUNT("Earnings per share (\u00a2)") FROM table_60285 WHERE "Net profit (US $m)" > '66' AND "Year to April" < '2010' | wikisql |
CREATE TABLE table_66730 (
"# Tubes" text,
"Converter" text,
"Det/Pre-amp" text,
"Audio Amp" text,
"Rectifier" text
) | Name the det/pre-amp with # of tubes of 8 | SELECT "Det/Pre-amp" FROM table_66730 WHERE "# Tubes" = '8' | wikisql |
CREATE TABLE table_name_44 (
player VARCHAR,
position VARCHAR,
school VARCHAR
) | Who is the guard for Wisconsin? | SELECT player FROM table_name_44 WHERE position = "guard" AND school = "wisconsin" | sql_create_context |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREAT... | what medical procedure did patient 011-31229 last receive in 2105? | SELECT treatment.treatmentname FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '011-31229')) AND STRFTIME('%y', treatment.treatmenttime) = '2105'... | eicu |
CREATE TABLE table_19149550_7 (
black_caribbean_population INTEGER,
other_black_population VARCHAR
) | What is the black caribbean population when the other black population is 2243? | SELECT MAX(black_caribbean_population) FROM table_19149550_7 WHERE other_black_population = 2243 | sql_create_context |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.