context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
HIRE_DATE date,
JOB_ID varchar(10),
SALARY decimal(8,2),
COMMISSION_PCT decimal(2,2),
MANAGER_ID decimal(6,0),
DEPARTMENT_ID decimal(... | 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 , and could you sort Y in asc 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 | nvbench |
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... | 列出所有医疗就诊记录的统筹基金支出与医疗费总额在医院0109582中的平均比值是多大,在不同科室名称下? | SELECT t_kc24.t_kc21_MED_ORG_DEPT_NM, AVG(t_kc24.OVE_PAY) FROM t_kc24 WHERE t_kc24.t_kc21_MED_SER_ORG_NO = '0109582' GROUP BY t_kc24.t_kc21_MED_ORG_DEPT_NM | css |
CREATE TABLE table_40002 (
"Date" text,
"Title" text,
"Director" text,
"Producer" text,
"Production Cost" text,
"Singapore Gross" text
) | What is the Production Cost with a Date that is february 2000? | SELECT "Production Cost" FROM table_40002 WHERE "Date" = 'february 2000' | wikisql |
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 elective hospital admission patients who had cd3 cells, percent lab test. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab.label = "CD3 Cells, Percent" | mimicsql_data |
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 outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime ... | when was the first time patient 11579 was since 2105 diagnosed with gastrojejunal ulcer nos? | SELECT diagnoses_icd.charttime FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'gastrojejunal ulcer nos') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 11579) AND STRFTIM... | mimic_iii |
CREATE TABLE table_64212 (
"Position" real,
"Gymnast" text,
"Floor" text,
"Pommel Horse" text,
"Rings" text,
"Vault" text,
"Parallel Bars" text,
"Horizontal Bar" text,
"Total" real
) | What is the score of the floor when the position is less than 21, and less than 81.2 total, and the pommel horse score is 13.925? | SELECT "Floor" FROM table_64212 WHERE "Position" < '21' AND "Total" < '81.2' AND "Pommel Horse" = '13.925' | wikisql |
CREATE TABLE order_items (
order_item_id number,
order_id number,
product_id number,
product_quantity text,
other_order_item_details text
)
CREATE TABLE products (
product_id number,
parent_product_id number,
production_type_code text,
unit_price number,
product_name text,
p... | Show the id, the account name, and other account details for all accounts by the customer with first name 'Meaghan'. | SELECT T1.account_id, T1.date_account_opened, T1.account_name, T1.other_account_details FROM accounts AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan' | spider |
CREATE TABLE table_2176 (
"Pitcher" text,
"Stats" real,
"Wins" real,
"Losses" real,
"No decisions" real,
"Winning %" text,
"Seasons" text
) | How many wins had a win percentage of 0.667 | SELECT "Wins" FROM table_2176 WHERE "Winning %" = '0.667' | 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... | 病患04686817药品均价低于9433.92元在哪几次医疗记录中被开出的和医疗就诊编号是多少啊? | SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_ID = '04686817' AND NOT t_kc22.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT > 9433.92) | css |
CREATE TABLE table_14118521_1 (
shuttle VARCHAR,
primary_payload_s_ VARCHAR
) | what's the shuttle with primary payload(s) being united states microgravity laboratory-1 | SELECT shuttle FROM table_14118521_1 WHERE primary_payload_s_ = "United States Microgravity Laboratory-1" | sql_create_context |
CREATE TABLE table_name_94 (
points INTEGER,
november VARCHAR
) | How many points are there on november 7? | SELECT MAX(points) FROM table_name_94 WHERE november = 7 | sql_create_context |
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 department (
dept_name varchar(20),
building varchar(15),
budget numeric(12,2)
)
CREATE TABLE student (
ID varchar(5... | Draw a bar chart for how many total credits are offered by each department?, and rank y-axis in descending order. | SELECT dept_name, SUM(credits) FROM course GROUP BY dept_name ORDER BY SUM(credits) DESC | nvbench |
CREATE TABLE flight (
id int,
Vehicle_Flight_number text,
Date text,
Pilot text,
Velocity real,
Altitude real,
airport_id int,
company_id int
)
CREATE TABLE operate_company (
id int,
name text,
Type text,
Principal_activities text,
Incorporated_in text,
Group_Equ... | Show me the total number by country in a histogram, rank total number from low to high order. | SELECT Country, COUNT(*) FROM airport GROUP BY Country ORDER BY COUNT(*) | nvbench |
CREATE TABLE table_name_26 (
extra_points INTEGER,
player VARCHAR,
touchdowns VARCHAR
) | Which Extra points is the lowest one that has a Player of rheinschild, and Touchdowns larger than 1? | SELECT MIN(extra_points) FROM table_name_26 WHERE player = "rheinschild" AND touchdowns > 1 | sql_create_context |
CREATE TABLE table_21297652_1 (
winnings VARCHAR,
driver VARCHAR
) | How much did Dale Jarrett win? | SELECT winnings FROM table_21297652_1 WHERE driver = "Dale Jarrett" | sql_create_context |
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 time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TA... | please list the shortest 1 stop flight from ONTARIO CALIFORNIA to ORLANDO FLORIDA | 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, state AS STATE_0, state AS STATE_1 WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ORLANDO' AND flight.stops = 1 AND flight.to_airport ... | atis |
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,
... | tell me patient 010-12376's weight change last measured on the last hospital visit compared to the value first measured on the last hospital visit? | SELECT (SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-12376' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1) AND NOT patient.admissionweight IS NU... | eicu |
CREATE TABLE table_57374 (
"Rd #" real,
"Pick #" real,
"Player" text,
"Team (League)" text,
"Reg GP" real,
"Pl GP" real
) | How many reg GP for mattias ohlund? | SELECT COUNT("Reg GP") FROM table_57374 WHERE "Player" = 'mattias ohlund' | wikisql |
CREATE TABLE procedures (
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
)
... | give me the number of patients whose admission type is newborn and drug route is both eyes? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "NEWBORN" AND prescriptions.route = "BOTH EYES" | mimicsql_data |
CREATE TABLE table_38578 (
"Date" text,
"Tournament" text,
"Surface" text,
"Opponent" text,
"Score" text
) | Which Opponent is on 29 september 1997? | SELECT "Opponent" FROM table_38578 WHERE "Date" = '29 september 1997' | wikisql |
CREATE TABLE table_56325 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What was the date of the Collingwood away game? | SELECT "Date" FROM table_56325 WHERE "Away team" = 'collingwood' | wikisql |
CREATE TABLE table_43706 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Attendance" real,
"Record" text,
"Points" real
) | When was Montreal a visitor? | SELECT "Date" FROM table_43706 WHERE "Visitor" = 'montreal' | wikisql |
CREATE TABLE table_16012 (
"Nomination" text,
"Actors Name" text,
"Film Name" text,
"Director" text,
"Country" text
) | What film did michaylo ilyenko make with best actor in a supporting role? | SELECT "Film Name" FROM table_16012 WHERE "Director" = 'Michaylo Ilyenko' AND "Nomination" = 'Best Actor in a Supporting Role' | wikisql |
CREATE TABLE table_39097 (
"Round" real,
"Pick #" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
) | Which of the highest pick numbers had a round of less than 2? | SELECT MAX("Pick #") FROM table_39097 WHERE "Round" < '2' | wikisql |
CREATE TABLE table_name_80 (
fa_cup_goals INTEGER,
position VARCHAR,
fa_cup_apps VARCHAR,
total_goals VARCHAR
) | what is the average fa cup goals when the fa cup apps is 0, total goals is less than 1 and position is df? | SELECT AVG(fa_cup_goals) FROM table_name_80 WHERE fa_cup_apps = "0" AND total_goals < 1 AND position = "df" | sql_create_context |
CREATE TABLE airline (
airline_code varchar,
airline_name text,
note text
)
CREATE TABLE days (
days_code varchar,
day_name varchar
)
CREATE TABLE city (
city_code varchar,
city_name varchar,
state_code varchar,
country_name varchar,
time_zone_code varchar
)
CREATE TABLE fligh... | i need a flight from TORONTO to SAN DIEGO with a layover in WASHINGTON on AC | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN DIEGO' AND CITY_2... | atis |
CREATE TABLE table_15315816_1 (
year VARCHAR,
tournament_location VARCHAR
) | When are all years that tournament location is Western Turnpike Golf Course? | SELECT year FROM table_15315816_1 WHERE tournament_location = "Western Turnpike Golf Course" | sql_create_context |
CREATE TABLE airlines (
alid integer,
name text,
iata varchar(2),
icao varchar(3),
callsign text,
country text,
active varchar(2)
)
CREATE TABLE airports (
apid integer,
name text,
city text,
country text,
x real,
y real,
elevation bigint,
iata character varc... | Find the country of the airlines whose name starts with 'Orbit', and count them by a bar chart | SELECT country, COUNT(country) FROM airlines WHERE name LIKE 'Orbit%' GROUP BY country | nvbench |
CREATE TABLE song (
song_name varchar2(50),
artist_name varchar2(50),
country varchar2(20),
f_id number(10),
genre_is varchar2(20),
rating number(10),
languages varchar2(20),
releasedate Date,
resolution number(10)
)
CREATE TABLE artist (
artist_name varchar2(50),
country va... | how many songs were released for each format?, and sort in descending by the y axis. | SELECT formats, COUNT(*) FROM files GROUP BY formats ORDER BY COUNT(*) DESC | nvbench |
CREATE TABLE person_info (
CSD text,
CSRQ time,
GJDM text,
GJMC text,
JGDM text,
JGMC text,
MZDM text,
MZMC text,
RYBH text,
XBDM number,
XBMC text,
XLDM text,
XLMC text,
XM text,
ZYLBDM text,
ZYMC text
)
CREATE TABLE bdmzjzjlb (
HXPLC number,
HZX... | 13253905900这次门诊就诊的中医诊断结果如何?列出编号和名称 | SELECT wdmzjzjlb.MZZYZDZZBM, wdmzjzjlb.MZZYZDZZMC FROM wdmzjzjlb WHERE wdmzjzjlb.JZLSH = '13253905900' UNION SELECT bdmzjzjlb.MZZYZDZZBM, bdmzjzjlb.MZZYZDZZMC FROM bdmzjzjlb WHERE bdmzjzjlb.JZLSH = '13253905900' | css |
CREATE TABLE table_name_63 (
record VARCHAR,
round INTEGER
) | Tell me the record for round more than 1 | SELECT record FROM table_name_63 WHERE round > 1 | sql_create_context |
CREATE TABLE table_name_70 (
grid INTEGER,
time_retired VARCHAR,
qual VARCHAR
) | What is the smallest grid with a Time/Retired of engine, and a qual of less than 138.75? | SELECT MIN(grid) FROM table_name_70 WHERE time_retired = "engine" AND qual < 138.75 | sql_create_context |
CREATE TABLE club (
Club_ID int,
Club_name text,
Region text,
Start_year int
)
CREATE TABLE match_result (
Rank int,
Club_ID int,
Gold int,
Big_Silver int,
Small_Silver int,
Bronze int,
Points int
)
CREATE TABLE player (
Player_ID int,
Sponsor_name text,
Player_... | Compare the number of players of different occupations using a bar chart. | SELECT Occupation, COUNT(Occupation) FROM player GROUP BY Occupation | nvbench |
CREATE TABLE table_17127 (
"Calculator" text,
"CPU" text,
"RAM" text,
"Display Size" text,
"Programming Languages" text,
"Link Abilities" text,
"Year Released" text,
"Predecessors" text,
"Successors" text
) | What is the cpu of the calculator released in 1993? | SELECT "CPU" FROM table_17127 WHERE "Year Released" = '1993' | 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 lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,... | what is primary disease and drug code of subject id 2560? | SELECT demographic.diagnosis, prescriptions.formulary_drug_cd FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "2560" | mimicsql_data |
CREATE TABLE buildings (
id number,
name text,
city text,
height number,
stories number,
status text
)
CREATE TABLE companies (
id number,
name text,
headquarters text,
industry text,
sales_billion number,
profits_billion number,
assets_billion number,
market_val... | List the name of a building along with the name of a company whose office is in the building. | SELECT T3.name, T2.name FROM office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN companies AS T3 ON T1.company_id = T3.id | spider |
CREATE TABLE table_name_28 (
date VARCHAR,
name__location_ VARCHAR
) | What Date does the Name (location) Belyanitsky, Ivanovo, and Balino have? | SELECT date FROM table_name_28 WHERE name__location_ = "belyanitsky, ivanovo, and balino" | sql_create_context |
CREATE TABLE table_name_2 (
result VARCHAR,
director VARCHAR,
year VARCHAR
) | What is the result for director Said Elmarouk before 2008? | SELECT result FROM table_name_2 WHERE director = "said elmarouk" AND year < 2008 | sql_create_context |
CREATE TABLE table_49020 (
"Date" text,
"Time ( GMT )" text,
"Serial" text,
"Apogee" text,
"Outcome" text
) | Which Apogee was on 1959-02-20? | SELECT "Apogee" FROM table_49020 WHERE "Date" = '1959-02-20' | wikisql |
CREATE TABLE table_name_47 (
tie_no VARCHAR,
home_team VARCHAR
) | what is enfield's tie number? | SELECT tie_no FROM table_name_47 WHERE home_team = "enfield" | sql_create_context |
CREATE TABLE table_22014431_3 (
deductions VARCHAR,
tosses_pyramids VARCHAR
) | How many deductions have 56.5 as tosses/pyramids? | SELECT deductions FROM table_22014431_3 WHERE tosses_pyramids = "56.5" | sql_create_context |
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
... | Number of questions with a minimal number of answers on a N days period. | SELECT DATEADD(DAY, 0, DATEDIFF(DAY, 0, CreationDate) / @days * @days) AS FullDate, CAST(COUNT(*) AS FLOAT) AS "#Questions" FROM Posts AS q WHERE q.PostTypeId = 1 AND q.AnswerCount >= '##minAnswers##' GROUP BY (DATEDIFF(DAY, 0, CreationDate) / @days * @days) ORDER BY FullDate DESC | sede |
CREATE TABLE table_203_81 (
id number,
"date" text,
"constituency" text,
"gain" text,
"loss" text,
"note" text
) | how many dates are listed ? | SELECT COUNT("date") FROM table_203_81 | squall |
CREATE TABLE table_78340 (
"Candidate" text,
"Money Raised, 2Q" text,
"Loans Received, 2Q" text,
"Money Spent, 2Q" text,
"Total Receipts" text,
"Cash On Hand" text
) | Name the money raised when 2Q has money spent and 2Q is $874,042 | SELECT "Money Raised, 2Q" FROM table_78340 WHERE "Money Spent, 2Q" = '$874,042' | wikisql |
CREATE TABLE table_3772 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"U.S. viewers (millions)" text
) | What number in season is number 141 in series? | SELECT MAX("No. in season") FROM table_3772 WHERE "No. in series" = '141' | wikisql |
CREATE TABLE table_9678 (
"Heat" real,
"Lane" real,
"Name" text,
"Country" text,
"Mark" text
) | How many lanes was Khadevis Robinson in for heats over 2? | SELECT COUNT("Lane") FROM table_9678 WHERE "Heat" > '2' AND "Name" = 'khadevis robinson' | wikisql |
CREATE TABLE table_name_72 (
laps VARCHAR,
grid VARCHAR
) | Hows many Laps are in a Grid of 4? | SELECT COUNT(laps) FROM table_name_72 WHERE grid = 4 | sql_create_context |
CREATE TABLE student (
stuid number,
lname text,
fname text,
age number,
sex text,
major number,
advisor number,
city_code text
)
CREATE TABLE voting_record (
stuid number,
registration_date text,
election_cycle text,
president_vote number,
vice_president_vote number... | What are the distinct secretary votes in the fall election cycle? | SELECT DISTINCT secretary_vote FROM voting_record WHERE election_cycle = "Fall" | spider |
CREATE TABLE table_1095 (
"Pick #" real,
"Player" text,
"Position" text,
"Nationality" text,
"NHL team" text,
"College/junior/club team" text
) | What position did Marty Gateman play? | SELECT "Position" FROM table_1095 WHERE "Player" = 'Marty Gateman' | wikisql |
CREATE TABLE jybgb_jyjgzbb (
JYZBLSH number,
YLJGDM text,
jyjgzbb_id number
)
CREATE TABLE mzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH text,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
... | 哪些检验类型出现在检验报告单11875806581上? | SELECT jybgb.JYLX FROM jybgb WHERE jybgb.BGDH = '11875806581' | css |
CREATE TABLE table_name_72 (
votes VARCHAR,
_percentage_of_national_vote VARCHAR,
candidates_nominated VARCHAR
) | How many votes were tallied with a % of national vote of 13.11, and over 39 candidates nominated? | SELECT COUNT(votes) FROM table_name_72 WHERE _percentage_of_national_vote = 13.11 AND candidates_nominated > 39 | 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 ... | what were the four most commonly prescribed drugs at the same time during the previous year for patients who were prescribed spironolactone? | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'spironolactone' AND DATETIME(prescriptions.startdate, 'start of y... | mimic_iii |
CREATE TABLE table_26877 (
"Rank" real,
"Name" text,
"Nationality" text,
"1st (m)" text,
"2nd (m)" text,
"Points" text,
"Overall FHT Points" text,
"Overall WC points (Rank)" text
) | Name the rank for thomas morgenstern | SELECT "Rank" FROM table_26877 WHERE "Name" = 'Thomas Morgenstern' | wikisql |
CREATE TABLE table_33962 (
"Element" text,
"Wood" text,
"Fire" text,
"Earth" text,
"Metal" text,
"Water" text
) | Which earth has west metal? | SELECT "Earth" FROM table_33962 WHERE "Metal" = 'west' | wikisql |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE labevents (
row_id number,
subject_id number,
... | count the number of prescribed drugs patient 1114 has been prescribed on the current hospital encounter. | SELECT COUNT(*) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1114 AND admissions.dischtime IS NULL) | mimic_iii |
CREATE TABLE table_20760802_1 (
played VARCHAR,
won VARCHAR
) | How many teams that played won 0 games? | SELECT played FROM table_20760802_1 WHERE won = "0" | sql_create_context |
CREATE TABLE table_69877 (
"Tournament" text,
"1990" text,
"1991" text,
"1992" text,
"1993" text,
"1994" text,
"1995" text,
"1996" text,
"1997" text,
"1998" text,
"Career SR" text
) | In 1994 what tournament held a ATP masters series | SELECT "1994" FROM table_69877 WHERE "Tournament" = 'atp masters series' | wikisql |
CREATE TABLE table_6724 (
"Year" real,
"Male" text,
"Female" text,
"Band" text,
"Album" text,
"Pop Act" text,
"Lifetime Achievement Award" text
) | In what year did Aslan receive a Lifetime Achievement Award and Snow Patrol perform? | SELECT "Year" FROM table_6724 WHERE "Band" = 'snow patrol' AND "Lifetime Achievement Award" = 'aslan' | wikisql |
CREATE TABLE table_name_46 (
agg VARCHAR
) | What was the 2nd leg score of the aggregate score of 4-9? | SELECT 2 AS nd_leg FROM table_name_46 WHERE agg = "4-9" | sql_create_context |
CREATE TABLE Settlements (
Claim_id VARCHAR
)
CREATE TABLE Claims (
Amount_Claimed INTEGER
) | Which claims caused more than 2 settlements or have the maximum claim value? List the date the claim was made and the claim id. | SELECT T1.Date_Claim_Made, T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id GROUP BY T1.Claim_id HAVING COUNT(*) > 2 UNION SELECT T1.Date_Claim_Made, T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id WHERE T1.Amount_Claimed = (SELECT MAX(Amount_Claimed) F... | sql_create_context |
CREATE TABLE table_name_16 (
nationality VARCHAR,
heat VARCHAR,
rank VARCHAR
) | Which Nationality has a Heat smaller than 2, and a Rank of 15? | SELECT nationality FROM table_name_16 WHERE heat < 2 AND rank = 15 | sql_create_context |
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 ... | find the number of patients whose insurance is private and diagnoses icd9 code is 2769. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Private" AND diagnoses.icd9_code = "2769" | mimicsql_data |
CREATE TABLE table_54238 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | what is the grid when the driver is mario andretti and the laps is less than 54? | SELECT MAX("Grid") FROM table_54238 WHERE "Driver" = 'mario andretti' AND "Laps" < '54' | wikisql |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime t... | whats the first height of patient 002-59265 until 02/2101? | SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-59265') AND NOT patient.admissionheight IS NULL AND STRFTIME('%y-%m', patient.unitadmittime) <= '2101-02' ORDER BY patient.unitadmittime LIMIT 1 | eicu |
CREATE TABLE table_name_58 (
rogers_cable__ottawa_ VARCHAR,
digital_psip VARCHAR,
vidéotron__gatineau_ VARCHAR
) | What's the total number of Rogers Cable (Ottawa) channels that have a Digital PSIP greater than 9.1, and a Vid otron (Gatineau) of channel 14? | SELECT COUNT(rogers_cable__ottawa_) FROM table_name_58 WHERE digital_psip > 9.1 AND vidéotron__gatineau_ = 14 | sql_create_context |
CREATE TABLE table_21436373_8 (
type_of_record VARCHAR,
result_games VARCHAR
) | What record was set when the result/game was montreal 20 @ ottawa 10? | SELECT type_of_record FROM table_21436373_8 WHERE result_games = "Montreal 20 @ Ottawa 10" | sql_create_context |
CREATE TABLE table_45916 (
"Date" text,
"Round" text,
"Opponent" text,
"Venue" text,
"Result" text,
"Attendance" real
) | What is Opponent, when Date is 8 April 1999? | SELECT "Opponent" FROM table_45916 WHERE "Date" = '8 april 1999' | wikisql |
CREATE TABLE table_name_78 (
opponent VARCHAR,
round VARCHAR,
event VARCHAR
) | Which Opponent has a Round larger than 4 and the Event, Draka V? | SELECT opponent FROM table_name_78 WHERE round > 4 AND event = "draka v" | sql_create_context |
CREATE TABLE table_name_23 (
iata VARCHAR,
city VARCHAR
) | What is the IATA for the city of Amsterdam? | SELECT iata FROM table_name_23 WHERE city = "amsterdam" | sql_create_context |
CREATE TABLE table_name_82 (
Id VARCHAR
) | Which year has a 2003 of lq? | SELECT 2009 FROM table_name_82 WHERE 2003 = "lq" | sql_create_context |
CREATE TABLE airlines (
Id VARCHAR
) | How many airlines are there? | SELECT COUNT(*) FROM airlines | sql_create_context |
CREATE TABLE table_15700367_4 (
runs_conceded INTEGER
) | Name the most runs conceded | SELECT MAX(runs_conceded) FROM table_15700367_4 | sql_create_context |
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose_val_rx text,
dose_unit_rx text,
route text
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime tim... | does patient 25997 have a male or female gender? | SELECT patients.gender FROM patients WHERE patients.subject_id = 25997 | mimic_iii |
CREATE TABLE Tryout (
pID numeric(5,0),
cName varchar(20),
pPos varchar(8),
decision varchar(3)
)
CREATE TABLE Player (
pID numeric(5,0),
pName varchar(20),
yCard varchar(3),
HS numeric(5,0)
)
CREATE TABLE College (
cName varchar(20),
state varchar(2),
enr numeric(5,0)
) | Give me the comparison about enr over the state by a bar chart. | SELECT state, enr FROM College ORDER BY enr | nvbench |
CREATE TABLE table_55598 (
"Year" real,
"Network" text,
"Play-by-play" text,
"Color commentator(s)" text,
"Ice level reporters" text
) | Who is the Ice level reporter after 1992 with the color commentator John Davidson and the play-by-play Marv Albert? | SELECT "Ice level reporters" FROM table_55598 WHERE "Color commentator(s)" = 'john davidson' AND "Play-by-play" = 'marv albert' AND "Year" > '1992' | wikisql |
CREATE TABLE table_9902 (
"Matrix" real,
"Recording date" text,
"Title" text,
"Accompaniment" text,
"Paramount Issue No." real,
"Sandra Lieb Classification" text,
"JSP 77933" text,
"Document DOCD" real
) | what is the accompaniment when the title is stormy seas blues? | SELECT "Accompaniment" FROM table_9902 WHERE "Title" = 'stormy seas blues' | wikisql |
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE program (
program_id int,
name varchar,
... | Name the simple class I can join to cover the MDE requirement . | SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%MDE%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_cou... | advising |
CREATE TABLE table_18522916_5 (
date_of_vacancy VARCHAR,
outgoing_manager VARCHAR
) | Name the date of vacancy for daniel uberti | SELECT date_of_vacancy FROM table_18522916_5 WHERE outgoing_manager = "Daniel Uberti" | sql_create_context |
CREATE TABLE table_name_68 (
written_by VARCHAR,
series__number VARCHAR
) | Who wrote series number 99? | SELECT written_by FROM table_name_68 WHERE series__number = 99 | sql_create_context |
CREATE TABLE food_service (
meal_code text,
meal_number int,
compartment text,
meal_description varchar
)
CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_description varchar,
manufacturer varchar,
basic_type varchar,
engines int,
propulsion varchar,
wide_body varchar... | does AA fly to SAN FRANCISCO from ATLANTA | SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((flight.airline_code = 'AA') AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.to_airport = AIRP... | atis |
CREATE TABLE table_55127 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | Which home team played an away team that had a score of 16.15 (111)? | SELECT "Home team" FROM table_55127 WHERE "Away team score" = '16.15 (111)' | wikisql |
CREATE TABLE table_10236 (
"Date" text,
"Venue" text,
"Opponent" text,
"Result" text,
"Competition" text
) | What is the location of the game that was friendly and resulted in 2-3? | SELECT "Venue" FROM table_10236 WHERE "Competition" = 'friendly' AND "Result" = '2-3' | wikisql |
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 prescription... | how many patients stayed in hospital for more than 2 days and tested with pleural fluid in lab? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "2" AND lab.fluid = "Pleural" | mimicsql_data |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_care... | what are the ways to consume sterile water? | SELECT DISTINCT prescriptions.route FROM prescriptions WHERE prescriptions.drug = 'sterile water' | mimic_iii |
CREATE TABLE table_12001616_4 (
status VARCHAR,
car_name VARCHAR
) | What was the status of tropartic? | SELECT status FROM table_12001616_4 WHERE car_name = "TropArtic" | sql_create_context |
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 demographic (... | count the number of patients whose gender is f and age is less than 70? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.age < "70" | mimicsql_data |
CREATE TABLE table_name_79 (
team VARCHAR,
rider VARCHAR
) | What team has adam barclay as the rider? | SELECT team FROM table_name_79 WHERE rider = "adam barclay" | sql_create_context |
CREATE TABLE film_text (
film_id SMALLINT,
title VARCHAR(255),
description TEXT
)
CREATE TABLE language (
language_id TINYINT UNSIGNED,
name CHAR(20),
last_update TIMESTAMP
)
CREATE TABLE film_category (
film_id SMALLINT UNSIGNED,
category_id TINYINT UNSIGNED,
last_update TIMESTAMP... | Find all the payment dates for the payments with an amount larger than 10 and the payments handled by a staff person with the first name Elsa, and count them by a bar chart, and order by the total number from low to high please. | SELECT payment_date, COUNT(payment_date) FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa' ORDER BY COUNT(payment_date) | 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, visualize a scatter chart about the correlation between price and code . | SELECT T1.Price, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code | nvbench |
CREATE TABLE table_30120556_1 (
area__acres__ INTEGER,
townland VARCHAR
) | What is the fewest area in Derrynanool townland? | SELECT MIN(area__acres__) FROM table_30120556_1 WHERE townland = "Derrynanool" | sql_create_context |
CREATE TABLE table_31975 (
"Candidate" text,
"Party" text,
"Constituency" text,
"Year" text,
"Days" text
) | In 1955 which party did Thomas Mitchell belong to? | SELECT "Party" FROM table_31975 WHERE "Year" = '1955' AND "Candidate" = 'thomas mitchell' | wikisql |
CREATE TABLE table_name_2 (
winners VARCHAR
) | Who came in 3rd when Nicolai Klindt won? | SELECT 3 AS rd_place FROM table_name_2 WHERE winners = "nicolai klindt" | sql_create_context |
CREATE TABLE table_name_31 (
l2_cache VARCHAR,
model_number VARCHAR
) | WHat kind of L2 cache has a Model number of turion x2 ultra zm-85? | SELECT l2_cache FROM table_name_31 WHERE model_number = "turion x2 ultra zm-85" | sql_create_context |
CREATE TABLE table_57160 (
"Entrant" text,
"Constructor" text,
"Chassis" text,
"Driver" text,
"Rounds" text
) | Who is the drive for an Entrant of Scuderia Ambrosiana? | SELECT "Driver" FROM table_57160 WHERE "Entrant" = 'scuderia ambrosiana' | wikisql |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE cost (
costid number,
... | what were the three most frequent lab tests until 3 years ago? | SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE DATETIME(lab.labresulttime) <= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 3 | eicu |
CREATE TABLE Engineer_Skills (
engineer_id INTEGER,
skill_id INTEGER
)
CREATE TABLE Parts (
part_id INTEGER,
part_name VARCHAR(255),
chargeable_yn VARCHAR(1),
chargeable_amount VARCHAR(20),
other_part_details VARCHAR(255)
)
CREATE TABLE Asset_Parts (
asset_id INTEGER,
part_id INTEG... | Bar graph to show how many asset make from different asset make, and order by the asset_make in asc. | SELECT asset_make, COUNT(asset_make) FROM Assets GROUP BY asset_make ORDER BY asset_make | nvbench |
CREATE TABLE table_name_69 (
week_15__final__dec_3 VARCHAR,
week_12_nov_13 VARCHAR
) | What was Week 15 when Week 12 was Washington (9-1)? | SELECT week_15__final__dec_3 FROM table_name_69 WHERE week_12_nov_13 = "washington (9-1)" | sql_create_context |
CREATE TABLE table_3954 (
"Code" text,
"District" text,
"Headquarters" text,
"Population (2001 Census)" real,
"Population (2011 Census)" real,
"Area (km\u00b2)" real,
"Density in 2011 (/km\u00b2)" text
) | How many people lived in the district with a code GP in 2011? | SELECT MIN("Population (2011 Census)") FROM table_3954 WHERE "Code" = 'GP' | wikisql |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugsto... | when was patient 035-20156 given a chloride lab test for the last time? | SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-20156')) AND lab.labname = 'chloride' ORDER BY lab.labresulttime DESC LIMIT 1 | eicu |
CREATE TABLE table_73725 (
"Stage" real,
"Winner" text,
"General Classification" text,
"Youth Classification" text,
"Mountains Classification" text,
"Sprint Classification" text,
"Most Courageous" text,
"Team Classification" text
) | When Peter Sagan won the youth classification and Thomas Rabou won the most corageous, who won the sprint classification? | SELECT "Sprint Classification" FROM table_73725 WHERE "Youth Classification" = 'Peter Sagan' AND "Most Courageous" = 'Thomas Rabou' | wikisql |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.