context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Lessons (
lesson_id INTEGER,
customer_id INTEGER,
lesson_status_code VARCHAR(15),
staff_id INTEGER,
vehicle_id INTEGER,
lesson_date DATETIME,
lesson_time VARCHAR(10),
price DOUBLE
)
CREATE TABLE Customer_Payments (
customer_id INTEGER,
datetime_payment DATETIME,
... | List all payment methods and number of payments using each payment methods with a pie chart. | SELECT payment_method_code, COUNT(*) FROM Customer_Payments GROUP BY payment_method_code | nvbench |
CREATE TABLE table_22514 (
"Number" real,
"Sanskrit" text,
"International Alphabet of Sanskrit Transliteration" text,
"Sanskrit gloss" text,
"Western name" text,
"Greek" text,
"Gloss" text,
"Tattva (Element)" text,
"Quality" text,
"Ruling Planet" text
) | When Sagittarius is the wester name what is the sanskrit gloss? | SELECT "Sanskrit gloss" FROM table_22514 WHERE "Western name" = 'Sagittarius' | wikisql |
CREATE TABLE table_34895 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" text,
"Result" text
) | What is the first date of election for the incumbent that was re-elected in the South Carolina 1 district? | SELECT "First elected" FROM table_34895 WHERE "Result" = 're-elected' AND "District" = 'south carolina 1' | wikisql |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
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,
... | 55379841354这次门诊就诊中的病人的卡号及卡类型是什么 | SELECT mzjzjlb.KH, mzjzjlb.KLX FROM mzjzjlb WHERE mzjzjlb.JZLSH = '55379841354' | css |
CREATE TABLE table_50608 (
"Outcome" text,
"Date" real,
"Tournament" text,
"Surface" text,
"Partner" text,
"Opponents in the final" text,
"Score in the final" text
) | Who was the partner when the final score was 7 6, 3 6, 6 7? | SELECT "Partner" FROM table_50608 WHERE "Score in the final" = '7–6, 3–6, 6–7' | wikisql |
CREATE TABLE table_29126507_1 (
ground VARCHAR,
away_team VARCHAR
) | When Richmond played as the away team, what was the ground? | SELECT ground FROM table_29126507_1 WHERE away_team = "Richmond" | sql_create_context |
CREATE TABLE table_49938 (
"Player" text,
"Team" text,
"Matches" real,
"Wickets" real,
"Average" real,
"Best Bowling" text
) | Which player has an average of 38.22? | SELECT "Player" FROM table_49938 WHERE "Average" = '38.22' | wikisql |
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,
... | 列出门诊就诊90684137520的诊断名和编号 | SELECT wdmzjzjlb.JZZDBM, wdmzjzjlb.JZZDSM FROM wdmzjzjlb WHERE wdmzjzjlb.JZLSH = '90684137520' UNION SELECT bdmzjzjlb.JZZDBM, bdmzjzjlb.JZZDSM FROM bdmzjzjlb WHERE bdmzjzjlb.JZLSH = '90684137520' | css |
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | Users with most Necromancer badges at 2015-04-14. | SELECT ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) AS rank, UserId AS "user_link", COUNT(*) AS badges FROM Badges WHERE Name = 'Necromancer' AND Date < '##Date?2015-04-14##' GROUP BY UserId ORDER BY Badges DESC LIMIT 300 | sede |
CREATE TABLE table_8291 (
"Outcome" text,
"Date" text,
"Tournament" text,
"Surface" text,
"Partner" text,
"Opponents" text,
"Score" text
) | When was the outcome runner-up with a score of 4 6, 3 6? | SELECT "Date" FROM table_8291 WHERE "Outcome" = 'runner-up' AND "Score" = '4–6, 3–6' | wikisql |
CREATE TABLE table_name_99 (
singapore_league_cup VARCHAR,
name VARCHAR
) | What Singapore League Cup does Masahiro Fukasawa have? | SELECT singapore_league_cup FROM table_name_99 WHERE name = "masahiro fukasawa" | sql_create_context |
CREATE TABLE table_name_73 (
apps INTEGER,
team VARCHAR
) | Name the average apps for smederevo | SELECT AVG(apps) FROM table_name_73 WHERE team = "smederevo" | sql_create_context |
CREATE TABLE table_200_41 (
id number,
"number" text,
"encoding" text,
"implied probability" number
) | the first five implied probabilities of elias gamma coding . | SELECT "implied probability" FROM table_200_41 ORDER BY id LIMIT 5 | squall |
CREATE TABLE properties (
property_id VARCHAR
)
CREATE TABLE residents (
property_id VARCHAR
) | How many residents does each property have? List property id and resident count. | SELECT T1.property_id, COUNT(*) FROM properties AS T1 JOIN residents AS T2 ON T1.property_id = T2.property_id GROUP BY T1.property_id | sql_create_context |
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... | 哪个人申请的检验报告单51684992743其工号以及姓名都是什么? | SELECT jybgb.SQRGH, jybgb.SQRXM FROM jybgb WHERE jybgb.BGDH = '51684992743' | css |
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... | 在2007-08-06到2021-12-19期间内,患者70148968被开出的所有检验报告单中的标本采集部位需要列出来 | SELECT jybgb.BBCJBW 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 = '70148968' AND jybgb.BGRQ BETWEEN '2007-08-06' AND '202... | css |
CREATE TABLE table_name_25 (
type VARCHAR,
characters VARCHAR
) | What type has the characters ? | SELECT type FROM table_name_25 WHERE characters = "廣丙" | sql_create_context |
CREATE TABLE table_1557752_1 (
bleeding_time VARCHAR,
condition VARCHAR
) | What is the bleeding time in Bernard-soulier syndrome? | SELECT bleeding_time FROM table_1557752_1 WHERE condition = "Bernard-Soulier syndrome" | sql_create_context |
CREATE TABLE table_69547 (
"Year" real,
"Entrant" text,
"Chassis" text,
"Engine" text,
"Points" text
) | What was the earliest year that Scuderia Ferrari was an entrant with 0 points? | SELECT MIN("Year") FROM table_69547 WHERE "Points" = '0' AND "Entrant" = 'scuderia ferrari' | wikisql |
CREATE TABLE table_50416 (
"City" text,
"State" text,
"2010 population" text,
"Peak population (year)" text,
"Numeric decline from peak population" text,
"Percent decline from peak population" text
) | what is the numeric decline from peak population when 2010 population is 88857? | SELECT "Numeric decline from peak population" FROM table_50416 WHERE "2010 population" = '88857' | wikisql |
CREATE TABLE table_1921_1 (
conflict VARCHAR,
location VARCHAR
) | Which conflicts took place in Yemen? | SELECT conflict FROM table_1921_1 WHERE location = "Yemen" | sql_create_context |
CREATE TABLE photos (
id int,
camera_lens_id int,
mountain_id int,
color text,
name text
)
CREATE TABLE camera_lens (
id int,
brand text,
name text,
focal_length_mm real,
max_aperture real
)
CREATE TABLE mountain (
id int,
name text,
Height real,
Prominence real... | Bar chart x axis color y axis the number of color, sort in ascending by the x-axis please. | SELECT color, COUNT(color) FROM photos GROUP BY color ORDER BY color | nvbench |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | what is admission location of subject id 2560? | SELECT demographic.admission_location FROM demographic WHERE demographic.subject_id = "2560" | mimicsql_data |
CREATE TABLE table_74110 (
"Year (Ceremony)" text,
"English title" text,
"Spanish title" text,
"Director" text,
"Result" text
) | What was the English title of Ladrones Y Mentirosos? | SELECT "English title" FROM table_74110 WHERE "Spanish title" = 'Ladrones y mentirosos' | 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 procedures (
... | what is death status and diagnoses short title of subject name travis hofman? | SELECT demographic.expire_flag, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Travis Hofman" | mimicsql_data |
CREATE TABLE table_55921 (
"Season" text,
"Club" text,
"National League" text,
"National Cup" text,
"European Cup" text
) | Which National League is in 1969-70 season? | SELECT "National League" FROM table_55921 WHERE "Season" = '1969-70' | wikisql |
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,... | 药品574684-i在医疗就诊37204894169期间医疗机构三大目录编码及名称分别是什么呢? | SELECT t_kc22.MED_DIRE_CD, t_kc22.MED_DIRE_NM FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '37204894169' AND t_kc22.SOC_SRT_DIRE_CD = '574684-i' | css |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE intakeoutput (
... | until 2102 what was the four most frequent medications prescribed within 2 months to the sepsis male patients with age 50s after they were diagnosed with sepsis? | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'sepsis' AND STRFTIME('%y', diagnosis.diagnosistime... | eicu |
CREATE TABLE table_16687 (
"Country" text,
"Total" real,
"Marathon (mens)" real,
"Marathon (womens)" real,
"Half Marathon (mens)" real,
"Half Marathon (womens)" real
) | What is amount of countries where half marathon (women) is larger than 1.0? | SELECT COUNT("Country") FROM table_16687 WHERE "Half Marathon (womens)" > '1.0' | wikisql |
CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_description varchar,
manufacturer varchar,
basic_type varchar,
engines int,
propulsion varchar,
wide_body varchar,
wing_span int,
length int,
weight int,
capacity int,
pay_load int,
cruising_speed int,
range_... | give me the flights leaving DENVER 8 9 coming back to BOSTON | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND date_day.day_number = 9 AND date_day.month_number = 8 AND dat... | atis |
CREATE TABLE table_name_54 (
entered_service VARCHAR,
locomotive VARCHAR
) | What is the Entered service date of the H1 Locomotive? | SELECT entered_service FROM table_name_54 WHERE locomotive = "h1" | sql_create_context |
CREATE TABLE table_6751 (
"Rank" real,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | What is the average number of bronze medals with 1 silver, 5 gold, and over 6 total medals? | SELECT AVG("Bronze") FROM table_6751 WHERE "Silver" = '1' AND "Gold" = '5' AND "Total" < '6' | wikisql |
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId number,
ApprovalDate time
)
C... | Top 20 tags by number of posts for specific user. | SELECT TagName, COUNT(*) AS Posts FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId WHERE Posts.OwnerUserId = @UserId AND Posts.CommunityOwnedDate IS NULL GROUP BY TagName ORDER BY Posts DESC LIMIT 20 | sede |
CREATE TABLE table_name_93 (
fin_pos VARCHAR,
points VARCHAR
) | What was the finishing position with 13 points? | SELECT fin_pos FROM table_name_93 WHERE points = "13" | sql_create_context |
CREATE TABLE table_name_49 (
country VARCHAR,
nominating_festival VARCHAR
) | What country was the prix uip ghent nominating festival? | SELECT country FROM table_name_49 WHERE nominating_festival = "prix uip ghent" | sql_create_context |
CREATE TABLE table_66002 (
"Rank" real,
"Athlete" text,
"Country" text,
"Time" text,
"Notes" text
) | Who is the athlete from greece? | SELECT "Athlete" FROM table_66002 WHERE "Country" = 'greece' | wikisql |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE diagnosis (
diagnosisid number... | what's the average cost of a hospital that involves a procedure called removal of thoracostomy tube until 1 year ago? | 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 treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'removal of thoracostomy tube')) AND DATETIME... | eicu |
CREATE TABLE table_name_34 (
team_record VARCHAR,
attendance VARCHAR
) | What is Team Record, when Attendance is 16,151? | SELECT team_record FROM table_name_34 WHERE attendance = "16,151" | sql_create_context |
CREATE TABLE table_name_62 (
tournament VARCHAR
) | What was the 2012 finish in the US Open? | SELECT 2012 FROM table_name_62 WHERE tournament = "us open" | sql_create_context |
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CRE... | SELECT FlagTypeId,COUNT(*) FROM PendingFlags GROUP BY FlagTypeId. | SELECT FlagTypeId, COUNT(*) FROM PendingFlags GROUP BY FlagTypeId | sede |
CREATE TABLE table_name_19 (
driver VARCHAR,
fin_pos VARCHAR
) | Who was the driver who had a final position of 14? | SELECT driver FROM table_name_19 WHERE fin_pos = "14" | sql_create_context |
CREATE TABLE table_40995 (
"Position" real,
"Team" text,
"Points" real,
"Played" real,
"Drawn" real,
"Lost" real,
"Against" real,
"Difference" text
) | What is team ypiranga-sp's average position when they lost by less than 7? | SELECT AVG("Position") FROM table_40995 WHERE "Team" = 'ypiranga-sp' AND "Lost" < '7' | wikisql |
CREATE TABLE university (
School_ID int,
School text,
Location text,
Founded real,
Affiliation text,
Enrollment real,
Nickname text,
Primary_conference text
)
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Per... | Draw a bar chart about the distribution of ACC_Road and the amount of ACC_Road , and group by attribute ACC_Road, and display bars in asc order please. | SELECT ACC_Road, COUNT(ACC_Road) FROM basketball_match GROUP BY ACC_Road ORDER BY ACC_Road | nvbench |
CREATE TABLE Projects (
Project_ID INTEGER,
Project_Details VARCHAR(255)
)
CREATE TABLE Statements (
Statement_ID INTEGER,
Statement_Details VARCHAR(255)
)
CREATE TABLE Documents (
Document_ID INTEGER,
Document_Type_Code CHAR(15),
Project_ID INTEGER,
Document_Date DATETIME,
Documen... | What are the different budget type codes, and how many documents are there for each Plot them as bar chart, and list bars in desc order. | SELECT Budget_Type_Code, COUNT(*) FROM Documents_with_Expenses GROUP BY Budget_Type_Code ORDER BY Budget_Type_Code DESC | nvbench |
CREATE TABLE table_30248 (
"No." real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" real,
"U.S. viewers (million)" text
) | How many people wrote the episode that had 7.26 million u.s. viewers? | SELECT COUNT("Written by") FROM table_30248 WHERE "U.S. viewers (million)" = '7.26' | wikisql |
CREATE TABLE table_name_46 (
language VARCHAR,
film VARCHAR
) | What language is the film Marion Bridge? | SELECT language FROM table_name_46 WHERE film = "marion bridge" | sql_create_context |
CREATE TABLE table_23390604_1 (
mir_hossein_mousavi INTEGER,
spoiled_ballots VARCHAR
) | What was the highest number of votes for mir-hossein mousavi when the number of invalid votes is 5683 | SELECT MAX(mir_hossein_mousavi) FROM table_23390604_1 WHERE spoiled_ballots = 5683 | sql_create_context |
CREATE TABLE table_21818 (
"Season" text,
"Timeslot" text,
"Premiere" text,
"Finale" text,
"TV season" text,
"Ranking" text,
"Viewers (in millions)" text
) | What are all values for viewers for 1st season? | SELECT "Viewers (in millions)" FROM table_21818 WHERE "Season" = '1st' | 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 prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
... | give me the number of patients whose primary disease is morbid obesity/sda and admission year is less than 2184? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "MORBID OBESITY/SDA" AND demographic.admityear < "2184" | mimicsql_data |
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,
... | when was the last time patient 016-13544 was discharged from hospital since 5 years ago? | SELECT patient.hospitaldischargetime FROM patient WHERE patient.uniquepid = '016-13544' AND DATETIME(patient.hospitaldischargetime) >= DATETIME(CURRENT_TIME(), '-5 year') ORDER BY patient.hospitaldischargetime DESC LIMIT 1 | eicu |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugsto... | patient 035-11300 had received any laboratory test? | SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-11300')) | eicu |
CREATE TABLE table_72085 (
"Country ( exonym )" text,
"Capital ( exonym )" text,
"Country ( endonym )" text,
"Capital ( endonym )" text,
"Official or native language(s) (alphabet/script)" text
) | How many capital cities does Australia have? | SELECT COUNT("Capital ( endonym )") FROM table_72085 WHERE "Country ( endonym )" = 'Australia' | wikisql |
CREATE TABLE table_56091 (
"Club" text,
"City" text,
"Stadium" text,
"Capacity" real,
"2011\u201312 season" text
) | What is the name of the stadium for the city of melfi? | SELECT "Stadium" FROM table_56091 WHERE "City" = 'melfi' | wikisql |
CREATE TABLE table_name_80 (
league_goals INTEGER,
fa_cup_apps VARCHAR,
total_goals VARCHAR
) | Which League Goals have FA Cup Apps of 2, and Total Goals smaller than 0? | SELECT AVG(league_goals) FROM table_name_80 WHERE fa_cup_apps = "2" AND total_goals < 0 | sql_create_context |
CREATE TABLE fgwyjzb (
CLINIC_ID text,
CLINIC_TYPE text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD text,
INPT_AREA_BED text,
INSURED_IDENTITY number,
INSURED_STS text,
... | 在编码为3120762的医院里根据不同的科室编码和入院诊断疾病编码把所有医疗就诊记录中患者的平均年龄计算出来? | SELECT gwyjzb.MED_ORG_DEPT_CD, gwyjzb.IN_DIAG_DIS_CD, AVG(gwyjzb.PERSON_AGE) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '3120762' GROUP BY gwyjzb.MED_ORG_DEPT_CD, gwyjzb.IN_DIAG_DIS_CD UNION SELECT fgwyjzb.MED_ORG_DEPT_CD, fgwyjzb.IN_DIAG_DIS_CD, AVG(fgwyjzb.PERSON_AGE) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '31207... | css |
CREATE TABLE table_1414743_1 (
fte_teachers VARCHAR,
pupil_teacher_ratio VARCHAR
) | How many FTE teachers are there when the student:teacher ration is 19? | SELECT fte_teachers FROM table_1414743_1 WHERE pupil_teacher_ratio = "19" | sql_create_context |
CREATE TABLE table_name_53 (
laps VARCHAR,
grid VARCHAR
) | How many laps are there for grid 8? | SELECT laps FROM table_name_53 WHERE grid = 8 | sql_create_context |
CREATE TABLE table_49360 (
"Date" text,
"City" text,
"Event" text,
"Winner" text,
"Prize" text
) | What is the Date of the Event with a Prize of $141,426? | SELECT "Date" FROM table_49360 WHERE "Prize" = '$141,426' | wikisql |
CREATE TABLE table_45409 (
"Round" real,
"Date" text,
"Opponent" text,
"Venue" text,
"Result" text
) | What is the result when the round shows 34? | SELECT "Result" FROM table_45409 WHERE "Round" = '34' | wikisql |
CREATE TABLE appellations (
no number,
appelation text,
county text,
state text,
area text,
isava text
)
CREATE TABLE wine (
no number,
grape text,
winery text,
appelation text,
state text,
name text,
year number,
price number,
score number,
cases number,... | List the names of all distinct wines ordered by price. | SELECT DISTINCT name FROM wine ORDER BY price | spider |
CREATE TABLE torrents (
groupname text,
totalsnatched number,
artist text,
groupyear number,
releasetype text,
groupid number,
id number
)
CREATE TABLE tags (
index number,
id number,
tag text
) | What are the top 100 torrent releases? | SELECT groupname FROM torrents ORDER BY totalsnatched DESC LIMIT 100 | whatcdhiphop |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose... | when did on their first hospital visit patient 31880 first receive therapeu plasmapheresis? | SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'therapeu plasmapheresis') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 31880 AND N... | mimic_iii |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
cha... | when did patient 5887 last get a prescription for d10w during the last month? | SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5887) AND prescriptions.drug = 'd10w' AND DATETIME(prescriptions.startdate, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY prescr... | 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... | what is the number of patients whose admission location is emergency room admit and age is less than 62? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND demographic.age < "62" | mimicsql_data |
CREATE TABLE table_name_96 (
signal_quality VARCHAR,
station_call_letters VARCHAR
) | What signal quality does the KCAL-DT channel have? | SELECT signal_quality FROM table_name_96 WHERE station_call_letters = "kcal-dt" | 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... | What number of patients were diagnosed for neonatal hypoglycemia and their lab test category was chemistry? | 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 = "Neonatal hypoglycemia" AND lab."CATEGORY" = "Chemistry" | 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,... | 在2002年5月16号到2019年10月5号这段时间里,编码为4112809的医院非科室儿科呼吸内科负责的所有医疗就诊记录有哪些呀? | (SELECT * FROM t_kc21 WHERE MED_SER_ORG_NO = '4112809' AND IN_HOSP_DATE BETWEEN '2002-05-16' AND '2019-10-05') EXCEPT (SELECT * FROM t_kc21 WHERE MED_SER_ORG_NO = '4112809' AND IN_HOSP_DATE BETWEEN '2002-05-16' AND '2019-10-05' AND MED_ORG_DEPT_NM = '小儿呼吸内科') | css |
CREATE TABLE table_60169 (
"Name" text,
"Pos." text,
"Height" text,
"Weight" text,
"Date of Birth" text,
"Club" text
) | What is the height for club Havk Mladost? | SELECT "Height" FROM table_60169 WHERE "Club" = 'havk mladost' | wikisql |
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... | 就诊状态的代码及名称是什么?在43796484911这次门诊就诊中 | SELECT zzmzjzjlb.JZZTDM, zzmzjzjlb.JZZTMC FROM zzmzjzjlb WHERE zzmzjzjlb.JZLSH = '43796484911' UNION SELECT fzzmzjzjlb.JZZTDM, fzzmzjzjlb.JZZTMC FROM fzzmzjzjlb WHERE fzzmzjzjlb.JZLSH = '43796484911' | 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 diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | provide the number of black/cape verdean ethnic background patients who have diagnoses icd9 code 7810. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND diagnoses.icd9_code = "7810" | mimicsql_data |
CREATE TABLE table_24540 (
"University" text,
"Established as a university" real,
"First establishment" real,
"Student population ( FTE , 2009)" real,
"Research grants (2009, in billion SEK )" text
) | what are the student population where research grants is 1.812? | SELECT "Student population ( FTE , 2009)" FROM table_24540 WHERE "Research grants (2009, in billion SEK )" = '1.812' | wikisql |
CREATE TABLE table_4996 (
"Date" text,
"City" text,
"Opponent" text,
"Results\u00b9" text,
"Type of game" text
) | Which opponent had a result of 0:1? | SELECT "Opponent" FROM table_4996 WHERE "Results\u00b9" = '0:1' | wikisql |
CREATE TABLE table_55139 (
"Competition" text,
"Current position / round" text,
"Final position / round" text,
"First match" text,
"Last match" text
) | When the final position/round is group stage, when is the last match? | SELECT "Last match" FROM table_55139 WHERE "Final position / round" = 'group stage' | wikisql |
CREATE TABLE table_39351 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Record" text,
"Game Site" text,
"Attendance" text
) | What was the date of the game on week 7? | SELECT "Date" FROM table_39351 WHERE "Week" = '7' | wikisql |
CREATE TABLE table_3719 (
"season" text,
"division" text,
"date" text,
"home team" text,
"result" text,
"away team" text
) | What is the division where the result was 0 2? | SELECT "division" FROM table_3719 WHERE "result" = '0–2' | 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 prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
... | give me the number of patients whose gender is f and diagnoses long title is benzodiazepine-based tranquilizers causing adverse effects in therapeutic use? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.long_title = "Benzodiazepine-based tranquilizers causing adverse effects in therapeutic use" | mimicsql_data |
CREATE TABLE table_49988 (
"Exit Date" text,
"Pos." text,
"Player" text,
"To club" text,
"Transfer fee" text
) | What club received a DF player for free? | SELECT "To club" FROM table_49988 WHERE "Transfer fee" = 'free' AND "Pos." = 'df' | wikisql |
CREATE TABLE stadium (
ID int,
name text,
Capacity int,
City text,
Country text,
Opening_year int
)
CREATE TABLE event (
ID int,
Name text,
Stadium_ID int,
Year text
)
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
CREATE TABLE swimme... | Bar graph to show meter_100 from different meter 400, I want to list X-axis from low to high order. | SELECT meter_400, meter_100 FROM swimmer ORDER BY meter_400 | nvbench |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
HIRE_DATE date,
JOB_ID varchar(10),
SALARY decimal(8,2),
CO... | For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of first_name and manager_id in a bar chart, and sort by the y axis from high to low. | SELECT FIRST_NAME, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY MANAGER_ID DESC | nvbench |
CREATE TABLE table_52115 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What venue has the away side scoring 16.14 (110)? | SELECT "Venue" FROM table_52115 WHERE "Away team score" = '16.14 (110)' | wikisql |
CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_description varchar,
manufacturer varchar,
basic_type varchar,
engines int,
propulsion varchar,
wide_body varchar,
wing_span int,
length int,
weight int,
capacity int,
pay_load int,
cruising_speed int,
range_... | i would like a flight from TORONTO to SAN DIEGO that stops in KANSAS CITY | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN DIEGO' AND CITY_2.... | atis |
CREATE TABLE store_district (
store_id number,
district_id number
)
CREATE TABLE product (
product_id number,
product text,
dimensions text,
dpi number,
pages_per_minute_color number,
max_page_size text,
interface text
)
CREATE TABLE district (
district_id number,
district_... | Which district has the largest population? | SELECT district_name FROM district ORDER BY city_population DESC LIMIT 1 | spider |
CREATE TABLE table_9650 (
"Res." text,
"Record" text,
"Opponent" text,
"Method" text,
"Round" real,
"Time" text,
"Location" text
) | What is Record, when Method is 'submission (triangle choke)', and when Time is 0:48? | SELECT "Record" FROM table_9650 WHERE "Method" = 'submission (triangle choke)' AND "Time" = '0:48' | 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 demographic (
subject_id text,
hadm_id t... | give me the number of patients admitted before 2180 who had parenteral infusion of concentrated nutritional substances. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2180" AND procedures.short_title = "Entral infus nutrit sub" | mimicsql_data |
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date... | For all employees who have the letters D or S in their first name, give me the comparison about the amount of job_id over the job_id , and group by attribute job_id, and sort in asc by the the number of job id please. | SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY COUNT(JOB_ID) | nvbench |
CREATE TABLE table_8864 (
"Goal" real,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text
) | What was the competition for goal 8? | SELECT "Competition" FROM table_8864 WHERE "Goal" = '8' | wikisql |
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Descr... | Find all posts with only the 'doctrine' tag. | SELECT Id, Title, Tags FROM Posts WHERE NOT Title IS NULL AND Tags = '<doctrine>' | sede |
CREATE TABLE table_42174 (
"Date" text,
"Tournament" text,
"Winning score" text,
"Margin of victory" text,
"Runner(s)-up" text
) | What was the margin of victory on Apr 8, 1979? | SELECT "Margin of victory" FROM table_42174 WHERE "Date" = 'apr 8, 1979' | wikisql |
CREATE TABLE table_name_26 (
no_1 VARCHAR,
no_2 VARCHAR
) | What is the No. 1 of the person with a No. 2 of John? | SELECT no_1 FROM table_name_26 WHERE no_2 = "john" | sql_create_context |
CREATE TABLE table_25710 (
"GS Grade" real,
"Step 1" text,
"Step 2" text,
"Step 3" text,
"Step 4" text,
"Step 5" text,
"Step 6" text,
"Step 7" text,
"Step 8" text,
"Step 9" text,
"Step 10" text
) | Name the total number of step 6 for 11 gs grade | SELECT COUNT("Step 6") FROM table_25710 WHERE "GS Grade" = '11' | wikisql |
CREATE TABLE table_7235 (
"Rank" real,
"Name" text,
"Team" text,
"Games" real,
"Assists" real
) | How many Assists for the Player with 13 Games and a Rank less than 3? | SELECT SUM("Assists") FROM table_7235 WHERE "Games" = '13' AND "Rank" < '3' | wikisql |
CREATE TABLE takes (
ID varchar(5),
course_id varchar(8),
sec_id varchar(8),
semester varchar(6),
year numeric(4,0),
grade varchar(2)
)
CREATE TABLE time_slot (
time_slot_id varchar(4),
day varchar(1),
start_hr numeric(2),
start_min numeric(2),
end_hr numeric(2),
end_min... | How many instructors for every course in 2008? Show me a bar chart grouping by course title, could you order from low to high by the X? | SELECT title, COUNT(title) FROM course AS T1 JOIN teaches AS T2 ON T1.course_id = T2.course_id JOIN instructor AS T3 ON T2.ID = T3.ID WHERE year = 2008 GROUP BY title ORDER BY title | nvbench |
CREATE TABLE table_6302 (
"Country" text,
"Track" text,
"Length (m)" real,
"Vertical Drop (m)" real,
"Maximum Grade (%)" text,
"Bobsleigh-skeleton curves" text
) | What is the shortest length of a track in Norway that has a maximum grade of 15% and a vertical drop less than 122.22 m? | SELECT MIN("Length (m)") FROM table_6302 WHERE "Maximum Grade (%)" = '15' AND "Vertical Drop (m)" < '122.22' AND "Country" = 'norway' | wikisql |
CREATE TABLE table_56258 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | How many laps did Innes Ireland make when he had a grid more than 15? | SELECT "Laps" FROM table_56258 WHERE "Grid" > '15' AND "Driver" = 'innes ireland' | wikisql |
CREATE TABLE mountain (
mountain_id number,
name text,
height number,
prominence number,
range text,
country text
)
CREATE TABLE climber (
climber_id number,
name text,
country text,
time text,
points number,
mountain_id number
) | How many climbers are there? | SELECT COUNT(*) FROM climber | spider |
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
a... | what was patient 7112's daily average value of body weight on the current hospital visit? | SELECT AVG(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 7112 AND admissions.dischtime IS NULL)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_i... | mimic_iii |
CREATE TABLE ftxmzjzjlb (
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,
MZZYZD... | 病患50606376在2011-11-27之后做过的检验报告在哪些门诊?列出这些门诊就诊的流水编码 | SELECT txmzjzjlb.JZLSH 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 = '50606376' AND NOT txmzjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ <= '2011-11-27') UNION SELECT ftxmzjzjlb.JZLSH FROM hz_info JOI... | css |
CREATE TABLE storm (
Storm_ID int,
Name text,
Dates_active text,
Max_speed int,
Damage_millions_USD real,
Number_Deaths int
)
CREATE TABLE affected_region (
Region_id int,
Storm_ID int,
Number_city_affected real
)
CREATE TABLE region (
Region_id int,
Region_code text,
R... | For all storms with at least 1 death, compare the total number of deaths by dates_active attribute, rank by the Dates_active in desc. | SELECT Dates_active, Number_Deaths FROM storm WHERE Number_Deaths >= 1 ORDER BY Dates_active DESC | nvbench |
CREATE TABLE table_29244 (
"City" text,
"Population" real,
"Registered voters" text,
"Democratic" text,
"Republican" text,
"D\u2013R spread" text,
"Other" text,
"No party preference" text
) | What is the no party preference when the city is murrieta? | SELECT "No party preference" FROM table_29244 WHERE "City" = 'Murrieta' | wikisql |
CREATE TABLE table_58422 (
"Player" text,
"Nationality" text,
"Position" text,
"Years for Jazz" text,
"School/Club Team" text
) | What position does Michael Ruffin play? | SELECT "Position" FROM table_58422 WHERE "Player" = 'michael ruffin' | wikisql |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.