context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
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... | count the number of patients whose procedure short title is coronary arteriogram nec? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.short_title = "Coronary arteriogram NEC" | mimicsql_data |
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE labevents (
row_id number,
... | what did patient 72032's marital status in their current hospital encounter? | SELECT admissions.marital_status FROM admissions WHERE admissions.subject_id = 72032 AND admissions.dischtime IS NULL | mimic_iii |
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes nu... | Posts by (now) deleted users. | SELECT Id AS "post_link", Title, Score, CreationDate AS OwnerDisplayName FROM Posts WHERE OwnerUserId IS NULL ORDER BY CreationDate LIMIT 100 | sede |
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... | 患者袁嘉丽的哪些门诊就诊记录对应的检验报告单的报告日期是在2016年7月27日之前的?列出它们的流水号 | SELECT wdmzjzjlb.JZLSH FROM person_info JOIN hz_info JOIN wdmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE person_info.XM = '袁嘉丽' AND NOT wdmzjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ >= '2016-07-2... | css |
CREATE TABLE table_17085981_2 (
manner_of_departure VARCHAR,
team VARCHAR,
outgoing_manager VARCHAR
) | What was the manner of departure for Edgar Schmitt of the Stuttgarter Kickers? | SELECT manner_of_departure FROM table_17085981_2 WHERE team = "Stuttgarter Kickers" AND outgoing_manager = "Edgar Schmitt" | sql_create_context |
CREATE TABLE table_14125006_1 (
agency VARCHAR,
astronaut VARCHAR
) | What agency does Anderson Clayton Anderson work for? | SELECT agency FROM table_14125006_1 WHERE astronaut = "Anderson Clayton Anderson" | sql_create_context |
CREATE TABLE campuses (
campus VARCHAR,
id VARCHAR
)
CREATE TABLE faculty (
campus VARCHAR,
year VARCHAR,
faculty VARCHAR
) | Which campus has the most faculties in year 2003? | SELECT T1.campus FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = T2.campus WHERE T2.year = 2003 ORDER BY T2.faculty DESC LIMIT 1 | 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 procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
... | provide the number of patients whose diagnoses icd9 code is 99799 and drug route is ng? | 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 = "99799" AND prescriptions.route = "NG" | mimicsql_data |
CREATE TABLE aircraft (
aid number,
name text,
distance number
)
CREATE TABLE employee (
eid number,
name text,
salary number
)
CREATE TABLE certificate (
eid number,
aid number
)
CREATE TABLE flight (
flno number,
origin text,
destination text,
distance number,
de... | What are the names of all aircrafts that can cover more distances than average? | SELECT name FROM aircraft WHERE distance > (SELECT AVG(distance) FROM aircraft) | spider |
CREATE TABLE table_name_17 (
silver INTEGER,
total VARCHAR,
rank VARCHAR
) | Tell me the least silver for total less than 6 and rank of 8 | SELECT MIN(silver) FROM table_name_17 WHERE total < 6 AND rank = "8" | sql_create_context |
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE allergy (
allergy... | how many admitted patients are there currently? | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.hospitaldischargetime IS NULL | eicu |
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 text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | what is maximum age of patients whose insurance is private and discharge location is home? | SELECT MAX(demographic.age) FROM demographic WHERE demographic.insurance = "Private" AND demographic.discharge_location = "HOME" | mimicsql_data |
CREATE TABLE table_57040 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | Where does the home team fitzroy play? | SELECT "Venue" FROM table_57040 WHERE "Home team" = 'fitzroy' | wikisql |
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number... | SO - Total Posts by Could Service Providers Per Month - Amazon. | SELECT CONCAT(YEAR(P.CreationDate), '-', MONTH(P.CreationDate)) AS YearMonth, 'Amazon' AS TagName, COUNT(*) AS PostCount FROM Posts AS P INNER JOIN PostTags AS PT ON (P.Id = PT.PostId) INNER JOIN Tags AS T ON (PT.TagId = T.Id) WHERE T.TagName LIKE 'amazon%' GROUP BY YEAR(P.CreationDate), MONTH(P.CreationDate) ORDER BY ... | sede |
CREATE TABLE table_73646 (
"WEEK" real,
"Sydney" real,
"Melbourne" real,
"Brisbane" real,
"Adelaide" real,
"Perth" real,
"TOTAL" real,
"WEEKLY RANK" real
) | How many viewers were there in Sydney for the episode when there were 334000 in Melbourne? | SELECT "Sydney" FROM table_73646 WHERE "Melbourne" = '334000' | wikisql |
CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE airline (
airline_code varchar,
airline_name text,
note text
)
CREATE TABLE restriction (
restriction_code text,
advance_purchase int,
stopovers text,
saturday_stay_required text,
minimum_stay int,
... | i want to fly nonstop from DENVER to DALLAS | 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, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS... | atis |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varc... | 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 could you display in ascending by the bar 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 JOB_ID | nvbench |
CREATE TABLE table_40848 (
"Rank" real,
"Name" text,
"Years" text,
"Matches" real,
"Goals" real
) | What years played did the player with a rank under 10, more than 271 matches, and 152 goals have? | SELECT "Years" FROM table_40848 WHERE "Rank" < '10' AND "Matches" > '271' AND "Goals" = '152' | wikisql |
CREATE TABLE table_name_25 (
played VARCHAR,
drawn VARCHAR,
position VARCHAR
) | How many played have 3 as the drawn, and a position greater than 4? | SELECT COUNT(played) FROM table_name_25 WHERE drawn = 3 AND position > 4 | sql_create_context |
CREATE TABLE table_1024710_2 (
province VARCHAR,
electorate VARCHAR
) | Which province is bay of islands in | SELECT province FROM table_1024710_2 WHERE electorate = "Bay of Islands" | sql_create_context |
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 employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varch... | For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about manager_id over the first_name , list MANAGER_ID in desc order. | 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 allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
sy... | is patient 012-18025 mch last measured on the last hospital visit greater than second to last measured on the last hospital visit. | SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-18025' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi... | eicu |
CREATE TABLE repair (
repair_ID int,
name text,
Launch_Date text,
Notes text
)
CREATE TABLE repair_assignment (
technician_id int,
repair_ID int,
Machine_ID int
)
CREATE TABLE machine (
Machine_ID int,
Making_Year int,
Class text,
Team text,
Machine_series text,
val... | Show different teams of technicians and the number of technicians in each team, I want to display by the total number in asc. | SELECT Team, COUNT(*) FROM technician GROUP BY Team ORDER BY COUNT(*) | nvbench |
CREATE TABLE table_name_29 (
Group VARCHAR,
name VARCHAR
) | What is Group Song, when Name is Alice ? | SELECT Group AS song FROM table_name_29 WHERE name = "alice 林芯糸" | sql_create_context |
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
) | For those records from the products and each product's manufacturer, return a bar chart about the distribution of name and the average of code , and group by attribute name, list by the X in desc. | SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Name DESC | nvbench |
CREATE TABLE table_26309085_1 (
score_in_final VARCHAR,
year VARCHAR
) | What was the final score in 1986? | SELECT score_in_final FROM table_26309085_1 WHERE year = 1986 | sql_create_context |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | count the number of patients whose year of birth is less than 2156 and item id is 51358? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2156" AND lab.itemid = "51358" | mimicsql_data |
CREATE TABLE station (
Station_ID int,
Name text,
Annual_entry_exit real,
Annual_interchanges real,
Total_Passengers real,
Location text,
Main_Services text,
Number_of_Platforms int
)
CREATE TABLE train (
Train_ID int,
Name text,
Time text,
Service text
)
CREATE TABLE t... | Show all locations and the total number of platforms for all train stations in each location in a bar chart, and rank by the Y-axis from low to high please. | SELECT Location, SUM(Number_of_Platforms) FROM station GROUP BY Location ORDER BY SUM(Number_of_Platforms) | nvbench |
CREATE TABLE table_13187 (
"Date" text,
"Ship" text,
"Tonnage" text,
"Nationality" text,
"Fate" text
) | Which Fate has a Nationality of united kingdom, and a Tonnage of 1,809? | SELECT "Fate" FROM table_13187 WHERE "Nationality" = 'united kingdom' AND "Tonnage" = '1,809' | wikisql |
CREATE TABLE table_65049 (
"Year" real,
"Tournament" text,
"Venue" text,
"Result" text,
"Event" text
) | What was the result of the tournament in 2001? | SELECT "Result" FROM table_65049 WHERE "Year" = '2001' | wikisql |
CREATE TABLE Rating (
rID int,
mID int,
stars int,
ratingDate date
)
CREATE TABLE Movie (
mID int,
title text,
year int,
director text
)
CREATE TABLE Reviewer (
rID int,
name text
) | Compare the lowest rating among all movies by each title using a histogram, list from low to high by the title. | SELECT title, MIN(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY title ORDER BY title | nvbench |
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 prescriptions... | count the number of patients whose language is port? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.language = "PORT" | mimicsql_data |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Votes (
Id number,
... | List of all Comments on a Post. | SELECT * FROM Comments WHERE Comments.PostId = '##PostId##' | sede |
CREATE TABLE table_1342013_9 (
result VARCHAR,
candidates VARCHAR
) | what's the result with candidates being charles edward bennett (d) unopposed | SELECT result FROM table_1342013_9 WHERE candidates = "Charles Edward Bennett (D) Unopposed" | sql_create_context |
CREATE TABLE table_28035004_1 (
operator VARCHAR,
bodybuilder VARCHAR
) | Who is the operator when Roe was the bodybuilder? | SELECT operator FROM table_28035004_1 WHERE bodybuilder = "Roe" | sql_create_context |
CREATE TABLE table_name_71 (
total INTEGER,
bronze VARCHAR,
silver VARCHAR,
rank VARCHAR
) | What is the lowest total for the silver less than 1, and a rank more than 5, more than 1 bronze? | SELECT MIN(total) FROM table_name_71 WHERE silver < 1 AND rank > 5 AND bronze > 1 | sql_create_context |
CREATE TABLE table_276 (
"Date" text,
"Tournament" text,
"Location" text,
"Purse( $ )" real,
"Winner" text,
"Score" text,
"1st Prize( $ )" real
) | What is the purse value for the New York location? | SELECT "Purse( $ )" FROM table_276 WHERE "Location" = 'New York' | wikisql |
CREATE TABLE debate (
Debate_ID int,
Date text,
Venue text,
Num_of_Audience int
)
CREATE TABLE people (
People_ID int,
District text,
Name text,
Party text,
Age int
)
CREATE TABLE debate_people (
Debate_ID int,
Affirmative int,
Negative int,
If_Affirmative_Win bool
... | A bar chart showing the number of debates in each venue for those on the negative side. | SELECT Venue, COUNT(Venue) FROM debate_people AS T1 JOIN debate AS T2 ON T1.Debate_ID = T2.Debate_ID JOIN people AS T3 ON T1.Negative = T3.People_ID GROUP BY Venue | nvbench |
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,
... | 在00年6月14日到2015年5月27日之内名叫沈景辉的患者被开出的所有检验报告单的检验报告单号都有什么? | SELECT jybgb.BGDH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN mzjzjlb_jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND mzjzjl... | css |
CREATE TABLE table_73251 (
"Conference" text,
"Regular Season Winner" text,
"Conference Player of the Year" text,
"Conference Tournament" text,
"Tournament Venue (City)" text,
"Tournament Winner" text
) | How many players of the year are there in the Mountain West Conference? | SELECT COUNT("Conference Player of the Year") FROM table_73251 WHERE "Conference" = 'Mountain West Conference' | wikisql |
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
Creati... | Count of received votes per month. | SELECT CAST(CAST(TIME_TO_STR(v.CreationDate, '%Y') AS TEXT(4)) + '-' + CAST(TIME_TO_STR(v.CreationDate, '%M') AS TEXT(2)) + '-01' AS DATETIME) AS "date", COUNT(CASE v.VoteTypeId WHEN 1 THEN 1 END) AS "accept", COUNT(CASE v.VoteTypeId WHEN 2 THEN 1 END) AS "up", COUNT(CASE v.VoteTypeId WHEN 3 THEN 1 END) AS "down" FROM ... | sede |
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number... | Get Tag Info for tags used over 50 times. | SELECT t.Id, t.TagName, ts.SourceTagName, t.Count, t.WikiPostId, P.Body FROM Tags AS t JOIN TagSynonyms AS ts ON t.TagName = ts.TargetTagName JOIN Posts AS p ON p.Id = t.WikiPostId WHERE t.Count > 50 ORDER BY t.TagName | sede |
CREATE TABLE table_name_1 (
district VARCHAR,
incumbent VARCHAR,
first_elected VARCHAR,
party VARCHAR
) | What District was Incumbent Steve Israel First elected after 1998 in the Democratic party? | SELECT district FROM table_name_1 WHERE first_elected > 1998 AND party = "democratic" AND incumbent = "steve israel" | sql_create_context |
CREATE TABLE table_27652 (
"Rank by average" real,
"Place" real,
"Couple" text,
"Total points" real,
"Number of dances" real,
"Average" text
) | What is the rank by average for the team who averaged 22.8? | SELECT MIN("Rank by average") FROM table_27652 WHERE "Average" = '22.8' | wikisql |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE charte... | when the last time patient 63368 was prescribed ondansetron in 06/last year? | SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 63368) AND prescriptions.drug = 'ondansetron' AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTI... | mimic_iii |
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... | List the number of counties of all appellations in a bar chart, show by the y-axis from low to high. | SELECT County, COUNT(County) FROM appellations GROUP BY County ORDER BY COUNT(County) | nvbench |
CREATE TABLE table_79719 (
"Rank" real,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | What's the total number of bronze medals for Sweden (SWE) having less than 1 gold and silver? | SELECT COUNT("Bronze") FROM table_79719 WHERE "Gold" < '1' AND "Nation" = 'sweden (swe)' AND "Silver" < '1' | wikisql |
CREATE TABLE table_64439 (
"Match" real,
"Date" text,
"Competition or tour" text,
"Ground" text,
"Opponent" text,
"Score1" text
) | On what date is there a match lower than 14 with a ground of H and the opponent Aston Villa under 18s? | SELECT "Date" FROM table_64439 WHERE "Match" < '14' AND "Ground" = 'h' AND "Opponent" = 'aston villa under 18s' | wikisql |
CREATE TABLE qtb (
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... | 看看80300861713的这次医疗就诊的住院时长 | SELECT qtb.IN_HOSP_DAYS FROM qtb WHERE qtb.MED_CLINIC_ID = '80300861713' UNION SELECT gyb.IN_HOSP_DAYS FROM gyb WHERE gyb.MED_CLINIC_ID = '80300861713' UNION SELECT zyb.IN_HOSP_DAYS FROM zyb WHERE zyb.MED_CLINIC_ID = '80300861713' UNION SELECT mzb.IN_HOSP_DAYS FROM mzb WHERE mzb.MED_CLINIC_ID = '80300861713' | css |
CREATE TABLE instructor (
ID varchar(5),
name varchar(20),
dept_name varchar(20),
salary numeric(8,2)
)
CREATE TABLE teaches (
ID varchar(5),
course_id varchar(8),
sec_id varchar(8),
semester varchar(6),
year numeric(4,0)
)
CREATE TABLE time_slot (
time_slot_id varchar(4),
... | How many courses are provided in each year? binning year and Visualize a line chart. | SELECT year, COUNT(*) FROM section | nvbench |
CREATE TABLE table_66768 (
"Team" text,
"City" text,
"State" text,
"Home venue" text,
"Capacity" real
) | Where is the home venue of Bengaluru FC? | SELECT "Home venue" FROM table_66768 WHERE "Team" = 'bengaluru fc' | wikisql |
CREATE TABLE table_204_74 (
id number,
"#" number,
"title" text,
"producers" text,
"guest performers" text,
"length" text
) | what is the longest track on the album ? | SELECT "title" FROM table_204_74 ORDER BY "length" DESC LIMIT 1 | squall |
CREATE TABLE table_name_67 (
paris___fra__ VARCHAR,
roger_françois VARCHAR
) | What was the press like in Paris for Roger Francois, and Carlo Galimberti? | SELECT paris___fra__ FROM table_name_67 WHERE "press" = "press" AND roger_françois = "carlo galimberti" | sql_create_context |
CREATE TABLE table_46496 (
"Railway" text,
"Builder" text,
"Built" real,
"Wheels" text,
"Location" text,
"ObjectNumber" text
) | Which Wheels has Built smaller than 1958, a Location of york, and a Railway of nsr? | SELECT "Wheels" FROM table_46496 WHERE "Built" < '1958' AND "Location" = 'york' AND "Railway" = 'nsr' | wikisql |
CREATE TABLE table_33805 (
"Finish" text,
"Race" text,
"Distance" text,
"Jockey" text,
"Time" text,
"Grade" text,
"Runner up/Winner" text,
"Track" text
) | What grade did jockey Robby Albarado get when racing with Ravens Pass? | SELECT "Grade" FROM table_33805 WHERE "Jockey" = 'robby albarado' AND "Runner up/Winner" = 'ravens pass' | wikisql |
CREATE TABLE table_name_74 (
born_died VARCHAR,
left_office VARCHAR,
throne_name VARCHAR
) | What is teh born-died dates of the king with a throne name 315 and left office in 1021? | SELECT born_died FROM table_name_74 WHERE left_office = "1021" AND throne_name = "315" | sql_create_context |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
... | what was the name of the drug that was prescribed to patient 75170 first via dialys route? | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 75170) AND prescriptions.route = 'dialys' ORDER BY prescriptions.startdate LIMIT 1 | mimic_iii |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE chartevents ... | for the last time in their current hospital encounter, when was patient 22648 given a lab test? | SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 22648 AND admissions.dischtime IS NULL) ORDER BY labevents.charttime DESC LIMIT 1 | mimic_iii |
CREATE TABLE table_70039 (
"Name" text,
"Years" text,
"Gender" text,
"Area" text,
"Authority" text,
"Decile" real,
"Roll" real
) | Makarora primary school has a roll less than 141 and what gender? | SELECT "Gender" FROM table_70039 WHERE "Roll" < '141' AND "Name" = 'makarora primary school' | wikisql |
CREATE TABLE table_65328 (
"Year" real,
"Finish position" text,
"1st day" text,
"2nd day" text,
"3rd day" text,
"4th Day" text
) | What is the 3rd day result for years under 2012 and a finish position of 33rd? | SELECT "3rd day" FROM table_65328 WHERE "Year" < '2012' AND "Finish position" = '33rd' | wikisql |
CREATE TABLE table_name_96 (
goals_against INTEGER,
club VARCHAR,
ga_average VARCHAR
) | What is the highest goals against the goalkeeper of Dallas Burn, who had a GA average larger than 1.46, had? | SELECT MAX(goals_against) FROM table_name_96 WHERE club = "dallas burn" AND ga_average > 1.46 | sql_create_context |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | what is the number of patients whose days of hospital stay is greater than 7 and lab test name is carboxyhemoglobin? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "7" AND lab.label = "Carboxyhemoglobin" | mimicsql_data |
CREATE TABLE table_name_52 (
year VARCHAR,
home_town VARCHAR
) | In what year of school is the player from Fayetteville, NC? | SELECT year FROM table_name_52 WHERE home_town = "fayetteville, nc" | sql_create_context |
CREATE TABLE table_66478 (
"City of license" text,
"Identifier" text,
"Frequency" text,
"Power" text,
"Class" text,
"RECNet" text
) | What identifier has 90.3 as the frequency? | SELECT "Identifier" FROM table_66478 WHERE "Frequency" = '90.3' | wikisql |
CREATE TABLE table_name_38 (
role VARCHAR,
status VARCHAR
) | What is Role, when Status is '2001 - 2003, 2005 - 2009'? | SELECT role FROM table_name_38 WHERE status = "2001 - 2003, 2005 - 2009" | sql_create_context |
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 departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NA... | For those employees who was hired before 2002-06-21, give me the comparison about the average of salary over the hire_date bin hire_date by time, and rank by the Y-axis in descending please. | SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY AVG(SALARY) DESC | nvbench |
CREATE TABLE table_name_46 (
to_par VARCHAR,
place VARCHAR,
score VARCHAR
) | What is the to par of the player with a t4 place and a score of 75-69-74-72=290? | SELECT to_par FROM table_name_46 WHERE place = "t4" AND score = 75 - 69 - 74 - 72 = 290 | sql_create_context |
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | Find Reputable Users By Country. | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE LOWER('%##CountryName##%') AND Reputation >= '##MinReputation##' ORDER BY Reputation DESC | sede |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
C... | count the number of patients whose marital status is married and primary disease is gastrointestinal bleed? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.diagnosis = "GASTROINTESTINAL BLEED" | mimicsql_data |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id t... | how many patients on inhalation route of drug administration have other psoriasis diagnoses? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Other psoriasis" AND prescriptions.route = "INHALATION" | mimicsql_data |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
a... | how many of the current patients are 60 or above? | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.hospitaldischargetime IS NULL AND patient.age >= 60 | eicu |
CREATE TABLE table_name_5 (
silver INTEGER,
bronze VARCHAR,
rank VARCHAR
) | What is the number of silver when bronze is 0, and rank is less than 2? | SELECT SUM(silver) FROM table_name_5 WHERE bronze = 0 AND rank < 2 | sql_create_context |
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
CREATE TABLE Has_Allergy (
StuID INTEGER,
Allergy VARCHAR(20)
)
CREATE TABLE Allergy_Type (
Allergy VARCHAR(20),
... | Show all cities and corresponding number of students. Plot them as bar chart. | SELECT city_code, COUNT(*) FROM Student GROUP BY city_code | nvbench |
CREATE TABLE table_50271 (
"City" text,
"Country" text,
"IATA" text,
"ICAO" text,
"Airport" text
) | Which city has an ICAO of Oejn? | SELECT "City" FROM table_50271 WHERE "ICAO" = 'oejn' | wikisql |
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
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,
JO... | For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, draw a bar chart about the distribution of hire_date and the amount of hire_date bin hire_date by time, could you show in ascending by the y axis? | SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY COUNT(HIRE_DATE) | nvbench |
CREATE TABLE table_name_65 (
record VARCHAR,
date VARCHAR
) | what team scored on november 7 | SELECT record FROM table_name_65 WHERE date = "november 7" | sql_create_context |
CREATE TABLE table_47371 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | what is the date when ramon sessions (8) had the high assists, richard jefferson (29) had the high points and the score was w 107 78 (ot)? | SELECT "Date" FROM table_47371 WHERE "High assists" = 'ramon sessions (8)' AND "High points" = 'richard jefferson (29)' AND "Score" = 'w 107–78 (ot)' | wikisql |
CREATE TABLE table_204_681 (
id number,
"2011 rank" number,
"2010 rank" number,
"2009 rank" number,
"2008 rank" number,
"2007 rank" number,
"company (country)" text,
"2011 arms sales (us$ m.)" number,
"2010 arms sales (us$ m.)" number,
"2009 arms sales (us$ m.)" number,
"2008... | what is the difference of the amount sold between boeing and general dynamics in 2007 ? | SELECT ABS((SELECT "2007 arms sales (us$ m.)" FROM table_204_681 WHERE "company (country)" = 'boeing') - (SELECT "2007 arms sales (us$ m.)" FROM table_204_681 WHERE "company (country)" = 'general dynamics')) | squall |
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
wardid number,
intime time,
outtime time
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
... | did patient 15945 in 12/this year get an specific gravity lab test? | SELECT COUNT(*) > 0 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'specific gravity') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15945) AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRE... | mimic_iii |
CREATE TABLE table_1553485_1 (
channel_tv___dt__ VARCHAR,
city_of_license__market VARCHAR
) | Which channel tv (dt) plays in San Francisco - Oakland - San Jose? | SELECT channel_tv___dt__ FROM table_1553485_1 WHERE city_of_license__market = "San Francisco - Oakland - San Jose" | sql_create_context |
CREATE TABLE table_66434 (
"Rank" real,
"Lane" real,
"Name" text,
"Nationality" text,
"Time" text
) | What is the time of Yuliya Yefimova? | SELECT "Time" FROM table_66434 WHERE "Name" = 'yuliya yefimova' | wikisql |
CREATE TABLE table_7891 (
"Player" text,
"Team" text,
"Matches" real,
"Runs" real,
"Balls" real,
"Strike Rate" real,
"Average" real,
"100s" real
) | Can you tell me the sum of 100s that has the Team of deccan chargers, and the Match of 8, and the Average larger than 35.57? | SELECT SUM("100s") FROM table_7891 WHERE "Team" = 'deccan chargers' AND "Matches" = '8' AND "Average" > '35.57' | wikisql |
CREATE TABLE table_18675 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" real,
"Result" text,
"Candidates" text
) | who is the the candidates with dbeingtrict being kansas 5 | SELECT "Candidates" FROM table_18675 WHERE "District" = 'Kansas 5' | wikisql |
CREATE TABLE Person (
name varchar(20),
age INTEGER,
city TEXT,
gender TEXT,
job TEXT
)
CREATE TABLE PersonFriend (
name varchar(20),
friend varchar(20),
year INTEGER
) | Display a bar chart for how old is the average person for each job?, display y axis in asc order. | SELECT job, AVG(age) FROM Person GROUP BY job ORDER BY AVG(age) | nvbench |
CREATE TABLE table_8159 (
"Team 1" text,
"Agg." text,
"Team 2" text,
"1st leg" text,
"2nd leg" text
) | Goldfields Obuasi Team 1 has what Agg. totals ? | SELECT "Agg." FROM table_8159 WHERE "Team 1" = 'goldfields obuasi' | wikisql |
CREATE TABLE Payments (
Payment_ID INTEGER,
Settlement_ID INTEGER,
Payment_Method_Code VARCHAR(255),
Date_Payment_Made DATE,
Amount_Payment INTEGER
)
CREATE TABLE Claims (
Claim_ID INTEGER,
Policy_ID INTEGER,
Date_Claim_Made DATE,
Date_Claim_Settled DATE,
Amount_Claimed INTEGER,... | Create a bar chart showing the number of date claim made across date claim made, and could you order in asc by the Y-axis? | SELECT Date_Claim_Made, COUNT(Date_Claim_Made) FROM Settlements ORDER BY COUNT(Date_Claim_Made) | nvbench |
CREATE TABLE table_23497 (
"Ostrich" text,
"Hamerkop" text,
"Hadeda Ibis" text,
"African Spoonbill" text,
"Whitefaced Duck" text,
"Knobbilled Duck" text
) | What is the Hadeda Ibis when the Whitefaced Duck is Blacksmith Plover? | SELECT "Hadeda Ibis" FROM table_23497 WHERE "Whitefaced Duck" = 'Blacksmith Plover' | wikisql |
CREATE TABLE culture_company (
company_name text,
type text,
incorporated_in text,
group_equity_shareholding number,
book_club_id text,
movie_id text
)
CREATE TABLE book_club (
book_club_id number,
year number,
author_or_editor text,
book_title text,
publisher text,
cate... | What are all the company names that have a book published by Alyson? | SELECT T1.company_name FROM culture_company AS T1 JOIN book_club AS T2 ON T1.book_club_id = T2.book_club_id WHERE T2.publisher = 'Alyson' | spider |
CREATE TABLE classroom (
building varchar(15),
room_number varchar(7),
capacity numeric(4,0)
)
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 numeric(2)
)
CREATE TABLE prereq (
course_id va... | What is the greatest capacity for rooms in each building? Draw a bar chart, rank by the maximal capacity in descending please. | SELECT building, MAX(capacity) FROM classroom GROUP BY building ORDER BY MAX(capacity) DESC | nvbench |
CREATE TABLE table_name_84 (
rounds VARCHAR,
engine VARCHAR,
driver VARCHAR
) | How many rounds did satrio hermanto go with an opc-challenge engine? | SELECT rounds FROM table_name_84 WHERE engine = "opc-challenge" AND driver = "satrio hermanto" | sql_create_context |
CREATE TABLE table_name_84 (
copa_libertadores_1996 VARCHAR,
copa_conmebol_1996 VARCHAR
) | What is the copa libertadores 1996 result of the team with a copa conmebol 1996 result of quarterfinals? | SELECT copa_libertadores_1996 FROM table_name_84 WHERE copa_conmebol_1996 = "quarterfinals" | sql_create_context |
CREATE TABLE table_955 (
"Book title" text,
"Issues" real,
"Writer" text,
"Artist(s)" text,
"Publication dates" text
) | elaine lee worked on how many issues | SELECT COUNT("Issues") FROM table_955 WHERE "Writer" = 'Elaine Lee' | wikisql |
CREATE TABLE table_name_69 (
score VARCHAR,
tie_no VARCHAR
) | The game with 13 as the tie no had what as the score? | SELECT score FROM table_name_69 WHERE tie_no = "13" | sql_create_context |
CREATE TABLE table_75556 (
"Call sign" text,
"Frequency MHz" real,
"City of license" text,
"ERP W" real,
"Height m ( ft )" text,
"FCC info" text
) | Which City of license has a Frequency MHz smaller than 100.9, and a ERP W larger than 100? | SELECT "City of license" FROM table_75556 WHERE "Frequency MHz" < '100.9' AND "ERP W" > '100' | wikisql |
CREATE TABLE gwyjzb (
CLINIC_ID text,
CLINIC_TYPE text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD text,
INPT_AREA_BED text,
INSURED_IDENTITY number,
INSURED_STS text,
... | 分别在哪几次医疗记录中给病号41726844售卖的药品均价超过1130.37元?列出一下医疗就诊编号都是多少? | SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_ID = '41726844' AND NOT gwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT <= 1130.37) UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_ID = '41726844' AND NOT fgwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CL... | css |
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,
... | 沈元纬这个病人做的脸部检验的各项指标结果如何 | SELECT * FROM person_info JOIN hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jy... | css |
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE d_labitems (
row_id number,
itemid num... | what were the hospital admission times of patient 22973 in 2102? | SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 22973 AND STRFTIME('%y', admissions.admittime) = '2102' | mimic_iii |
CREATE TABLE table_203_98 (
id number,
"title" text,
"year" number,
"director" text,
"budget" text,
"gross (worldwide)" text,
"notes" text
) | after young guns , what was the next movie with the exact same budget ? | SELECT "title" FROM table_203_98 WHERE id > (SELECT id FROM table_203_98 WHERE "title" = 'young guns') AND "budget" = (SELECT "budget" FROM table_203_98 WHERE "title" = 'young guns') LIMIT 1 | squall |
CREATE TABLE table_26173058_2 (
qadisiya VARCHAR,
× VARCHAR
) | what is the capital where it is ramtha | SELECT qadisiya FROM table_26173058_2 WHERE × = "ramtha" | sql_create_context |
CREATE TABLE table_204_546 (
id number,
"year" number,
"film" text,
"song" text,
"language" text
) | how many films used the kannada language ? | SELECT COUNT("film") FROM table_204_546 WHERE "language" = 'kannada' | squall |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.