context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
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 ethnicity is white - russian and diagnoses icd9 code is 7761? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND diagnoses.icd9_code = "7761" | mimicsql_data |
CREATE TABLE table_69140 (
"Representative" text,
"Years" text,
"State" text,
"Party" text,
"Lifespan" text
) | Which Representative had a Lifespan of 1795 1866? | SELECT "Representative" FROM table_69140 WHERE "Lifespan" = '1795–1866' | wikisql |
CREATE TABLE Physician (
EmployeeID INTEGER,
Name VARCHAR(30),
Position VARCHAR(30),
SSN INTEGER
)
CREATE TABLE Appointment (
AppointmentID INTEGER,
Patient INTEGER,
PrepNurse INTEGER,
Physician INTEGER,
Start DATETIME,
End DATETIME,
ExaminationRoom TEXT
)
CREATE TABLE Medi... | Find the number of the physicians who are trained in a procedure that costs more than 5000, and list by the x axis in descending. | SELECT T1.Name, COUNT(T1.Name) FROM Physician AS T1 JOIN Trained_In AS T2 ON T1.EmployeeID = T2.Physician JOIN Procedures AS T3 ON T3.Code = T2.Treatment WHERE T3.Cost > 5000 GROUP BY T1.Name ORDER BY T1.Name DESC | nvbench |
CREATE TABLE course_tags_count (
course_id int,
clear_grading int,
pop_quiz int,
group_projects int,
inspirational int,
long_lectures int,
extra_credit int,
few_tests int,
good_feedback int,
tough_tests int,
heavy_papers int,
cares_for_students int,
heavy_assignments ... | Which ULCS course is easiest ? | SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_co... | advising |
CREATE TABLE table_name_88 (
genre VARCHAR,
directed_by VARCHAR
) | What Genre did S ndor Sim direct? | SELECT genre FROM table_name_88 WHERE directed_by = "sándor simó" | 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 prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
... | which type of drug is critic-aid clear af? | SELECT prescriptions.drug_type FROM prescriptions WHERE prescriptions.drug = "Critic-Aid Clear AF" | mimicsql_data |
CREATE TABLE table_name_67 (
road_team VARCHAR,
result VARCHAR
) | What road team has 86-84 as the result? | SELECT road_team FROM table_name_67 WHERE result = "86-84" | sql_create_context |
CREATE TABLE table_name_75 (
games INTEGER,
team VARCHAR,
rebounds VARCHAR
) | What's the mean game number for the olympiacos team when there's less than 17 rebounds? | SELECT AVG(games) FROM table_name_75 WHERE team = "olympiacos" AND rebounds < 17 | sql_create_context |
CREATE TABLE table_41455 (
"Rank" text,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | What nation has a bronze of 2 with a total less than 5 and rank of 6? | SELECT "Nation" FROM table_41455 WHERE "Bronze" = '2' AND "Total" < '5' AND "Rank" = '6' | wikisql |
CREATE TABLE table_27437 (
"City" text,
"Population" real,
"Registered voters" text,
"Democratic" text,
"Republican" text,
"D\u2013R spread" text,
"Other" text,
"No party preference" text
) | If Democratic is 42.5%, what is the city? | SELECT "City" FROM table_27437 WHERE "Democratic" = '42.5%' | wikisql |
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER,
Budget_Type_Code CHAR(15),
Document_Details VARCHAR(255)
)
CREATE TABLE Documents (
Document_ID INTEGER,
Document_Type_Code CHAR(15),
Project_ID INTEGER,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Descript... | Return a bar chart to show how many documents for different budget type code, show from low to high by the total number. | SELECT T1.Budget_Type_Code, COUNT(T1.Budget_Type_Code) FROM Documents_with_Expenses AS T1 JOIN Ref_Budget_Codes AS T2 ON T1.Budget_Type_Code = T2.Budget_Type_Code GROUP BY T1.Budget_Type_Code ORDER BY COUNT(T1.Budget_Type_Code) | nvbench |
CREATE TABLE table_599 (
"No" real,
"Player" text,
"Height" text,
"Position" text,
"Year born" real,
"Current Club" text
) | How many players wore number 8? | SELECT COUNT("Height") FROM table_599 WHERE "No" = '8' | wikisql |
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... | how many patients whose ethnicity is white - russian? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "WHITE - RUSSIAN" | mimicsql_data |
CREATE TABLE party_forms (
party_id number,
form_id number,
date_completion_started time,
form_status_code text,
date_fully_completed time
)
CREATE TABLE forms (
form_id number,
form_type_code text,
service_id number,
form_number text,
form_name text,
form_description text
)... | What are the names of organizations, ordered by the date they were formed, ascending? | SELECT organization_name FROM organizations ORDER BY date_formed | spider |
CREATE TABLE phone_market (
market_id number,
phone_id text,
num_of_stock number
)
CREATE TABLE phone (
name text,
phone_id number,
memory_in_g number,
carrier text,
price number
)
CREATE TABLE market (
market_id number,
district text,
num_of_employees number,
num_of_sh... | Show the names of phones that are on market with number of shops greater than 50. | SELECT T3.name FROM phone_market AS T1 JOIN market AS T2 ON T1.market_id = T2.market_id JOIN phone AS T3 ON T1.phone_id = T3.phone_id WHERE T2.num_of_shops > 50 | spider |
CREATE TABLE table_33613 (
"Approximate Age" text,
"Virtues" text,
"Psycho Social Crisis" text,
"Significant Relationship" text,
"Existential Question [ not in citation given ]" text,
"Examples" text
) | What Virtue looks at the intimacy vs. isolation crisis? | SELECT "Virtues" FROM table_33613 WHERE "Psycho Social Crisis" = 'intimacy vs. isolation' | wikisql |
CREATE TABLE table_45805 (
"Pick" real,
"Player" text,
"Nationality" text,
"New WNBA Team" text,
"Former WNBA Team" text,
"College/Country/Team" text
) | What was the college team of the player whose former WNBA team was the Cleveland Rockers? | SELECT "College/Country/Team" FROM table_45805 WHERE "Former WNBA Team" = 'cleveland rockers' | wikisql |
CREATE TABLE writes (
paperid int,
authorid int
)
CREATE TABLE journal (
journalid int,
journalname varchar
)
CREATE TABLE field (
fieldid int
)
CREATE TABLE dataset (
datasetid int,
datasetname varchar
)
CREATE TABLE author (
authorid int,
authorname varchar
)
CREATE TABLE pape... | keyphrases used by mirella lapata | SELECT DISTINCT keyphrase.keyphraseid FROM author, keyphrase, paper, paperkeyphrase, writes WHERE author.authorname = 'mirella lapata' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid | scholar |
CREATE TABLE companies (
id number,
name text,
headquarters text,
industry text,
sales_billion number,
profits_billion number,
assets_billion number,
market_value_billion text
)
CREATE TABLE buildings (
id number,
name text,
city text,
height number,
stories number,
... | Find the maximum and minimum sales of the companies that are not in the 'Banking' industry. | SELECT MAX(sales_billion), MIN(sales_billion) FROM companies WHERE industry <> "Banking" | spider |
CREATE TABLE table_30799 (
"Player" text,
"Matches" real,
"Overs" text,
"Wickets" real,
"Average" text,
"Economy" text,
"BBI" text,
"4wi" real
) | What the number of matches when the BBI is 3/27? | SELECT MIN("Matches") FROM table_30799 WHERE "BBI" = '3/27' | wikisql |
CREATE TABLE table_name_69 (
method VARCHAR,
record VARCHAR
) | What is the method of the match with a 3-4 record? | SELECT method FROM table_name_69 WHERE record = "3-4" | sql_create_context |
CREATE TABLE table_name_43 (
away_team VARCHAR,
venue VARCHAR
) | What is the away team that plays at Punt Road Oval? | SELECT away_team AS score FROM table_name_43 WHERE venue = "punt road oval" | sql_create_context |
CREATE TABLE table_9718 (
"Rider" text,
"Manufacturer" text,
"Laps" real,
"Time" text,
"Grid" real
) | What is the lowest Grid, when Laps is 21, when Manufacturer is Yamaha, and when Time is +18.802? | SELECT MIN("Grid") FROM table_9718 WHERE "Laps" = '21' AND "Manufacturer" = 'yamaha' AND "Time" = '+18.802' | wikisql |
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
... | what were the marital status of patient 28277 on the first hospital visit? | SELECT admissions.marital_status FROM admissions WHERE admissions.subject_id = 28277 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1 | mimic_iii |
CREATE TABLE Ref_Address_Types (
address_type_code VARCHAR(15),
address_type_description VARCHAR(80)
)
CREATE TABLE Detention (
detention_id INTEGER,
detention_type_code VARCHAR(10),
teacher_id INTEGER,
datetime_detention_start DATETIME,
datetime_detention_end DATETIME,
detention_summar... | Visualize a bar chart about the distribution of date_address_to and the sum of monthly_rental , and group by attribute other_details and bin date_address_to by weekday. | SELECT date_address_to, SUM(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC | nvbench |
CREATE TABLE candidate_assessments (
candidate_id VARCHAR,
assessment_date VARCHAR
) | Find id of the candidate who most recently accessed the course? | SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1 | sql_create_context |
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TABLE flight_fare (
flight_id int,
fare_id int
)
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fare int
)
CREATE TABLE equipment_sequence (... | what is the earliest nonstop flight from WASHINGTON to SAN FRANCISCO | 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 (((flight.stops = 0) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.to_airport = AIRPORT_SERVICE_1.airport_... | atis |
CREATE TABLE table_name_43 (
player VARCHAR,
year_s__won VARCHAR,
total VARCHAR,
to_par VARCHAR
) | If 1967 is the winning year and a player has a total recorded as wd with a To par under 16, what's the players name? | SELECT player FROM table_name_43 WHERE total = "wd" AND to_par < 16 AND year_s__won = "1967" | sql_create_context |
CREATE TABLE game (
stadium_id int,
id int,
Season int,
Date text,
Home_team text,
Away_team text,
Score text,
Competition text
)
CREATE TABLE stadium (
id int,
name text,
Home_Games int,
Average_Attendance real,
Total_Attendance real,
Capacity_Percentage real
)
... | I want to see trend the number of season over season by Home_team, show x-axis in ascending order. | SELECT Season, COUNT(Season) FROM game GROUP BY Home_team, Season ORDER BY Season | nvbench |
CREATE TABLE table_37127 (
"Episode No." text,
"Episode Title" text,
"UK Broadcast Date" text,
"Presenter" text,
"Details of Journey" text,
"Countries Visited" text
) | Which episode number visited India? | SELECT "Episode No." FROM table_37127 WHERE "Countries Visited" = 'india' | wikisql |
CREATE TABLE College (
cName varchar(20),
state varchar(2),
enr numeric(5,0)
)
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)
) | Visualize a pie chart about the proportion of cName and enr. | SELECT cName, enr FROM College ORDER BY enr | nvbench |
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate time,
Score number,
ViewCount number,
Body text,
OwnerUserId number,
OwnerDisplayName text,
LastEditorUserId number,
LastEditorDisplayName text... | Users by Location and Tag. | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", u.Id AS "user_link", u.Reputation, COUNT(p.Id) FROM Users AS u INNER JOIN Posts AS p ON p.OwnerUserId = u.Id INNER JOIN PostTags AS pt ON pt.PostId = p.Id INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE LOWER(Location) LIKE LOWER('%##Location##%') AND t.TagName ... | sede |
CREATE TABLE table_name_73 (
match INTEGER,
draw INTEGER
) | What is the sum for the match with a draw less than 0? | SELECT SUM(match) FROM table_name_73 WHERE draw < 0 | sql_create_context |
CREATE TABLE table_name_82 (
score VARCHAR,
date VARCHAR
) | what was the score on 6 june 2010? | SELECT score FROM table_name_82 WHERE date = "6 june 2010" | sql_create_context |
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost numb... | have patient 18159 been prescribed filgrastim, albuterol 0.083% neb soln or labetalol hcl in 12/2105? | SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18159) AND prescriptions.drug IN ('albuterol 0.083% neb soln', 'labetalol hcl', 'filgrastim') AND STRFTIME('%y-%m', prescriptions.startdate) = '2105-12' | mimic_iii |
CREATE TABLE table_1566848_7 (
date VARCHAR,
pictorials VARCHAR
) | What is the date of the issue where the pictorials is of Female s disk jockey? | SELECT COUNT(date) FROM table_1566848_7 WHERE pictorials = "Female s disk jockey" | sql_create_context |
CREATE TABLE table_50758 (
"Class" text,
"Wheel arrangement" text,
"Fleet number(s)" text,
"Manufacturer" text,
"Year made" text,
"Quantity made" text,
"Quantity preserved" text
) | What fleet number had 3 made? | SELECT "Fleet number(s)" FROM table_50758 WHERE "Quantity made" = '3' | wikisql |
CREATE TABLE table_34284 (
"Administrative division" text,
"Area (km\u00b2)" real,
"Population 2000 Census" real,
"Population (2010 Census)" real,
"Population density 2010 (/km\u00b2)" real
) | What was the sum of the population in 2010 for the division of japeri with an area of 82.9 squared km? | SELECT SUM("Population (2010 Census)") FROM table_34284 WHERE "Administrative division" = 'japeri' AND "Area (km\u00b2)" < '82.9' | wikisql |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid nu... | how many patients in 2100 were prescribed furosemide inj? | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'furosemide inj' AND STRFTIME('%y', medication.drugstarttime) = '2100') | eicu |
CREATE TABLE tryout (
cName VARCHAR,
decision VARCHAR
)
CREATE TABLE college (
state VARCHAR,
cName VARCHAR
) | Find the states where have some college students in tryout and their decisions are yes. | SELECT DISTINCT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.decision = 'yes' | sql_create_context |
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minutes_distant int
)
CREATE TABLE airport (
airport_code varchar,
airport_name text,
airport_location text,
state_code varchar,
country_name varchar,
time_zone_code... | flying from PITTSBURGH to ATLANTA on 9 4 what would be the cheapest flight | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, airport_service AS AIRPORT_SERVICE_3, city AS CITY_0, city AS CITY_1, city AS CITY_2, city AS CITY_3, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, da... | atis |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE diagnosis (
diag... | did patient 015-33415 be prescribed midazolam, magnesium sulf 2 g/50 ml ns, or amiodarone 200 mg tab last year? | SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-33415')) AND medication.drugname IN ('midazolam', 'magnesium sulf 2 g/... | eicu |
CREATE TABLE table_name_78 (
time_retired VARCHAR,
laps VARCHAR,
rider VARCHAR
) | Which Time/Retired has Laps smaller than 14, and a Rider of darren barton? | SELECT time_retired FROM table_name_78 WHERE laps < 14 AND rider = "darren barton" | sql_create_context |
CREATE TABLE table_204_577 (
id number,
"name" text,
"first operational" text,
"numeral system" text,
"computing mechanism" text,
"programming" text,
"turing complete" text
) | what is the number of computers first operational in 1944 ? | SELECT COUNT("name") FROM table_204_577 WHERE "first operational" = 1944 | squall |
CREATE TABLE table_47571 (
"City" text,
"Country" text,
"IATA" text,
"ICAO" text,
"Airport" text
) | Which airport's ICAO is rpvi? | SELECT "Airport" FROM table_47571 WHERE "ICAO" = 'rpvi' | wikisql |
CREATE TABLE table_name_69 (
appliances VARCHAR,
location VARCHAR
) | What is the appliance at the station in St Neots? | SELECT appliances FROM table_name_69 WHERE location = "st neots" | sql_create_context |
CREATE TABLE table_name_9 (
total INTEGER,
nation VARCHAR
) | How many total medals for the netherlands? | SELECT SUM(total) FROM table_name_9 WHERE nation = "netherlands" | sql_create_context |
CREATE TABLE table_18107 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" real,
"Results" text,
"Candidates" text
) | Which district is Joe Moakley? | SELECT "District" FROM table_18107 WHERE "Incumbent" = 'Joe Moakley' | wikisql |
CREATE TABLE Has_amenity (
dormid INTEGER,
amenid INTEGER
)
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 Lives_in (
stuid INTEGER,
dormid INTE... | Draw a bar chart for what is the average age for each city and what are those cities? | SELECT city_code, AVG(Age) FROM Student GROUP BY city_code | nvbench |
CREATE TABLE table_72191 (
"Year" real,
"Championship" text,
"54 holes" text,
"Winning score" text,
"Margin" text,
"Runner(s)-up" text
) | what's the championship where 54 holes is 1 shot lead and runner(s)-up is chris dimarco | SELECT "Championship" FROM table_72191 WHERE "54 holes" = '1 shot lead' AND "Runner(s)-up" = 'Chris DiMarco' | wikisql |
CREATE TABLE table_53613 (
"Year" text,
"Driver" text,
"Constructor" text,
"Location" text,
"Report" text
) | When was a report not held? | SELECT "Year" FROM table_53613 WHERE "Report" = 'not held' | wikisql |
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number... | Average score of questions (per day, between dates). | SELECT DATE(p.CreationDate), AVG(CAST(p.Score AS FLOAT)) FROM Posts AS p WHERE p.PostTypeId = 1 AND p.CreationDate >= '##Date1##' AND p.CreationDate <= '##Date2##' GROUP BY DATE(p.CreationDate) ORDER BY DATE(p.CreationDate) | sede |
CREATE TABLE table_name_37 (
score VARCHAR,
record VARCHAR
) | What was the score with a 16 14 6 record? | SELECT score FROM table_name_37 WHERE record = "16–14–6" | sql_create_context |
CREATE TABLE table_name_49 (
pick INTEGER,
round VARCHAR,
overall VARCHAR,
name VARCHAR
) | what is the pick for alfred morris when the overall is less than 217, and the round is smaller than 6? | SELECT MAX(pick) FROM table_name_49 WHERE overall < 217 AND name = "alfred morris" AND round < 6 | sql_create_context |
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
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 jobs (
JOB_ID varchar(10),
JOB_... | For all employees who have the letters D or S in their first name, return a bar chart about the distribution of hire_date and the average of manager_id bin hire_date by weekday. | SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' | nvbench |
CREATE TABLE table_name_33 (
season VARCHAR,
average_series_rating VARCHAR
) | Which show has a season premiere with a Average series rating of 1.85 million viewers? | SELECT season AS premiere FROM table_name_33 WHERE average_series_rating = "1.85 million viewers" | 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 demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | give me the number of patients whose admission year is less than 2176 and lab test abnormal status is delta? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2176" AND lab.flag = "delta" | mimicsql_data |
CREATE TABLE table_45509 (
"Pinnacle height" text,
"Year" real,
"Structure type" text,
"Main use" text,
"Country" text,
"Town" text
) | What is the main use of the structure that was in redfield, arkansas before 2004? | SELECT "Main use" FROM table_45509 WHERE "Year" < '2004' AND "Town" = 'redfield, arkansas' | wikisql |
CREATE TABLE table_1338 (
"Series #" real,
"Season #" real,
"Title" text,
"Directed by:" text,
"Written by:" text,
"Original air date" text
) | What is the original airdate when the season number is 4? | SELECT "Original air date" FROM table_1338 WHERE "Season #" = '4' | wikisql |
CREATE TABLE table_name_9 (
record_set VARCHAR,
superlative VARCHAR
) | Who set the record for youngest nominee? | SELECT record_set FROM table_name_9 WHERE superlative = "youngest nominee" | sql_create_context |
CREATE TABLE table_13172 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" real
) | What is the highest attendance for December 3, 1972 after week 12? | SELECT MAX("Attendance") FROM table_13172 WHERE "Date" = 'december 3, 1972' AND "Week" > '12' | 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,... | provide the number of patients whose year of birth is less than 2052 and lab test name is alanine aminotransferase (alt)? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2052" AND lab.label = "Alanine Aminotransferase (ALT)" | mimicsql_data |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
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
... | until 26 months ago, when was the first prescription time of patient 21074? | SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 21074) AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-26 month') ORDER BY prescriptions.startdate LIMIT 1 | mimic_iii |
CREATE TABLE table_name_44 (
grand_finaldate VARCHAR,
score VARCHAR
) | What is the grand final date for the game with a score or 30-24? | SELECT grand_finaldate FROM table_name_44 WHERE score = "30-24" | sql_create_context |
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
CREATE TABLE student_record (
student_id int,
course_id int,
semester int,
... | What Intro to Biostat courses satisfy the Other requirement ? | SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (area.area LIKE '%Intro to Biostat%' OR course.description LIKE '%Intro to Biostat%' OR course.name LIKE '%Intro t... | advising |
CREATE TABLE table_name_33 (
decision VARCHAR,
home VARCHAR
) | Who made the decision when atlanta was the home team? | SELECT decision FROM table_name_33 WHERE home = "atlanta" | sql_create_context |
CREATE TABLE table_2150068_1 (
decay VARCHAR,
nssdc_id VARCHAR
) | What is the decay for the sattelite with an id that is 1990-081c? | SELECT decay FROM table_2150068_1 WHERE nssdc_id = "1990-081C" | sql_create_context |
CREATE TABLE table_name_84 (
points INTEGER,
attendance VARCHAR,
home VARCHAR,
date VARCHAR
) | What is the sum of Points, when Home is 'Pittsburgh', when Date is 'December 21', and when Attendance is greater than 5,307? | SELECT SUM(points) FROM table_name_84 WHERE home = "pittsburgh" AND date = "december 21" AND attendance > 5 OFFSET 307 | sql_create_context |
CREATE TABLE zyjzjlb (
CYBQDM text,
CYBQMC text,
CYCWH text,
CYKSDM text,
CYKSMC text,
CYSJ time,
CYZTDM number,
HZXM text,
JZKSDM text,
JZKSMC text,
JZLSH text,
KH text,
KLX number,
MZBMLX number,
MZJZLSH text,
MZZDBM text,
MZZDMC text,
MZZYZDZZBM... | 在18年2月11日至18年6月8日内所有检验报告单中的标本采集部位患者78981064的是都在哪? | SELECT jybgb.BBCJBW FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND person_info_hz_info.KH = hz_info.KH AND pe... | css |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospit... | how did patient 006-36108 first get admitted in the hospital since 2 years ago? | SELECT patient.hospitaladmitsource FROM patient WHERE patient.uniquepid = '006-36108' AND DATETIME(patient.hospitaladmittime) >= DATETIME(CURRENT_TIME(), '-2 year') ORDER BY patient.hospitaladmittime LIMIT 1 | eicu |
CREATE TABLE table_name_97 (
honor VARCHAR,
singular VARCHAR
) | What is Honor, when Singular is r (his/her/its)? | SELECT honor FROM table_name_97 WHERE singular = "ẽr (his/her/its)" | sql_create_context |
CREATE TABLE table_train_38 (
"id" int,
"left_ventricular_ejection_fraction_lvef" int,
"child_pugh_class" string,
"systolic_blood_pressure_sbp" int,
"heart_disease" bool,
"acute_hepatitis" bool,
"liver_disease" bool,
"heart_rate" int,
"NOUSE" float
) | acute hepatitis or severe liver disease ( child pugh class c ) | SELECT * FROM table_train_38 WHERE acute_hepatitis = 1 OR liver_disease = 1 OR child_pugh_class = 'c' | criteria2sql |
CREATE TABLE table_53172 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Date" text
) | What is the date of the game where St Kilda is the home team? | SELECT "Date" FROM table_53172 WHERE "Home team" = 'st kilda' | wikisql |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
CREATE TABLE jyjgzbb (
BGDH text,
BGRQ time,
CKZFWDX text,
CKZFWSX number,
CKZFWXX number,
JCFF text,
JCRGH text,
JCRXM text,
JCXMMC text,
JCZBDM text,
JCZBJGDL number,
JCZBJGDW text,
... | 查询在2004年12月3日到2010年2月6日期间医院2121304有多少科室在门诊就诊中开了多于21张检验报告单 | SELECT COUNT(*) FROM (SELECT jybgb.KSBM FROM wdmzjzjlb JOIN jybgb ON wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE wdmzjzjlb.YLJGDM = '2121304' AND jybgb.BGRQ BETWEEN '2004-12-03' AND '2010-02-06' GROUP BY jybgb.KSBM HAVING COUNT(*) > 21 UNION SELECT jybgb.KSBM FROM bdmzjzjlb J... | css |
CREATE TABLE table_10407 (
"Year" text,
"Name" text,
"Film" text,
"Role" text,
"Status" text
) | When the role is role what was the status? | SELECT "Status" FROM table_10407 WHERE "Role" = 'role' | wikisql |
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TI... | For those employees who was hired before 2002-06-21, show me about the correlation between employee_id and salary in a scatter chart. | SELECT EMPLOYEE_ID, SALARY FROM employees WHERE HIRE_DATE < '2002-06-21' | nvbench |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
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,... | what was the specimen test that patient 58028 last received until 02/2104? | SELECT microbiologyevents.spec_type_desc FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 58028) AND STRFTIME('%y-%m', microbiologyevents.charttime) <= '2104-02' ORDER BY microbiologyevents.charttime DESC LIMIT 1 | mimic_iii |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE vitalperiodic (
vitalp... | when did patient 025-30850 last have their maximum heartrate since 622 days ago? | SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-30850')) AND NOT vitalperiodic.heartrate IS NUL... | eicu |
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Descri... | Answer score by post length. Groups posts of varying length together by answer score for a given user. | SELECT p.Score AS AnswerScore, SUM(CASE WHEN LENGTH(p.Body) <= 200 THEN 1 ELSE 0 END) AS PostsWithLen_0_200, SUM(CASE WHEN LENGTH(p.Body) BETWEEN 201 AND 500 THEN 1 ELSE 0 END) AS PostsWithLen_201_500, SUM(CASE WHEN LENGTH(p.Body) BETWEEN 501 AND 1000 THEN 1 ELSE 0 END) AS PostsWithLen_501_1000, SUM(CASE WHEN LENGTH(p.... | sede |
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 demographic (... | how many patients whose insurance is private and admission location is transfer from hosp/extram? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Private" AND demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" | mimicsql_data |
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... | has patient 013-29301 undergone a stress ulcer prophylaxis - esomeprazole procedure in this year? | SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-29301')) AND treatment.treatmentname = 'stress ulcer prophylaxis - esome... | eicu |
CREATE TABLE table_204_604 (
id number,
"year" number,
"date" text,
"driver" text,
"team" text,
"manufacturer" text,
"race distance\nlaps" number,
"race distance\nmiles (km)" text,
"race time" text,
"average speed\n(mph)" number,
"report" text
) | what was the race time in 2004 ? | SELECT "race time" FROM table_204_604 WHERE "year" = 2004 | squall |
CREATE TABLE table_name_71 (
year INTEGER,
mixed_doubles VARCHAR
) | What is the average year with Nathan Robertson Gail Emms in mixed doubles? | SELECT AVG(year) FROM table_name_71 WHERE mixed_doubles = "nathan robertson gail emms" | sql_create_context |
CREATE TABLE table_name_84 (
site VARCHAR,
opponent VARCHAR,
date VARCHAR
) | Where was the game on Thursday, April 29, and they played the Chicago Cubs? | SELECT site FROM table_name_84 WHERE opponent = "chicago cubs" AND date = "thursday, april 29" | sql_create_context |
CREATE TABLE table_name_24 (
record VARCHAR,
home VARCHAR
) | What is the record for the game when the Dallas Mavericks was the home team? | SELECT record FROM table_name_24 WHERE home = "dallas mavericks" | sql_create_context |
CREATE TABLE table_45800 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"Record" text,
"Streak" text
) | Which Game has a Score of 122 125? | SELECT "Game" FROM table_45800 WHERE "Score" = '122–125' | wikisql |
CREATE TABLE table_8790 (
"Margin" real,
"Score" text,
"Winning Team" text,
"Losing Team" text,
"Venue" text,
"Date" text
) | What is the Margin, when Date is 19 July 2008 (Round 19)? | SELECT "Margin" FROM table_8790 WHERE "Date" = '19 july 2008 (round 19)' | wikisql |
CREATE TABLE t_kc21_t_kc22 (
MED_CLINIC_ID text,
MED_EXP_DET_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,
C... | 名叫花心宜的团伙成员最常开的药品排序是怎么样的呢? | SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_NM = '花心宜' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC | css |
CREATE TABLE table_68456 (
"Outcome" text,
"Date" text,
"Surface" text,
"Opponent" text,
"Score" text
) | What is the surface of the match when the outcome was runner-up, and a Score of julia g rges polona hercog? | SELECT "Surface" FROM table_68456 WHERE "Outcome" = 'runner-up' AND "Score" = 'julia görges polona hercog' | wikisql |
CREATE TABLE table_name_71 (
venue VARCHAR,
runs VARCHAR
) | Where is the venue with more than 245 runs? | SELECT venue FROM table_name_71 WHERE runs = "245" | sql_create_context |
CREATE TABLE table_66933 (
"Stage" text,
"Time (EEST)" text,
"Name" text,
"Length" text,
"Winner" text,
"Time" text,
"Avg. spd." text,
"Rally leader" text
) | What is the Length, when the Name is Himos? | SELECT "Length" FROM table_66933 WHERE "Name" = 'himos' | wikisql |
CREATE TABLE table_26680 (
"Region/Country" text,
"Local name" text,
"Main presenter" text,
"Network" text,
"Year premiered" real
) | What is the highest year premiered for the TV2 network when main present is yvind mund? | SELECT MAX("Year premiered") FROM table_26680 WHERE "Network" = 'TV2' AND "Main presenter" = 'Øyvind Mund' | wikisql |
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE diagnoses_icd (
row_id numbe... | what were the four most frequently taken lab tests until 1 year ago for patients with age 30s? | SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t1.itemid FROM (SELECT labevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 30 AND 39) AND DATETIME(labevents.chartti... | mimic_iii |
CREATE TABLE table_19061741_3 (
age VARCHAR,
edition VARCHAR,
home_or_representative_town_or_province VARCHAR
) | When davao city is the home or representative town or province and clash 2010 is the edition how many ages are there? | SELECT COUNT(age) FROM table_19061741_3 WHERE edition = "Clash 2010" AND home_or_representative_town_or_province = "Davao City" | sql_create_context |
CREATE TABLE table_31101 (
"Week of" text,
"Tournament" text,
"Champion" text,
"Runner-up" text,
"Semifinalists" text,
"Quarterfinalists" text
) | In the week of what was the runner-up Pat Du Pr ? | SELECT "Week of" FROM table_31101 WHERE "Runner-up" = 'Pat Du Pré' | wikisql |
CREATE TABLE assets (
asset_id number,
other_details text
)
CREATE TABLE products_in_events (
product_in_event_id number,
event_id number,
product_id number
)
CREATE TABLE agreements (
document_id number,
event_id number
)
CREATE TABLE events (
event_id number,
address_id number,
... | What are the names and type codes of products? | SELECT product_name, product_type_code FROM products | spider |
CREATE TABLE table_name_27 (
viewers__in_millions_ VARCHAR,
finale VARCHAR
) | How many people tuned in to the finale on May 16, 2007? | SELECT COUNT(viewers__in_millions_) FROM table_name_27 WHERE finale = "may 16, 2007" | sql_create_context |
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 ... | in the previous month when did patient 51177 last receive the ptt test? | SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'ptt') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 51177) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TI... | mimic_iii |
CREATE TABLE table_name_69 (
laps INTEGER,
driver VARCHAR
) | How many laps did Ricardo Zonta have? | SELECT SUM(laps) FROM table_name_69 WHERE driver = "ricardo zonta" | sql_create_context |
CREATE TABLE bdmzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH number,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
KH text,
KLX number,
MJZH text,
ML number,
MZZYZDZZBM text,
MZZYZDZ... | 列出在2007年3月19日到2009年3月8日内患者22871857所有检验报告单什么时候审核的? | SELECT jybgb.SHSJ FROM hz_info JOIN wdmzjzjlb JOIN jybgb ON 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 WHERE hz_info.RYBH = '22871857' AND jybgb.BGRQ BETWEEN '2007-03-19' AND '2009-... | css |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.