context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE table_11534 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | Who was the away team when the home team scored 18.20 (128)? | SELECT "Away team" FROM table_11534 WHERE "Home team score" = '18.20 (128)' | 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 demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | what is the total number of patients with diseases of tricuspid valve who remained admitted in the hosiptal for more than 1 day? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "1" AND diagnoses.long_title = "Diseases of tricuspid valve" | mimicsql_data |
CREATE TABLE table_45117 (
"Name" text,
"Latitude" text,
"Longitude" text,
"Diameter (km)" real,
"Year named" text
) | What is the latitude of the 0 diameter? | SELECT "Latitude" FROM table_45117 WHERE "Diameter (km)" = '0' | wikisql |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
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 job_history (
EMPLOYEE... | For all employees who have the letters D or S in their first name, a bar chart shows the distribution of job_id and the average of department_id , and group by attribute job_id, and I want to order x-axis in ascending order please. | SELECT JOB_ID, AVG(DEPARTMENT_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_name_23 (
date VARCHAR,
loss VARCHAR
) | On which day did the Chicago Cubs have a loss of trout (4-2)? | SELECT date FROM table_name_23 WHERE loss = "trout (4-2)" | sql_create_context |
CREATE TABLE Rooms (
RoomId TEXT,
roomName TEXT,
beds INTEGER,
bedType TEXT,
maxOccupancy INTEGER,
basePrice INTEGER,
decor TEXT
)
CREATE TABLE Reservations (
Code INTEGER,
Room TEXT,
CheckIn TEXT,
CheckOut TEXT,
Rate REAL,
LastName TEXT,
FirstName TEXT,
Adul... | Return a pie chart on what is the average base price of rooms, for each bed type? | SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType | nvbench |
CREATE TABLE table_16938 (
"Date" text,
"Tournament" text,
"Location" text,
"Purse( $ )" real,
"Winner" text,
"Score" text,
"1st Prize( $ )" real
) | what's the score with date oct 1 | SELECT "Score" FROM table_16938 WHERE "Date" = 'Oct 1' | wikisql |
CREATE TABLE table_56296 (
"Player" text,
"Nationality" text,
"Position" text,
"Years for Jazz" text,
"School/Club Team" text
) | What years does milt palacio play? | SELECT "Years for Jazz" FROM table_56296 WHERE "Player" = 'milt palacio' | wikisql |
CREATE TABLE airport (
airport_code varchar,
airport_name text,
airport_location text,
state_code varchar,
country_name varchar,
time_zone_code varchar,
minimum_connect_time int
)
CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE airline (
airline_co... | flights from KANSAS CITY to CLEVELAND on wednesday arriving before 1700 | 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 ((date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.arrival_time <... | atis |
CREATE TABLE t_kc21_t_kc24 (
MED_CLINIC_ID text,
MED_SAFE_PAY_ID number
)
CREATE TABLE t_kc24 (
ACCOUNT_DASH_DATE time,
ACCOUNT_DASH_FLG number,
CASH_PAY number,
CIVIL_SUBSIDY number,
CKC102 number,
CLINIC_ID text,
CLINIC_SLT_DATE time,
COMP_ID text,
COM_ACC_PAY number,
... | 看看参保人76143414从2010.8.24到2019.3.19这期间,在门诊发生的西药费有多少总额 | SELECT SUM(t_kc22.AMOUNT) FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_ID = '76143414' AND t_kc21.CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2010-08-24' AND '2019-03-19' AND t_kc22.MED_INV_ITEM_TYPE = '西药费' | css |
CREATE TABLE Organizations (
organization_id INTEGER,
parent_organization_id INTEGER,
organization_details VARCHAR(255)
)
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER,
Date_and_Time DATETIME,
Location_Code CHAR(15)
)
CREATE TABLE Properties (
property_id INTEGER,
property_... | Bar chart x axis date moved in y axis how many date moved in, order from high to low by the Y-axis. | SELECT date_moved_in, COUNT(date_moved_in) FROM Customer_Events ORDER BY COUNT(date_moved_in) DESC | nvbench |
CREATE TABLE table_73695 (
"Player" text,
"Starts" real,
"Cuts made" real,
"Best finish" text,
"Money list rank" real,
"Earnings ($)" real
) | What is the minimum number of starts for the players having a best finish of T18? | SELECT MIN("Starts") FROM table_73695 WHERE "Best finish" = 'T18' | wikisql |
CREATE TABLE table_name_30 (
events INTEGER,
tournament VARCHAR,
top_10 VARCHAR
) | What is the lowest number of events the Open Championship has with a less than 0 top-10? | SELECT MIN(events) FROM table_name_30 WHERE tournament = "the open championship" AND top_10 < 0 | sql_create_context |
CREATE TABLE table_71673 (
"Team 1" text,
"Agg." text,
"Team 2" text,
"1st leg" text,
"2nd leg" text
) | Which Team 1 faced Dynamos FC? | SELECT "Team 1" FROM table_71673 WHERE "Team 2" = 'dynamos fc' | wikisql |
CREATE TABLE table_12792876_3 (
drawn VARCHAR,
tries_for VARCHAR
) | what was the drawn when the tries for was 46? | SELECT drawn FROM table_12792876_3 WHERE tries_for = "46" | sql_create_context |
CREATE TABLE table_75911 (
"Rank" real,
"Name" text,
"Built" real,
"Height" text,
"Floors" real
) | What is Height, when Rank is less than 20, when Floors is greater than 9, when Built is 2005, and when Name is The Edge (C)? | SELECT "Height" FROM table_75911 WHERE "Rank" < '20' AND "Floors" > '9' AND "Built" = '2005' AND "Name" = 'the edge (c)' | wikisql |
CREATE TABLE table_17672470_19 (
stage VARCHAR,
winner VARCHAR
) | How many stages were won by Robbie McEwen? | SELECT COUNT(stage) FROM table_17672470_19 WHERE winner = "Robbie McEwen" | sql_create_context |
CREATE TABLE table_20572 (
"Year ended" text,
"Revenue (S$m)" text,
"Expenditure (S$m)" text,
"Operating profit (S$m)" text,
"Profit before taxation (S$m)" text,
"Profit attributable to equity holders (S$m)" text,
"EPS after tax \u2013 diluted (cents)" text
) | How many years was the operating profit (s$m) 717.1? | SELECT COUNT("Profit before taxation (S$m)") FROM table_20572 WHERE "Operating profit (S$m)" = '717.1' | 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... | 根据科室编码和出院诊断疾病编码的不同筛出在医院7430610就诊的所有医疗就诊记录中那些患者的年龄平均是多少岁? | SELECT qtb.MED_ORG_DEPT_CD, qtb.OUT_DIAG_DIS_CD, AVG(qtb.PERSON_AGE) FROM qtb WHERE qtb.MED_SER_ORG_NO = '7430610' GROUP BY qtb.MED_ORG_DEPT_CD, qtb.OUT_DIAG_DIS_CD UNION SELECT gyb.MED_ORG_DEPT_CD, gyb.OUT_DIAG_DIS_CD, AVG(gyb.PERSON_AGE) FROM gyb WHERE gyb.MED_SER_ORG_NO = '7430610' GROUP BY gyb.MED_ORG_DEPT_CD, gyb.... | css |
CREATE TABLE mission (
Mission_ID int,
Ship_ID int,
Code text,
Launched_Year int,
Location text,
Speed_knots int,
Fate text
)
CREATE TABLE ship (
Ship_ID int,
Name text,
Type text,
Nationality text,
Tonnage int
) | Show me a stacked bar graph, the x-axis is the nationality of ship, and the y-axis is their total number of different nationality and split by ship type, order from low to high by the total number. | SELECT Nationality, COUNT(Nationality) FROM ship GROUP BY Type, Nationality ORDER BY COUNT(Nationality) | nvbench |
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | Matlab and Python questions per Month. | SELECT *, COUNT(*) AS count FROM (SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0) AS "month", t.TagName AS "tag" FROM Posts AS p JOIN PostTags AS pt ON pt.PostId = p.Id JOIN Tags AS t ON t.Id = pt.TagId WHERE t.TagName IN ('python', 'matlab', 'simulink')) AS X GROUP BY 'tag', month ORDER BY 'tag', month | sede |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
h... | how much has patient 003-17096 changed in ast (sgot) levels last measured on the first hospital visit compared to the first value measured on the first 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 = '003-17096' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi... | eicu |
CREATE TABLE table_58679 (
"Name" text,
"Pos." text,
"Height" text,
"Weight" text,
"Date of Birth" text,
"Club" text
) | What is the Weight of the person born 1981-02-24 from the Uralochka Zlatoust club ? | SELECT "Weight" FROM table_58679 WHERE "Club" = 'uralochka zlatoust' AND "Date of Birth" = '1981-02-24' | wikisql |
CREATE TABLE table_1070 (
"Week" real,
"Date" text,
"Opponent" text,
"Location" text,
"Time ( ET )" text,
"TV" text,
"Result" text,
"Record" text
) | List the total number of records from Lambeau Field. | SELECT COUNT("Record") FROM table_1070 WHERE "Location" = 'Lambeau Field' | wikisql |
CREATE TABLE table_1221 (
"Year" real,
"Class" text,
"Team name" text,
"Bike" text,
"Riders" text,
"Races" text,
"Wins" real,
"Podiums" real,
"Poles" real,
"F.laps" real,
"Points" text,
"Pos." text
) | Name the class for makoto tamada and races is 17 | SELECT "Class" FROM table_1221 WHERE "Riders" = 'Makoto Tamada' AND "Races" = '17' | wikisql |
CREATE TABLE table_204_987 (
id number,
"city/municipality" text,
"no. of\nbarangays" number,
"area\n(km2)" number,
"population\n(2010 census)" number,
"pop. density\n(per km2)" number
) | which city has only 5 barangays ? | SELECT "city/municipality" FROM table_204_987 WHERE "no. of\nbarangays" = 5 | squall |
CREATE TABLE t_kc22 (
AMOUNT number,
CHA_ITEM_LEV number,
DATA_ID text,
DIRE_TYPE number,
DOSE_FORM text,
DOSE_UNIT text,
EACH_DOSAGE text,
EXP_OCC_DATE time,
FLX_MED_ORG_ID text,
FXBZ number,
HOSP_DOC_CD text,
HOSP_DOC_NM text,
MED_CLINIC_ID text,
MED_DIRE_CD tex... | 从2004年3月27到日2006年6月22日,患者柏德华一共买了多少次西药? | SELECT COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '柏德华' AND t_kc22.STA_DATE BETWEEN '2004-03-27' AND '2006-06-22' AND t_kc22.MED_INV_ITEM_TYPE = '西药费' | css |
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... | count the number of patients whose admission location is transfer from hosp/extram and drug name is gentamicin? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND prescriptions.drug = "Gentamicin" | mimicsql_data |
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
) | Return a bar chart on what are the names and average prices of products for manufacturers whose products cost on average 150 or more?, and sort total number in descending order. | SELECT T2.Name, AVG(T1.Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY AVG(T1.Price) DESC | nvbench |
CREATE TABLE table_16453 (
"1932 (before recount)" text,
"party" text,
"Manhattan" text,
"The Bronx" text,
"Brooklyn" text,
"Queens" text,
"Richmond [Staten Is.]" text,
"Total" real,
"%" text
) | what's the % with total value of 249887 and queens value of 6.8% | SELECT "%" FROM table_16453 WHERE "Total" = '249887' AND "Queens" = '6.8%' | wikisql |
CREATE TABLE table_59614 (
"Combined" text,
"50 yard Freestyle" text,
"100 yard Freestyle" text,
"200 yard Freestyle" text,
"500 yard Freestyle" text,
"100 yard Backstroke" text,
"100 yard Butterfly" text
) | What Combined has a 100 yard Freestyle of cody miller (palo verde)? | SELECT "Combined" FROM table_59614 WHERE "100 yard Freestyle" = 'cody miller (palo verde)' | wikisql |
CREATE TABLE table_name_61 (
Birth VARCHAR,
start_of_reign VARCHAR
) | What is the date of birth of the person who started their reign in 1986? | SELECT Birth AS name FROM table_name_61 WHERE start_of_reign = 1986 | sql_create_context |
CREATE TABLE player (
Player_ID int,
name text,
Position text,
Club_ID int,
Apps real,
Tries real,
Goals text,
Points real
)
CREATE TABLE competition_result (
Competition_ID int,
Club_ID_1 int,
Club_ID_2 int,
Score text
)
CREATE TABLE club (
Club_ID int,
name te... | Plot the total number by grouped by competition type as a bar graph, and order X in ascending order. | SELECT Competition_type, COUNT(*) FROM competition GROUP BY Competition_type ORDER BY Competition_type | nvbench |
CREATE TABLE Faculty (
FacID INTEGER,
Lname VARCHAR(15),
Fname VARCHAR(15),
Rank VARCHAR(15),
Sex VARCHAR(1),
Phone INTEGER,
Room VARCHAR(5),
Building VARCHAR(13)
)
CREATE TABLE Faculty_Participates_in (
FacID INTEGER,
actid INTEGER
)
CREATE TABLE Activity (
actid INTEGER,
... | How many faculty members do we have for each rank? Show bar chart, rank X-axis from high to low order please. | SELECT Rank, COUNT(Rank) FROM Faculty GROUP BY Rank ORDER BY Rank DESC | 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... | give me the number of urgent type hospital admission patients who were ordered aspartate aminotransferase (ast) lab test. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab.label = "Asparate Aminotransferase (AST)" | mimicsql_data |
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate time,
Score number,
ViewCount number,
Body text,
OwnerUserId number,
OwnerDisplayName te... | Most Common Names with Jon. | SELECT DisplayName, COUNT(*) AS total FROM Users WHERE DisplayName LIKE 'Jon %' GROUP BY DisplayName ORDER BY DisplayName DESC LIMIT 10 | sede |
CREATE TABLE fare_basis (
fare_basis_code text,
booking_class text,
class_type text,
premium text,
economy text,
discounted text,
night text,
season text,
basis_days text
)
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
... | what flights go from NEWARK to BOSTON after 1024 in the morning | 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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.departure_time > 1024 AND flight.to_airport = AIRPORT_SERVICE_1.airpor... | atis |
CREATE TABLE mzjybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH number,
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,
... | 患者79841221被门诊诊断为疾病Q06.940,他的检测指标673380的结果定量及单位是怎样的 | SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN mzjzjlb JOIN zyjybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZJZJLB AND zyjybgb.YLJGDM = jyjgzbb.YLJGDM AND zyjybgb... | css |
CREATE TABLE table_5202 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text
) | what day did the team go to toronto | SELECT "Date" FROM table_5202 WHERE "Visitor" = 'toronto' | wikisql |
CREATE TABLE table_name_11 (
quantity_preserved VARCHAR,
quantity_made VARCHAR
) | What is the quantity preserved to the locomotive with a quantity made of 6? | SELECT quantity_preserved FROM table_name_11 WHERE quantity_made = "6" | sql_create_context |
CREATE TABLE table_184803_4 (
spokespersons VARCHAR,
country VARCHAR
) | wich spokesperson talked on luxembourg | SELECT spokespersons FROM table_184803_4 WHERE country = "Luxembourg" | sql_create_context |
CREATE TABLE table_name_39 (
opponent VARCHAR,
date VARCHAR
) | Tell me the opponent for november 24, 1996 | SELECT opponent FROM table_name_39 WHERE date = "november 24, 1996" | sql_create_context |
CREATE TABLE table_5736 (
"Outcome" text,
"Date" text,
"Tournament" text,
"Surface" text,
"Opponent" text,
"Score" text
) | On what date was the score 6 4, 7 5? | SELECT "Date" FROM table_5736 WHERE "Score" = '6–4, 7–5' | wikisql |
CREATE TABLE table_41230 (
"Location" text,
"Aircraft" text,
"Tail number" text,
"Aircraft damage" text,
"Fatalities" text
) | In what location was the tail number ZS-SPF? | SELECT "Location" FROM table_41230 WHERE "Tail number" = 'zs-spf' | wikisql |
CREATE TABLE table_name_74 (
winner VARCHAR,
venue VARCHAR
) | Who was the Winner at Campbelltown Sports Stadium? | SELECT winner FROM table_name_74 WHERE venue = "campbelltown sports stadium" | sql_create_context |
CREATE TABLE table_name_12 (
points VARCHAR,
rebounds VARCHAR
) | Who was the leader in Points when Al Jefferson (7) was the leader in Rebounds? | SELECT points FROM table_name_12 WHERE rebounds = "al jefferson (7)" | sql_create_context |
CREATE TABLE table_72180 (
"Route Name" text,
"Direction" text,
"Termini" text,
"Junctions" text,
"Length" text,
"Population Area" text,
"Remarks" text
) | Which junctions have 'replaced by bsi-35' listed in their remarks section? | SELECT "Junctions" FROM table_72180 WHERE "Remarks" = 'Replaced by BSI-35' | wikisql |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE d_icd_diagnoses (
... | how many patients were given a parathyroid hormone lab test in this year? | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'parathyroid hormone') AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME... | mimic_iii |
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 procedure icd9 code and procedure short title of subject name morgan mcgee? | SELECT procedures.icd9_code, procedures.short_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Morgan Mcgee" | mimicsql_data |
CREATE TABLE table_4863 (
"Round" real,
"Overall" real,
"Player" text,
"Position" text,
"School/Club Team" text
) | What position is the round higher than 15 and has an overall of 411. | SELECT "Position" FROM table_4863 WHERE "Round" > '15' AND "Overall" = '411' | wikisql |
CREATE TABLE table_16390 (
"Round" real,
"Choice" real,
"Player name" text,
"Position" text,
"Height" text,
"Weight" real,
"College" text
) | Which player went to college in Oklahoma? | SELECT "Player name" FROM table_16390 WHERE "College" = 'Oklahoma' | wikisql |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime... | what is patient 016-1459's length of stay of the last hospital stay? | SELECT STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', patient.hospitaladmittime) FROM patient WHERE patient.uniquepid = '016-1459' AND NOT patient.hospitaladmittime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1 | eicu |
CREATE TABLE table_name_75 (
home_team VARCHAR,
venue VARCHAR
) | Which team plays at Punt Road Oval? | SELECT home_team FROM table_name_75 WHERE venue = "punt road oval" | sql_create_context |
CREATE TABLE table_36727 (
"Game" real,
"January" real,
"Opponent" text,
"Score" text,
"Record" text,
"Points" real
) | Which Score has a January larger than 21, and Points of 63? | SELECT "Score" FROM table_36727 WHERE "January" > '21' AND "Points" = '63' | wikisql |
CREATE TABLE department (
dno number,
division text,
dname text,
room text,
building text,
dphone number
)
CREATE TABLE faculty (
facid number,
lname text,
fname text,
rank text,
sex text,
phone number,
room text,
building text
)
CREATE TABLE gradeconversion (
... | How many departments are in the division AS? | SELECT COUNT(*) FROM department WHERE division = "AS" | spider |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE diagnosis (
diagnosisid... | how many hours have passed since patient 012-66291 last received prescriptions for magnesium sulfate 2 gm/50 ml ivpb in this hospital encounter? | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', medication.drugstarttime)) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-66... | eicu |
CREATE TABLE table_24706337_1 (
victor VARCHAR,
name_of_the_war VARCHAR
) | How many victors where there in the War of 1730 1736 , first stage? | SELECT COUNT(victor) FROM table_24706337_1 WHERE name_of_the_war = "War of 1730–1736 , first stage" | sql_create_context |
CREATE TABLE table_6858 (
"Date" text,
"Rocket" text,
"Type" text,
"Launch site" text,
"Satellite" text
) | What was the launch site for a satellite of GPS IIIA-2? | SELECT "Launch site" FROM table_6858 WHERE "Satellite" = 'gps iiia-2' | wikisql |
CREATE TABLE table_204_263 (
id number,
"pick" number,
"player" text,
"country of origin" text,
"pba team" text,
"college" text
) | where there more or less than 5 players picked from the united states ? | SELECT (SELECT COUNT("player") FROM table_204_263 WHERE "country of origin" = 'united states') > 5 | squall |
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | My answers, by creation date. My answers ordered by creation date | SELECT q.Id, q.Title, a.Id, a.CreationDate, a.LastEditDate, a.LastEditorUserId, a.Score FROM Posts AS q INNER JOIN Posts AS a ON q.Id = a.ParentId AND a.PostTypeId = 2 AND q.PostTypeId = 1 WHERE a.OwnerUserId = '##UserId##' ORDER BY a.CreationDate | sede |
CREATE TABLE table_name_13 (
played VARCHAR,
tries_against VARCHAR,
drawn VARCHAR
) | What is the played number when tries against is 84, and drawn is 2? | SELECT played FROM table_name_13 WHERE tries_against = "84" AND drawn = "2" | sql_create_context |
CREATE TABLE table_1358608_2 (
result VARCHAR,
race VARCHAR
) | What was the result for the railway stakes race? | SELECT result FROM table_1358608_2 WHERE race = "Railway Stakes" | sql_create_context |
CREATE TABLE table_57974 (
"Episode" real,
"Rating" real,
"Share" real,
"Rating/share (18-49)" text,
"Rank (Timeslot)" real,
"Rank (Night)" real
) | What is the smallest timeslot rank when the rating is smaller than 2.6? | SELECT MIN("Rank (Timeslot)") FROM table_57974 WHERE "Rating" < '2.6' | wikisql |
CREATE TABLE table_name_97 (
total INTEGER,
bronze VARCHAR,
sport VARCHAR,
gold VARCHAR,
silver VARCHAR
) | What is the lowest Total that has a Gold larger than 0, Silver smaller than 4, Sport of football, and a Bronze larger than 1? | SELECT MIN(total) FROM table_name_97 WHERE gold > 0 AND silver < 4 AND sport = "football" AND bronze > 1 | sql_create_context |
CREATE TABLE table_name_4 (
chassis VARCHAR,
driver VARCHAR
) | What chassis did John Watson drive? | SELECT chassis FROM table_name_4 WHERE driver = "john watson" | sql_create_context |
CREATE TABLE table_65215 (
"Nat." text,
"Name" text,
"Type" text,
"Transfer window" text,
"Transfer fee" text
) | Marcell Jansen of the nation GER has what for the type? | SELECT "Type" FROM table_65215 WHERE "Nat." = 'ger' AND "Name" = 'marcell jansen' | wikisql |
CREATE TABLE table_1342256_32 (
incumbent VARCHAR,
district VARCHAR
) | How many sitting Representatives are there in the New York 10 polling area? | SELECT COUNT(incumbent) FROM table_1342256_32 WHERE district = "New York 10" | sql_create_context |
CREATE TABLE table_65108 (
"Nat." text,
"Name" text,
"Moving from" text,
"Type" text,
"Transfer window" text,
"Ends" real,
"Transfer fee" text
) | What was the transfer fee for the player with an ends of 2007? | SELECT "Transfer fee" FROM table_65108 WHERE "Ends" = '2007' | 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 procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic ... | Which patients have an abnormal test with lab test item id 51255? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51255" AND lab.flag = "abnormal" | mimicsql_data |
CREATE TABLE table_6832 (
"Time" text,
"00:00 AM" text,
"01:00 AM" text,
"02:00 AM" text,
"05:00 AM" text
) | Which show runs on Friday at 05:00 AM? | SELECT "05:00 AM" FROM table_6832 WHERE "Time" = 'friday' | wikisql |
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 primary disease and procedure long title of subject id 22377? | SELECT demographic.diagnosis, procedures.long_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "22377" | mimicsql_data |
CREATE TABLE table_204_887 (
id number,
"district" number,
"representative" text,
"party" text,
"residence" text,
"counties represented" text
) | which wyoming senator represented the most counties ? | SELECT "representative" FROM table_204_887 ORDER BY "counties represented" DESC LIMIT 1 | squall |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE p... | list the top five most common drugs that patients were prescribed within 2 months after being prescribed lactated ringers iv solp a year before. | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'lactated ringers iv solp' AND DATETIME(medication.d... | eicu |
CREATE TABLE table_21304 (
"Match Number" real,
"Date" text,
"Venue" text,
"Team 1" text,
"Team 2" text,
"Result" text,
"Man of the Match" text
) | Who is man of the match when Team 1 is ICL Pakistan? | SELECT "Man of the Match" FROM table_21304 WHERE "Team 1" = 'ICL Pakistan' | wikisql |
CREATE TABLE mission (
Mission_ID int,
Ship_ID int,
Code text,
Launched_Year int,
Location text,
Speed_knots int,
Fate text
)
CREATE TABLE ship (
Ship_ID int,
Name text,
Type text,
Nationality text,
Tonnage int
) | Show me a stacked bar graph, the x-axis is the nationality of ship, and the y-axis is their total number of different nationality and split by ship type, sort x-axis in ascending order. | SELECT Nationality, COUNT(Nationality) FROM ship GROUP BY Type, Nationality ORDER BY Nationality | nvbench |
CREATE TABLE table_25759 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" text,
"U.S. viewers (millions)" text
) | What episode number of the season was also number 75 in the series? | SELECT MAX("No. in season") FROM table_25759 WHERE "No. in series" = '75' | wikisql |
CREATE TABLE table_16895 (
"Name" text,
"Number" text,
"Builder" text,
"Date built" text,
"Wheel arrangement" text,
"Driving wheels" text,
"Cylinders" text,
"Boiler pressure" text,
"Notes" text
) | What's the size of the cylinders built by Longbottom, Barnsley? | SELECT "Cylinders" FROM table_16895 WHERE "Builder" = 'Longbottom, Barnsley' | wikisql |
CREATE TABLE table_61597 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | What is the to par for the United States with a 67-71-73=211 score? | SELECT "To par" FROM table_61597 WHERE "Country" = 'united states' AND "Score" = '67-71-73=211' | wikisql |
CREATE TABLE table_name_1 (
date VARCHAR,
visitor VARCHAR
) | When has a Visitor of bulls? | SELECT date FROM table_name_1 WHERE visitor = "bulls" | sql_create_context |
CREATE TABLE match_result (
Rank int,
Club_ID int,
Gold int,
Big_Silver int,
Small_Silver int,
Bronze int,
Points int
)
CREATE TABLE club (
Club_ID int,
Club_name text,
Region text,
Start_year int
)
CREATE TABLE coach (
Coach_ID int,
Coach_name text,
Gender text... | Show different occupations along with the number of players in each occupation. Show bar chart. | SELECT Occupation, COUNT(*) FROM player GROUP BY Occupation | nvbench |
CREATE TABLE Performers_in_Bookings (
Order_ID INTEGER,
Performer_ID INTEGER
)
CREATE TABLE Marketing_Regions (
Marketing_Region_Code CHAR(15),
Marketing_Region_Name VARCHAR(255),
Marketing_Region_Descriptrion VARCHAR(255),
Other_Details VARCHAR(255)
)
CREATE TABLE Clients (
Client_ID INTE... | Give me the descriptions of the service types that cost more than 100, and count them by a bar chart, and sort by the Service_Type_Description from low to high please. | SELECT Service_Type_Description, COUNT(Service_Type_Description) FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Price > 100 GROUP BY Service_Type_Description ORDER BY Service_Type_Description | nvbench |
CREATE TABLE table_name_98 (
date VARCHAR,
opponents_in_the_final VARCHAR
) | On which date is the tournament final with the opponents michael berrer & kenneth carlsen? | SELECT date FROM table_name_98 WHERE opponents_in_the_final = "michael berrer & kenneth carlsen" | sql_create_context |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
... | what's the average cost of a hospital with phenylephrine 40 mg in 250 ml ns? | 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 medication.patientunitstayid FROM medication WHERE medication.drugname = 'phenylephrine 40 mg in 250 ml ns')) GROUP BY c... | eicu |
CREATE TABLE table_name_99 (
code VARCHAR,
type VARCHAR,
population VARCHAR
) | When populatioin is greater than 7,747 and the type is V, what is the sum of code? | SELECT COUNT(code) FROM table_name_99 WHERE type = "v" AND population > 7 OFFSET 747 | sql_create_context |
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE procedures_icd (
... | how many times did patient 9294 have an intake of br milk fs ng on this month/04? | SELECT COUNT(*) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9294)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'br milk fs ng... | mimic_iii |
CREATE TABLE table_33565 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | Where was the game played when the home team scored 17.7 (109)? | SELECT "Venue" FROM table_33565 WHERE "Home team score" = '17.7 (109)' | wikisql |
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,
... | how many patients whose marital status is married and diagnoses icd9 code is 5570? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "MARRIED" AND diagnoses.icd9_code = "5570" | mimicsql_data |
CREATE TABLE table_54511 (
"Goal" real,
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text
) | What venue had less than 2 goals? | SELECT "Venue" FROM table_54511 WHERE "Goal" < '2' | wikisql |
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,
... | find out the number of newborn patients who have esophageal reflux diagnoses. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "NEWBORN" AND diagnoses.long_title = "Esophageal reflux" | mimicsql_data |
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
value... | i would like to get the top five diagnosis that has the highest one year mortality rate. | SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t4.icd9_code FROM (SELECT t3.icd9_code, DENSE_RANK() OVER (ORDER BY t3.c1 DESC) AS c2 FROM (SELECT t2.icd9_code, 100 - SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t2.chartt... | mimic_iii |
CREATE TABLE table_41229 (
"Location" text,
"Aircraft" text,
"Tail number" text,
"Aircraft damage" text,
"Fatalities" text
) | In what location were the fatalities unknown for the Ju-52 aircraft? | SELECT "Location" FROM table_41229 WHERE "Fatalities" = 'unknown' AND "Aircraft" = 'ju-52' | 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_CLINIC_ID text,
MED_DIRE_CD tex... | 从13年1月21日到20年1月10日医疗机构0655890统筹金额消耗量是多少? | SELECT SUM(t_kc24.OVE_PAY) FROM t_kc21 JOIN t_kc24 JOIN t_kc21_t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc24.MED_CLINIC_ID AND t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID WHERE t_kc21.MED_SER_ORG_NO = '0655890' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2013-01-21' AND '2020-01-10' | css |
CREATE TABLE mzb (
CLINIC_ID text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD text,
INPT_AREA_BED text,
INSURED_IDENTITY number,
INSURED_STS text,
INSU_TYPE text,
IN... | 给病患患有白内障的开出的药品编号是什么名称都叫啥? | SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.IN_DIAG_DIS_NM = '白内障' UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gyb.IN_DIAG_DIS_NM = '白内障' UNION SELE... | css |
CREATE TABLE table_80267 (
"Year" real,
"Entrant" text,
"Chassis" text,
"Engine" text,
"Pts." text
) | How many points were scored when the Chassis is BRM p25? | SELECT "Pts." FROM table_80267 WHERE "Chassis" = 'brm p25' | 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_CLINIC_ID text,
MED_DIRE_CD tex... | 在00年2月11日到21年8月9日期间,因瘙痒症导致住院产生的平均费用在泌尿肿瘤科有多少 | SELECT AVG(gwyjzb.MED_AMOUT) FROM gwyjzb WHERE gwyjzb.MED_ORG_DEPT_NM = '泌尿肿瘤科' AND gwyjzb.IN_HOSP_DATE BETWEEN '2000-02-11' AND '2021-08-09' AND gwyjzb.IN_DIAG_DIS_NM = '瘙痒症' AND gwyjzb.CLINIC_TYPE = '住院' UNION SELECT AVG(fgwyjzb.MED_AMOUT) FROM fgwyjzb WHERE fgwyjzb.MED_ORG_DEPT_NM = '泌尿肿瘤科' AND fgwyjzb.IN_HOSP_DATE ... | css |
CREATE TABLE table_22916979_5 (
rank VARCHAR,
densest_incorporated_place VARCHAR
) | Name the number of rank for stone park | SELECT COUNT(rank) FROM table_22916979_5 WHERE densest_incorporated_place = "Stone Park" | sql_create_context |
CREATE TABLE Organisations (
organisation_type VARCHAR,
organisation_id VARCHAR
)
CREATE TABLE Research_Staff (
employer_organisation_id VARCHAR
) | What is the organisation type and id of the organisation which has the most number of research staff? | SELECT T1.organisation_type, T1.organisation_id FROM Organisations AS T1 JOIN Research_Staff AS T2 ON T1.organisation_id = T2.employer_organisation_id GROUP BY T1.organisation_id ORDER BY COUNT(*) DESC LIMIT 1 | sql_create_context |
CREATE TABLE table_name_18 (
points VARCHAR,
played INTEGER
) | What is the Points with a Played larger than 14? | SELECT COUNT(points) FROM table_name_18 WHERE played > 14 | sql_create_context |
CREATE TABLE table_8880 (
"Title" text,
"Writer" text,
"Doctor" text,
"Format" text,
"Company" text,
"release date" text
) | What is Doctor, when Format is CD, and when Title is The Relics Of Time? | SELECT "Doctor" FROM table_8880 WHERE "Format" = 'cd' AND "Title" = 'the relics of time' | wikisql |
CREATE TABLE table_46354 (
"Date" text,
"Venue" text,
"Opponents" text,
"Score" text,
"Competition" text,
"Match Report" text
) | What is Competition, when Score is '2-1', and when Date is 'October 22, 2008'? | SELECT "Competition" FROM table_46354 WHERE "Score" = '2-1' AND "Date" = 'october 22, 2008' | wikisql |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.