context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime t... | how many times did patient 012-4131 make a urine catheter out during their first hospital encounter? | SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-4131' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.h... | eicu |
CREATE TABLE table_name_98 (
races INTEGER,
final_placing VARCHAR,
season VARCHAR
) | In the 2005 season, how many races did the 15th place team complete? | SELECT AVG(races) FROM table_name_98 WHERE final_placing = "15th" AND season = "2005" | 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 lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,... | calculate the maximum age of patients who have pneumonia primary disease and were hospitalized for 30 days. | SELECT MAX(demographic.age) FROM demographic WHERE demographic.diagnosis = "PNEUMONIA" AND demographic.days_stay = "30" | mimicsql_data |
CREATE TABLE table_name_18 (
opponent VARCHAR,
date VARCHAR
) | Who was the opponent on November 11, 1951? | SELECT opponent FROM table_name_18 WHERE date = "november 11, 1951" | sql_create_context |
CREATE TABLE table_29544 (
"District" text,
"Incumbent" text,
"Party" text,
"Elected" real,
"Status" text,
"Result" text
) | What was the result of the election with incumbent bob barr? | SELECT "Result" FROM table_29544 WHERE "Incumbent" = 'Bob Barr' | wikisql |
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... | 在05年4月24日到11年1月23日的这几年里,共有多少新生儿的门诊就诊记录在5509091这个医疗机构 | SELECT COUNT(*) FROM txmzjzjlb WHERE txmzjzjlb.YLJGDM = '5509091' AND txmzjzjlb.JZKSRQ BETWEEN '2005-04-24' AND '2011-01-23' AND txmzjzjlb.ZSEBZ > 0 UNION SELECT COUNT(*) FROM ftxmzjzjlb WHERE ftxmzjzjlb.YLJGDM = '5509091' AND ftxmzjzjlb.JZKSRQ BETWEEN '2005-04-24' AND '2011-01-23' AND ftxmzjzjlb.ZSEBZ > 0 | css |
CREATE TABLE table_name_17 (
winner VARCHAR,
circuit VARCHAR
) | Who won at the Oran Park Raceway? | SELECT winner FROM table_name_17 WHERE circuit = "oran park raceway" | sql_create_context |
CREATE TABLE table_1179 (
"Province" text,
"Swimsuit" text,
"Evening Gown" text,
"Interview" text,
"Average" text
) | How many averages for the province with evening gown score of 8.00 | SELECT COUNT("Average") FROM table_1179 WHERE "Evening Gown" = '8.00' | wikisql |
CREATE TABLE table_19656 (
"Position" real,
"Team" text,
"Played" real,
"Wins" real,
"Draws" real,
"Losses" real,
"Scored" real,
"Conceded" real,
"Points" real
) | How many points when 15 is scored is considered the minimum? | SELECT MIN("Points") FROM table_19656 WHERE "Scored" = '15' | wikisql |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | how many patients have the drug code pant40i? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "PANT40I" | mimicsql_data |
CREATE TABLE table_46221 (
"Model Name" text,
"Engine" text,
"Top Speed" text,
"No. of Gears" real,
"Electrics" text
) | Which Top Speed has a Model Name of d14/4 supreme d14/4 sports & bushman? | SELECT "Top Speed" FROM table_46221 WHERE "Model Name" = 'd14/4 supreme d14/4 sports & bushman' | wikisql |
CREATE TABLE table_75272 (
"Rider" text,
"Manufacturer" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | How many grids have more than 24 laps with a time/retired of +1:12.208? | SELECT SUM("Grid") FROM table_75272 WHERE "Time/Retired" = '+1:12.208' AND "Laps" > '24' | wikisql |
CREATE TABLE table_15661 (
"Rank" real,
"Lane" real,
"Name" text,
"Nationality" text,
"Time" text
) | How many ranks are higher than lane 4 from Great Britain, raced by Margaretha Pedder? | SELECT COUNT("Rank") FROM table_15661 WHERE "Lane" > '4' AND "Nationality" = 'great britain' AND "Name" = 'margaretha pedder' | wikisql |
CREATE TABLE table_name_63 (
affiliation VARCHAR,
nickname VARCHAR
) | Who is affiliated with the Dukes? | SELECT affiliation FROM table_name_63 WHERE nickname = "dukes" | sql_create_context |
CREATE TABLE table_name_42 (
city VARCHAR,
iata VARCHAR
) | Which city has an IATA of AUH? | SELECT city FROM table_name_42 WHERE iata = "auh" | sql_create_context |
CREATE TABLE table_11229 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What was the home team when geelong was the away team? | SELECT "Home team" FROM table_11229 WHERE "Away team" = 'geelong' | wikisql |
CREATE TABLE table_24253 (
"Location Chernobyl 1 Chernobyl 2 Chernobyl 3 Chernobyl 4 Chernobyl 5 Ignalina 1 Ignalina 2 Ignalina 3 Kursk 1 Kursk 2 Kursk 3 Kursk 4 Kursk 5 Kursk 6 Leningrad 1 Leningrad 2 Leningrad 3 Leningrad 4 Smolensk 1 Smolensk 2 Smolensk 3 Smolensk 4 Directorate for Construction of Kostoma NPP (F... | What is the gross capacity where the net capacity is 1380? | SELECT MIN("Gross Capacity (MW)") FROM table_24253 WHERE "Net Capacity (MW)" = '1380' | wikisql |
CREATE TABLE gyb (
CLINIC_ID text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD text,
INPT_AREA_BED text,
INSURED_IDENTITY number,
INSURED_STS text,
INSU_TYPE text,
IN... | 在医院4429415入院诊断的时候患者83841154的疾病名称不含有鼻炎的医疗就诊记录是啥编号? | SELECT qtb.MED_CLINIC_ID FROM qtb WHERE qtb.PERSON_ID = '83841154' AND qtb.MED_SER_ORG_NO = '4429415' AND NOT qtb.IN_DIAG_DIS_NM LIKE '%鼻炎%' UNION SELECT gyb.MED_CLINIC_ID FROM gyb WHERE gyb.PERSON_ID = '83841154' AND gyb.MED_SER_ORG_NO = '4429415' AND NOT gyb.IN_DIAG_DIS_NM LIKE '%鼻炎%' UNION SELECT zyb.MED_CLINIC_ID F... | css |
CREATE TABLE table_name_72 (
country VARCHAR,
score VARCHAR
) | From what country did someone score 71? | SELECT country FROM table_name_72 WHERE score = 71 | sql_create_context |
CREATE TABLE driver (
Driver_ID int,
Name text,
Party text,
Home_city text,
Age int
)
CREATE TABLE school (
School_ID int,
Grade text,
School text,
Location text,
Type text
)
CREATE TABLE school_bus (
School_ID int,
Driver_ID int,
Years_Working int,
If_full_time... | Plot the average of age by grouped by home city as a bar graph, and sort total number from low to high order. | SELECT Home_city, AVG(Age) FROM driver GROUP BY Home_city ORDER BY AVG(Age) | nvbench |
CREATE TABLE table_name_28 (
place VARCHAR,
to_par VARCHAR
) | What place had a To par of 10? | SELECT place FROM table_name_28 WHERE to_par = "–10" | sql_create_context |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CRE... | had patient 002-41152 undergone the lab test during the last month? | 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 = '002-41152')) AND DATETIME(lab.labresulttime, 'start of month') = DATETIME(CURRENT_TIME()... | eicu |
CREATE TABLE table_54340 (
"Driver" text,
"Team" text,
"Laps" real,
"Time/Retired" text,
"Grid" text,
"Points" real
) | What is the average point count for tristan gommendy? | SELECT AVG("Points") FROM table_54340 WHERE "Driver" = 'tristan gommendy' | 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,
... | 病人任阳焱在门诊诊断为2型糖尿病的检测指标983934的结果定量和单位是多少啊? | SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW 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... | css |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE patient (
... | how many patients had been in the ward 516 until 2104? | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.wardid = 516 AND STRFTIME('%y', patient.unitadmittime) <= '2104' | eicu |
CREATE TABLE table_54366 (
"Season" text,
"Winner" text,
"Team" text,
"Position" text,
"Win #" real
) | How many times did jim vivona win? | SELECT COUNT("Win #") FROM table_54366 WHERE "Winner" = 'jim vivona' | wikisql |
CREATE TABLE table_11960407_4 (
high_points VARCHAR,
date VARCHAR
) | Who had the high points on January 23? | SELECT high_points FROM table_11960407_4 WHERE date = "January 23" | sql_create_context |
CREATE TABLE table_47574 (
"City" text,
"Country" text,
"IATA" text,
"ICAO" text,
"Airport" text
) | What is the ICAO when the IATA is tgg? | SELECT "ICAO" FROM table_47574 WHERE "IATA" = 'tgg' | wikisql |
CREATE TABLE enzyme (
id number,
name text,
location text,
product text,
chromosome text,
omim number,
porphyria text
)
CREATE TABLE medicine (
id number,
name text,
trade_name text,
fda_approved text
)
CREATE TABLE medicine_enzyme_interaction (
enzyme_id number,
me... | What is the total count of enzymes? | SELECT COUNT(*) FROM enzyme | spider |
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25),
COUNTRY_ID varchar(2)
)
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decima... | For those employees who was hired before 2002-06-21, a line chart shows the change of salary over hire_date, and list x-axis in ascending order. | SELECT HIRE_DATE, SALARY FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY HIRE_DATE | nvbench |
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE Posts (
Id number,
PostTypeId number,
Accepted... | What are the most viewed profiles?. | SELECT Id AS "user_link", Views, Reputation FROM Users WHERE Views > 6000 ORDER BY Views DESC | sede |
CREATE TABLE table_46407 (
"Name" text,
"Latitude" text,
"Longitude" text,
"Diameter (km)" real,
"Year named" real
) | What's the diameter when longitude is 105.0e before 2003? | SELECT SUM("Diameter (km)") FROM table_46407 WHERE "Longitude" = '105.0e' AND "Year named" < '2003' | wikisql |
CREATE TABLE Customers (
customer_id INTEGER,
payment_method_code VARCHAR(10),
customer_code VARCHAR(20),
customer_name VARCHAR(80),
customer_address VARCHAR(255),
customer_phone VARCHAR(80),
customer_email VARCHAR(80)
)
CREATE TABLE Staff (
staff_id INTEGER,
staff_gender VARCHAR(1)... | What is the average price for each type of product Visualize by bar chart, and show bar in descending order. | SELECT product_type_code, AVG(product_price) FROM Products GROUP BY product_type_code ORDER BY product_type_code DESC | nvbench |
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
... | in this year, how many patients were prescribed with potassium chloride inj within 2 months after having undergone vte prophylaxis - compression boots. | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'vte prophylaxis - compression boots' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRE... | eicu |
CREATE TABLE table_name_50 (
week INTEGER,
opponent VARCHAR
) | What was the score of the game against the San Diego Chargers? | SELECT SUM(week) FROM table_name_50 WHERE opponent = "san diego chargers" | sql_create_context |
CREATE TABLE table_20339 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written By" text,
"Originalairdate" text,
"TV Broadcast" text
) | Who directed the TV broadcast s03e19? | SELECT "Directed by" FROM table_20339 WHERE "TV Broadcast" = 'S03E19' | wikisql |
CREATE TABLE table_51577 (
"Club" text,
"Leagues" text,
"Venue" text,
"Location" text,
"Capacity" real,
"Established" real
) | What is the location of a1 women's - handball? | SELECT "Location" FROM table_51577 WHERE "Leagues" = 'a1 women''s - handball' | wikisql |
CREATE TABLE table_203_215 (
id number,
"year" number,
"competition" text,
"venue" text,
"position" text,
"event" text,
"notes" text
) | what was the least position won ? | SELECT "position" FROM table_203_215 ORDER BY "position" DESC LIMIT 1 | squall |
CREATE TABLE table_72870 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | When tracy mcgrady (8) is leading in assists what is the date? | SELECT "Date" FROM table_72870 WHERE "High assists" = 'Tracy McGrady (8)' | wikisql |
CREATE TABLE culture_company (
Company_name text,
Type text,
Incorporated_in text,
Group_Equity_Shareholding real,
book_club_id text,
movie_id text
)
CREATE TABLE movie (
movie_id int,
Title text,
Year int,
Director text,
Budget_million real,
Gross_worldwide int
)
CREAT... | Show the total number from each category, and list by the total number in asc please. | SELECT Category, COUNT(*) FROM book_club GROUP BY Category ORDER BY COUNT(*) | nvbench |
CREATE TABLE table_19950 (
"Competition" text,
"Played" real,
"Derby County" real,
"Draw" real,
"Nottingham Forest" real,
"Derby County Goals" real,
"Nottingham Forest Goals" real
) | Name the most derby county | SELECT MAX("Derby County") FROM table_19950 | wikisql |
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE i... | how many patients received contrast arteriogram nec within the same hospital visit last year after they were diagnosed with adv eff anticoagulants? | SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id 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 =... | mimic_iii |
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE Badges (
Id number,
UserId number,
Name text,
Date time,
Class number,
TagBased boolean
)
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description... | Registered users per month and year. | SELECT TIME_TO_STR(u.CreationDate, '%Y') AS "year", TIME_TO_STR(u.CreationDate, '%m') AS "month", COUNT(*) AS "registered_users_count" FROM Users AS u GROUP BY TIME_TO_STR(u.CreationDate, '%Y'), TIME_TO_STR(u.CreationDate, '%m') ORDER BY 'year', 'month' | sede |
CREATE TABLE table_2562572_43 (
type VARCHAR,
cyrillic_name_other_names VARCHAR
) | How many entries are there for type for the cyrillic name other names is (slovak: padina)? | SELECT COUNT(type) FROM table_2562572_43 WHERE cyrillic_name_other_names = "Падина (Slovak: Padina)" | sql_create_context |
CREATE TABLE table_204_968 (
id number,
"squad #" number,
"position" text,
"player" text,
"transferred to" text,
"fee" text,
"date" text
) | li haiqiang and xu deshuai both played which position ? | SELECT "position" FROM table_204_968 WHERE "player" = 'li haiqiang' | squall |
CREATE TABLE table_203_868 (
id number,
"frequency band" text,
"band number" number,
"radio interface" text,
"generation" text,
"status" text,
"notes" text
) | what is the first band number listed on this chart ? | SELECT "band number" FROM table_203_868 WHERE id = 1 | squall |
CREATE TABLE table_35768 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text
) | Name the home with chicago visiting | SELECT "Home" FROM table_35768 WHERE "Visitor" = 'chicago' | wikisql |
CREATE TABLE Projects (
Code Char(4),
Name Char(50),
Hours int
)
CREATE TABLE AssignedTo (
Scientist int,
Project char(4)
)
CREATE TABLE Scientists (
SSN int,
Name Char(30)
) | A bar chart for finding the number of the name of the project for which a scientist whose name contains Smith is assigned to, rank from high to low by the bars. | SELECT T2.Name, COUNT(T2.Name) FROM AssignedTo AS T1 JOIN Projects AS T2 ON T1.Project = T2.Code JOIN Scientists AS T3 ON T1.Scientist = T3.SSN WHERE T3.Name LIKE '%Smith%' GROUP BY T2.Name ORDER BY T2.Name DESC | nvbench |
CREATE TABLE table_9206 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" real
) | What is the highest Week, when Date is 'November 8, 1970'? | SELECT MAX("Week") FROM table_9206 WHERE "Date" = 'november 8, 1970' | wikisql |
CREATE TABLE table_name_81 (
series__number INTEGER,
directed_by VARCHAR,
written_by VARCHAR
) | What series number was directed by milan cheylov and written by will dixon? | SELECT AVG(series__number) FROM table_name_81 WHERE directed_by = "milan cheylov" AND written_by = "will dixon" | sql_create_context |
CREATE TABLE table_3256 (
"Information" text,
"James E. Holmes" text,
"Reidsville" text,
"Rockingham County" text,
"Western Rockingham Middle School" text
) | Name the james e. holmes for duane hensley | SELECT "James E. Holmes" FROM table_3256 WHERE "Western Rockingham Middle School" = 'Duane Hensley' | wikisql |
CREATE TABLE table_24370270_10 (
final_weight__kg_ VARCHAR,
contestant VARCHAR
) | What is the final weight for contestant Chris? | SELECT final_weight__kg_ FROM table_24370270_10 WHERE contestant = "Chris" | sql_create_context |
CREATE TABLE zyjzjlb (
CYBQDM text,
CYBQMC text,
CYCWH text,
CYKSDM text,
CYKSMC text,
CYSJ time,
CYZTDM number,
HZXM text,
JZKSDM text,
JZKSMC text,
JZLSH text,
KH text,
KLX number,
MZBMLX number,
MZJZLSH text,
MZZDBM text,
MZZDMC text,
MZZYZDZZBM... | 询问一下患者98644163往常有过什么异常情况吗? | 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 PostsWithDeleted (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate time,
Score number,
ViewCount number,
Body text,
OwnerUserId number,
OwnerDisplayName text,
LastEditorUserId number,
LastEditorDispl... | Votes on Your Posts Aggregations. | SELECT pt.Name, vt.Name, COUNT(*) FROM Users AS u JOIN Posts AS p ON p.OwnerUserId = u.Id JOIN PostTypes AS pt ON pt.Id = p.PostTypeId JOIN Votes AS v ON v.PostId = p.Id JOIN VoteTypes AS vt ON vt.Id = v.VoteTypeId WHERE u.Id = '##UserID##' GROUP BY vt.Name, pt.Name | sede |
CREATE TABLE table_58036 (
"Round" real,
"Player" text,
"Nationality" text,
"NHL Team" text,
"College/Junior/Club Team (League)" text
) | what is the highest round when the player is troy creurer (d)? | SELECT MAX("Round") FROM table_58036 WHERE "Player" = 'troy creurer (d)' | wikisql |
CREATE TABLE station (
id INTEGER,
name TEXT,
lat NUMERIC,
long NUMERIC,
dock_count INTEGER,
city TEXT,
installation_date TEXT
)
CREATE TABLE status (
station_id INTEGER,
bikes_available INTEGER,
docks_available INTEGER,
time TEXT
)
CREATE TABLE weather (
date TEXT,
... | List the name and the number of stations for all the cities that have at least 15 stations Show bar chart, and sort in ascending by the Y-axis. | SELECT city, COUNT(*) FROM station GROUP BY city ORDER BY COUNT(*) | nvbench |
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, give me the comparison about the average of code over the name , and group by attribute name. | SELECT T2.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name | nvbench |
CREATE TABLE film (
Studio VARCHAR,
Director VARCHAR
) | Show the studios that have not produced films with director 'Walter Hill'. | SELECT Studio FROM film EXCEPT SELECT Studio FROM film WHERE Director = "Walter Hill" | sql_create_context |
CREATE TABLE table_22420 (
"Team" text,
"Outgoing manager" text,
"Manner of departure" text,
"Date of vacancy" text,
"Replaced by" text,
"Date of appointment" text,
"Position in table" text
) | Name the date of vacancy for daniel uberti | SELECT "Date of vacancy" FROM table_22420 WHERE "Outgoing manager" = 'Daniel Uberti' | wikisql |
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... | 从零零年一月二十四号到零四年四月十四号,患者85533304这个甲状腺摄取实验情况怎么样 | SELECT * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.... | css |
CREATE TABLE table_name_68 (
centerfold_model VARCHAR,
interview_subject VARCHAR
) | Who was the Centerfold model in the issue in which the Interview subject was Paul Simon? | SELECT centerfold_model FROM table_name_68 WHERE interview_subject = "paul simon" | sql_create_context |
CREATE TABLE table_3811 (
"Sd" real,
"Rk" real,
"Player" text,
"Points" real,
"Points defending" real,
"Points won" real,
"New points" real,
"Status" text
) | What are the total points for sd 15? | SELECT MAX("Points") FROM table_3811 WHERE "Sd" = '15' | wikisql |
CREATE TABLE table_54811 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | What is the mean number of laps where Time/retired was a water leak and the grid number was bigger than 12? | SELECT AVG("Laps") FROM table_54811 WHERE "Time/Retired" = 'water leak' AND "Grid" > '12' | wikisql |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
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,... | For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of last_name and salary . | SELECT LAST_NAME, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) | nvbench |
CREATE TABLE table_dev_23 (
"id" int,
"anemia" bool,
"gender" string,
"thyroid_disease" bool,
"hemoglobin_a1c_hba1c" float,
"tsh" int,
"renal_disease" bool,
"estimated_glomerular_filtration_rate_egfr" int,
"hba1c" float,
"insulin_requirement" float,
"body_mass_index_bmi" floa... | abnormal renal function test results ( calculated gfr < 60 ml / min / 1.73 m2 ) | SELECT * FROM table_dev_23 WHERE renal_disease = 1 OR estimated_glomerular_filtration_rate_egfr < 60 | criteria2sql |
CREATE TABLE student (
stuid number,
lname text,
fname text,
age number,
sex text,
major number,
advisor number,
city_code text
)
CREATE TABLE course (
cid text,
cname text,
credits number,
instructor number,
days text,
hours text,
dno number
)
CREATE TABLE ... | Find the first name of students not enrolled in any course. | SELECT fname FROM student WHERE NOT stuid IN (SELECT stuid FROM enrolled_in) | spider |
CREATE TABLE table_name_4 (
venue VARCHAR,
round VARCHAR
) | What venue had SF? | SELECT venue FROM table_name_4 WHERE round = "sf" | sql_create_context |
CREATE TABLE table_27197 (
"No. in series" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"U.S. viewers (millions)" text
) | Who is the director when there is 11.21 million viewers? | SELECT "Directed by" FROM table_27197 WHERE "U.S. viewers (millions)" = '11.21' | wikisql |
CREATE TABLE useracct (
name VARCHAR,
u_id VARCHAR
)
CREATE TABLE review (
rating INTEGER,
u_id VARCHAR
) | For each user, return the name and the average rating of reviews given by them. | SELECT T1.name, AVG(T2.rating) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id | sql_create_context |
CREATE TABLE table_29731 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | Who got the high rebounds if Brook Lopez (15) earned the high points? | SELECT "High rebounds" FROM table_29731 WHERE "High points" = 'Brook Lopez (15)' | 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,... | 编号为4821131的这个医院的医疗记录中,出院诊断为T22.309的最低医疗费总额是多少?最高医疗费总额是多少 | SELECT MIN(t_kc24.MED_AMOUT), MAX(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '4821131' AND t_kc21.OUT_DIAG_DIS_CD = 'T22.309') | css |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
... | Among patients admitted before the year 2184, how many of them had a seroma complicating a procedure? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2184" AND diagnoses.long_title = "Seroma complicating a procedure" | mimicsql_data |
CREATE TABLE farm_competition (
competition_id number,
year number,
theme text,
host_city_id number,
hosts text
)
CREATE TABLE farm (
farm_id number,
year number,
total_horses number,
working_horses number,
total_cattle number,
oxen number,
bulls number,
cows number,... | What are the statuses and average populations of each city? | SELECT status, AVG(population) FROM city GROUP BY status | spider |
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... | how many patients had the diagnosis icd9 code 5770 with a drug route left eye? | 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.icd9_code = "5770" AND prescriptions.route = "LEFT EYE" | mimicsql_data |
CREATE TABLE table_name_20 (
rank VARCHAR,
nation VARCHAR,
gold VARCHAR,
bronze VARCHAR
) | What rank has a gold greater than 0, 0 as the bronze, with germany (ger) as the nation? | SELECT rank FROM table_name_20 WHERE gold > 0 AND bronze = 0 AND nation = "germany (ger)" | sql_create_context |
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
discharge_location text,
insurance text,
language text,
marital_status text,
ethnicity text,
age number
)
CREATE ... | when did patient 91768 enter the hospital for the last time in 2102? | SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 91768 AND STRFTIME('%y', admissions.admittime) = '2102' ORDER BY admissions.admittime DESC LIMIT 1 | mimic_iii |
CREATE TABLE table_204_691 (
id number,
"date" text,
"round" text,
"opponent" text,
"venue" text,
"result" text,
"attendance" number,
"scorers" text
) | what is the total number of times that hateley scored in the uefa champions league ? | SELECT COUNT(*) FROM table_204_691 WHERE "scorers" = 'hateley' | squall |
CREATE TABLE table_name_88 (
event VARCHAR,
name VARCHAR
) | What event did Rastislav Turecek participate in? | SELECT event FROM table_name_88 WHERE name = "rastislav turecek" | sql_create_context |
CREATE TABLE table_name_1 (
driver VARCHAR,
team VARCHAR
) | Who is the Driver with the Team of P & L Mechanical Services? | SELECT driver FROM table_name_1 WHERE team = "p & l mechanical services" | sql_create_context |
CREATE TABLE table_name_81 (
title VARCHAR,
duration VARCHAR
) | Which of the titles have a duration time of 4:57? | SELECT title FROM table_name_81 WHERE duration = "4:57" | sql_create_context |
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
Di... | Almost Good Questions and Answers. | SELECT a.Id AS "post_link", Users.DisplayName FROM Posts AS a JOIN Users ON a.OwnerUserId = Users.Id WHERE Score = 24 | sede |
CREATE TABLE table_name_77 (
party VARCHAR,
constiuency VARCHAR
) | What is the Party of the council member for the Fifth District? | SELECT party FROM table_name_77 WHERE constiuency = "council member for the fifth district" | sql_create_context |
CREATE TABLE table_name_12 (
location VARCHAR,
round VARCHAR,
score VARCHAR
) | At what Location in Round 3 is the Score 1-1? | SELECT location FROM table_name_12 WHERE round = "round 3" AND score = "1-1" | sql_create_context |
CREATE TABLE table_204_312 (
id number,
"stage" text,
"date" text,
"route" text,
"terrain" text,
"length" text,
"winner" text
) | which stage was longer , 3 or 8 ? | SELECT "stage" FROM table_204_312 WHERE "stage" IN ('3', '8') ORDER BY "length" DESC LIMIT 1 | squall |
CREATE TABLE table_50512 (
"Rank" real,
"Name" text,
"Team(s)" text,
"Birth date" text,
"Death date" text,
"Age (as of 1 February 2014)" text,
"Nationality" text
) | What was the date of death for a rank below 14 and age of 103 years, 148 days? | SELECT "Death date" FROM table_50512 WHERE "Rank" < '14' AND "Age (as of 1 February 2014)" = '103 years, 148 days' | wikisql |
CREATE TABLE table_train_140 (
"id" int,
"gender" string,
"mini_mental_state_examination_mmse" int,
"allergy_to_quinidine" bool,
"systolic_blood_pressure_sbp" int,
"postural_syncope" bool,
"hypotension" bool,
"unexplained_syncope" bool,
"allergy_to_dextromethorphan" bool,
"allerg... | adults ( male and female ) aged > 70 years, clinical dementia rating ( cdr ) = 0.5 - 1 and mini _ mental state examination ( mmse ) : 20 - 25 | SELECT * FROM table_train_140 WHERE age >= 18 AND (gender = 'male' OR gender = 'female') AND age > 70 AND (clinical_dementia_rating_cdr >= 0.5 AND clinical_dementia_rating_cdr <= 1) AND (mini_mental_state_examination_mmse >= 20 AND mini_mental_state_examination_mmse <= 25) | criteria2sql |
CREATE TABLE table_14853156_2 (
earnings___ VARCHAR,
best_finish VARCHAR,
scoring_average VARCHAR
) | How many total earnings are recorded when her best finish is t2 with a 71.25 scoring average? | SELECT COUNT(earnings___) AS $__ FROM table_14853156_2 WHERE best_finish = "T2" AND scoring_average = "71.25" | sql_create_context |
CREATE TABLE table_27786562_1 (
poles VARCHAR,
season VARCHAR
) | Name the poles for season 2006 | SELECT poles FROM table_27786562_1 WHERE season = 2006 | sql_create_context |
CREATE TABLE table_23449363_1 (
leagues_entering_at_this_round VARCHAR,
round VARCHAR
) | Which leagues entered an extra preliminary round? | SELECT leagues_entering_at_this_round FROM table_23449363_1 WHERE round = "Extra Preliminary round" | sql_create_context |
CREATE TABLE table_name_29 (
region VARCHAR,
date VARCHAR
) | What shows for region when the date is february 2006? | SELECT region FROM table_name_29 WHERE date = "february 2006" | sql_create_context |
CREATE TABLE competition (
Competition_ID int,
Year real,
Competition_type text,
Country text
)
CREATE TABLE player (
Player_ID int,
name text,
Position text,
Club_ID int,
Apps real,
Tries real,
Goals text,
Points real
)
CREATE TABLE club_rank (
Rank real,
Club_... | List the position of players and the average number of points of players of each position by a bar chart, rank by the bars in desc. | SELECT Position, AVG(Points) FROM player GROUP BY Position ORDER BY Position DESC | nvbench |
CREATE TABLE table_204_349 (
id number,
"year" number,
"conservative\ncouncillors" number,
"labour\ncouncillors" number,
"independent\ncouncillors" number,
"liberal\ncouncillors" number
) | how many years had at least 15 or more independent councillors ? | SELECT COUNT("year") FROM table_204_349 WHERE "independent\ncouncillors" >= 15 | squall |
CREATE TABLE table_3566 (
"Contestant" text,
"Place" real,
"Age" real,
"Country" text,
"Federal state" text,
"City" text,
"Height" text,
"Measurements (in cm)" text
) | for how many federal states is the city of lahnstein listed in the ranking? | SELECT COUNT("Federal state") FROM table_3566 WHERE "City" = 'Lahnstein' | wikisql |
CREATE TABLE customers (
customer_name VARCHAR,
customer_id VARCHAR
)
CREATE TABLE customer_orders (
customer_id VARCHAR,
order_status_code VARCHAR
) | Return the distinct name of customers whose order status is Pending, in the order of customer id. | SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = "Pending" ORDER BY T2.customer_id | sql_create_context |
CREATE TABLE table_53002 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What is the score of the away team that played richmond? | SELECT "Away team score" FROM table_53002 WHERE "Home team" = 'richmond' | wikisql |
CREATE TABLE table_23415 (
"No. overall" text,
"No. in series" real,
"Family/families" text,
"Location(s)" text,
"Original air date" text
) | Name the family/families uk17 | SELECT "Family/families" FROM table_23415 WHERE "No. overall" = 'UK17' | wikisql |
CREATE TABLE table_name_30 (
zone VARCHAR,
opponents VARCHAR
) | Which zone had m d lina gojnea monica niculescu as the opponent? | SELECT zone FROM table_name_30 WHERE opponents = "mădălina gojnea monica niculescu" | 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 is the number of patients whose ethnicity is hispanic/latino - puerto rican and diagnoses icd9 code is 51889? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND diagnoses.icd9_code = "51889" | mimicsql_data |
CREATE TABLE train (
Train_ID int,
Train_Num text,
Name text,
From text,
Arrival text,
Railway_ID int
)
CREATE TABLE manager (
Manager_ID int,
Name text,
Country text,
Working_year_starts text,
Age int,
Level int
)
CREATE TABLE railway (
Railway_ID int,
Railway ... | Show id and location of railways that are associated with more than one train by a bar chart, order in asc by the Y. | SELECT T1.Location, T1.Railway_ID FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID ORDER BY T1.Railway_ID | nvbench |
CREATE TABLE t_kc24 (
ACCOUNT_DASH_DATE time,
ACCOUNT_DASH_FLG number,
CASH_PAY number,
CIVIL_SUBSIDY number,
CKC102 number,
CLINIC_ID text,
CLINIC_SLT_DATE time,
COMP_ID text,
COM_ACC_PAY number,
COM_PAY number,
DATA_ID text,
ENT_ACC_PAY number,
ENT_PAY number,
F... | 从07年9月13日到18年12月25日,医院3132833一共有多少医疗记录 | SELECT COUNT(*) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '3132833' AND gwyjzb.IN_HOSP_DATE BETWEEN '2007-09-13' AND '2018-12-25' UNION SELECT COUNT(*) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '3132833' AND fgwyjzb.IN_HOSP_DATE BETWEEN '2007-09-13' AND '2018-12-25' | css |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.