instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
CREATE TABLE table_name_56 (
circuit VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Circuit is on July 24?
| SELECT circuit FROM table_name_56 WHERE date = "july 24" | sql_create_context |
CREATE TABLE table_78525 (
"Superlative" text,
"Actor" text,
"Record Set" text,
"Year" text,
"Notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What year was the the youngest nominee a winner?
| SELECT "Year" FROM table_78525 WHERE "Superlative" = 'youngest nominee' | wikisql |
CREATE TABLE Participants (
Participant_ID VARCHAR,
Participant_Type_Code VARCHAR,
Participant_Details VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are all the the participant ids, type code and details?
| SELECT Participant_ID, Participant_Type_Code, Participant_Details FROM Participants | sql_create_context |
CREATE TABLE table_name_92 (
award_category VARCHAR,
nominated_won VARCHAR,
year VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- In what category was an award won in 2007?
| SELECT award_category FROM table_name_92 WHERE nominated_won = "won" AND year = 2007 | sql_create_context |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
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 t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/HAITIAN" AND demographic.dob_year < "2089" | mimicsql_data |
CREATE TABLE table_name_48 (
november VARCHAR,
february VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who is in November where February is willy rey?
| SELECT november FROM table_name_48 WHERE february = "willy rey" | sql_create_context |
CREATE TABLE table_62712 (
"Year" real,
"Class" text,
"Team" text,
"Machine" text,
"Points" real,
"Rank" text,
"Wins" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many wins for the year that is later than 1987 and has points less than ... | SELECT "Wins" FROM table_62712 WHERE "Year" > '1987' AND "Points" < '188' | wikisql |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
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... | SELECT t2.drug FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 61591 AND procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_proce... | mimic_iii |
CREATE TABLE table_name_68 (
total INTEGER,
silver VARCHAR,
nation VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many medals for spain with 1 silver?
| SELECT SUM(total) FROM table_name_68 WHERE silver = "1" AND nation = "spain" | sql_create_context |
CREATE TABLE t_kc21_t_kc22 (
MED_CLINIC_ID text,
MED_EXP_DET_ID number
)
CREATE TABLE t_kc21 (
CLINIC_ID text,
CLINIC_TYPE text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD ... | SELECT t_kc22.CHA_ITEM_LEV FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '46007129869' AND t_kc22.SOC_SRT_DIRE_CD = '209344' | css |
CREATE TABLE table_21969 (
"Parish (Prestegjeld)" text,
"Sub-Parish (Sokn)" text,
"Church Name" text,
"Year Built" real,
"Location of the Church" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the parish for 1908
| SELECT "Parish (Prestegjeld)" FROM table_21969 WHERE "Year Built" = '1908' | wikisql |
CREATE TABLE table_name_99 (
against INTEGER,
byes INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which against has the lowest when byes are larger than 0?
| SELECT MIN(against) FROM table_name_99 WHERE byes > 0 | sql_create_context |
CREATE TABLE table_name_42 (
record VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Can you tell me the Record that has the Date of december 15?
| SELECT record FROM table_name_42 WHERE date = "december 15" | sql_create_context |
CREATE TABLE table_name_39 (
sub_parish__sokn_ VARCHAR,
location_of_the_church VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Sub-Parish called that has a church located in Fresvik?
| SELECT sub_parish__sokn_ FROM table_name_39 WHERE location_of_the_church = "fresvik" | sql_create_context |
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Percent text,
ACC_Home text,
ACC_Road text,
All_Games text,
All_Games_Percent int,
All_Home text,
All_Road text,
All_Neutral text
)
CREATE TABLE university (
Scho... | SELECT Team_Name, All_Games_Percent FROM basketball_match ORDER BY Team_Name DESC | nvbench |
CREATE TABLE table_name_33 (
rank INTEGER,
total VARCHAR,
bronze VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Rank has a Total of 1 and a Bronze larger than 0?
| SELECT MAX(rank) FROM table_name_33 WHERE total = 1 AND bronze > 0 | sql_create_context |
CREATE TABLE table_11602885_1 (
date VARCHAR,
location VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When was the game in Mexico played?
| SELECT date FROM table_11602885_1 WHERE location = "Mexico" | sql_create_context |
CREATE TABLE table_name_23 (
home_team VARCHAR,
venue VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the home side's score at western oval?
| SELECT home_team AS score FROM table_name_23 WHERE venue = "western oval" | sql_create_context |
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
UserId number,
UserDisplayName text,
Comment text,
Text text,
ContentLicense text
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous... | SELECT DATEFROMPARTS(YEAR(P.CreationDate), MONTH(P.CreationDate), 1) AS PostMonth, COUNT(*) AS TagCount FROM Posts AS P WHERE PostTypeId = 1 AND P.Tags LIKE @TagName GROUP BY YEAR(P.CreationDate), MONTH(P.CreationDate) ORDER BY PostMonth | sede |
CREATE TABLE table_69156 (
"Club" text,
"Played" text,
"Drawn" text,
"Lost" text,
"Points for" text,
"Points against" text,
"Tries for" text,
"Tries against" text,
"Try bonus" text,
"Losing bonus" text,
"Points" text
)
-- Using valid SQLite, answer the following questions f... | SELECT "Points against" FROM table_69156 WHERE "Tries against" = '77' AND "Lost" = '16' | wikisql |
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_careunit text,
last_careunit text,
first_wardid number,
last_wardid number,
intime time,
outtime ti... | SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'inject/inf thrombo agent') AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') | mimic_iii |
CREATE TABLE table_32053 (
"Title" text,
"Year" real,
"ISBN" text,
"Volume" text,
"Strips" text,
"Pages" real,
"Colors" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- I want the average pages for ISBN of 978-0-9766580-5-4
| SELECT AVG("Pages") FROM table_32053 WHERE "ISBN" = '978-0-9766580-5-4' | wikisql |
CREATE TABLE table_65911 (
"Rank" real,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest number of gold medals won by a team that won fewer than 2 silver and few... | SELECT MAX("Gold") FROM table_65911 WHERE "Silver" < '2' AND "Bronze" < '4' | wikisql |
CREATE TABLE table_15890 (
"Player" text,
"Years Played" text,
"Total W-L" text,
"Singles W-L" text,
"Doubles W-L" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what's the doubles w-l for player seol jae-min (none)
| SELECT "Doubles W-L" FROM table_15890 WHERE "Player" = 'Seol Jae-Min (none)' | wikisql |
CREATE TABLE table_name_89 (
record VARCHAR,
february VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the record after the game on Feb 10?
| SELECT record FROM table_name_89 WHERE february = 10 | sql_create_context |
CREATE TABLE table_203_485 (
id number,
"year" text,
"show" text,
"role" text,
"notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- which was the only television show gauri starred in , in which she played herself ?
| SELECT "show" FROM table_203_485 WHERE "role" = 'herself' | squall |
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Descr... | SELECT * FROM Users WHERE Id = '1' | sede |
CREATE TABLE t_kc22 (
AMOUNT number,
CHA_ITEM_LEV number,
DATA_ID text,
DIRE_TYPE number,
DOSE_FORM text,
DOSE_UNIT text,
EACH_DOSAGE text,
EXP_OCC_DATE time,
FLX_MED_ORG_ID text,
FXBZ number,
HOSP_DOC_CD text,
HOSP_DOC_NM text,
MED_DIRE_CD text,
MED_DIRE_NM text,... | SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_NM = '孙祺然' AND NOT t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT <= 9192.27) | css |
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE Badges (
Id number,
UserId number,
Name text,
Date time,
Class number,
TagBased boolean
)
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswer... | SELECT CAST(TIME_TO_STR(Users.CreationDate, '%Y') AS TEXT(4)) + '-' + CAST(TIME_TO_STR(Users.CreationDate, '%m') AS TEXT(2)) AS month_year, COUNT(*) FROM Users GROUP BY TIME_TO_STR(Users.CreationDate, '%Y'), TIME_TO_STR(Users.CreationDate, '%m') ORDER BY TIME_TO_STR(Users.CreationDate, '%Y'), TIME_TO_STR(Users.Creation... | sede |
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE treatment (
treat... | 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 = '029-16431' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi... | eicu |
CREATE TABLE table_name_26 (
city VARCHAR,
year_joined VARCHAR,
conference_joined VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What city joined the Independents conference after 1963?
| SELECT city FROM table_name_26 WHERE year_joined > 1963 AND conference_joined = "independents" | sql_create_context |
CREATE TABLE table_name_30 (
english_name VARCHAR,
year_signed VARCHAR,
chinese_name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the English name for the Chinese name of later than 1974?
| SELECT english_name FROM table_name_30 WHERE year_signed > 1974 AND chinese_name = "蘇永康" | sql_create_context |
CREATE TABLE table_name_4 (
laps INTEGER,
grid VARCHAR,
manufacturer VARCHAR,
time_retired VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the lowest laps that has a manufacturer of yamaha, and a time/retired of +1:08.312, and a grid less than... | SELECT MIN(laps) FROM table_name_4 WHERE manufacturer = "yamaha" AND time_retired = "+1:08.312" AND grid < 20 | sql_create_context |
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Percent text,
ACC_Home text,
ACC_Road text,
All_Games text,
All_Games_Percent int,
All_Home text,
All_Road text,
All_Neutral text
)
CREATE TABLE university (
Scho... | SELECT All_Games, Team_ID FROM basketball_match | nvbench |
CREATE TABLE table_name_47 (
length___ft__ VARCHAR,
length___m__ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the length in feet when the length in meters is 64.2?
| SELECT length___ft__ FROM table_name_47 WHERE length___m__ = "64.2" | sql_create_context |
CREATE TABLE table_name_33 (
d_41 VARCHAR,
r_51 VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Tell me the D 41 and R 51 of r 11
| SELECT d_41 FROM table_name_33 WHERE r_51 = "r 11" | sql_create_context |
CREATE TABLE candidate (
Candidate_ID int,
People_ID int,
Poll_Source text,
Date text,
Support_rate real,
Consider_rate real,
Oppose_rate real,
Unsure_rate real
)
CREATE TABLE people (
People_ID int,
Sex text,
Name text,
Date_of_Birth text,
Height real,
Weight re... | SELECT Name, Height FROM people ORDER BY Height | nvbench |
CREATE TABLE table_44057 (
"Year" real,
"$10 \u2013 1/10 oz." text,
"$25 \u2013 1/4 oz." real,
"$50 \u2013 1/2 oz." real,
"$100 \u2013 1 oz." text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- WHAT IS THE LOWEST $50-1/2 OZ COIN WITH A 1997 YEAR AND $25-... | SELECT MIN("$50 \u2013 1/2 oz.") FROM table_44057 WHERE "Year" = '1997' AND "$25 \u2013 1/4 oz." > '27,100' | wikisql |
CREATE TABLE table_7286 (
"Position" text,
"2014" text,
"2013" text,
"2012" text,
"2011" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who held the same position in 2014 that Danielle Button held in 2013?
| SELECT "2014" FROM table_7286 WHERE "2013" = 'danielle button' | wikisql |
CREATE TABLE table_56027 (
"Rd #" real,
"Pick #" real,
"Player" text,
"Team (League)" text,
"Reg GP" real,
"Pl GP" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What's the average Rd number for dane jackson with a pick number over 44?
| SELECT AVG("Rd #") FROM table_56027 WHERE "Player" = 'dane jackson' AND "Pick #" > '44' | wikisql |
CREATE TABLE PersonFriend (
friend VARCHAR,
name VARCHAR
)
CREATE TABLE Person (
name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who are the friends of Bob?
| SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Bob' | sql_create_context |
CREATE TABLE table_name_34 (
constructor VARCHAR,
race VARCHAR,
winning_driver VARCHAR,
pole_position VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- I want the constructor for winning driver of jim clark, pole position of graham hill and dutch grand ... | SELECT constructor FROM table_name_34 WHERE winning_driver = "jim clark" AND pole_position = "graham hill" AND race = "dutch grand prix" | sql_create_context |
CREATE TABLE table_11601 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the away team's score when the Home team... | SELECT "Away team score" FROM table_11601 WHERE "Home team score" = '17.14 (116)' | wikisql |
CREATE TABLE table_name_45 (
general_classification VARCHAR,
mountains_classification VARCHAR,
points_classification VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What general classification has david de la fuente as mountains classification, and thor h... | SELECT general_classification FROM table_name_45 WHERE mountains_classification = "david de la fuente" AND points_classification = "thor hushovd" | sql_create_context |
CREATE TABLE table_4025 (
"Representative" text,
"Party" text,
"Years" text,
"Congress" text,
"District Home" text,
"Occupation" text,
"Electoral history" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What frame of time is listed under year... | SELECT "Years" FROM table_4025 WHERE "Congress" = '72nd' | wikisql |
CREATE TABLE table_name_63 (
team VARCHAR,
laps VARCHAR,
grid VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What team has more than 49 laps and a grid of 8?
| SELECT team FROM table_name_63 WHERE laps > 49 AND grid = 8 | sql_create_context |
CREATE TABLE PersonFriend (
name varchar(20),
friend varchar(20),
year INTEGER
)
CREATE TABLE Person (
name varchar(20),
age INTEGER,
city TEXT,
gender TEXT,
job TEXT
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Return a bar chart on how o... | SELECT job, MIN(age) FROM Person GROUP BY job ORDER BY job DESC | nvbench |
CREATE TABLE table_name_81 (
year VARCHAR,
pigs INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many years had fewer than 2089.2 pigs?
| SELECT COUNT(year) FROM table_name_81 WHERE pigs < 2089.2 | sql_create_context |
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
-- Using valid SQLite, answer the following questions for the... | SELECT T2.Founder, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Founder ORDER BY T1.Code DESC | nvbench |
CREATE TABLE actor (
Actor_ID int,
Name text,
Musical_ID int,
Character text,
Duration text,
age int
)
CREATE TABLE musical (
Musical_ID int,
Name text,
Year int,
Award text,
Category text,
Nominee text,
Result text
)
-- Using valid SQLite, answer the following que... | SELECT T2.Name, COUNT(*) FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID GROUP BY T1.Musical_ID ORDER BY COUNT(*) | nvbench |
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense text
)
CREATE TABLE PostsWithDeleted (
Id number,
PostTypeId number,
... | SELECT v.CreationDate, SUM(COUNT(*) * 5) OVER (ORDER BY v.CreationDate) AS score FROM Posts AS p INNER JOIN Votes AS v ON v.PostId = p.Id WHERE v.VoteTypeId = 2 AND p.PostTypeId = 1 AND p.OwnerUserId = @uid GROUP BY v.CreationDate | sede |
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 ... | SELECT admissions.age FROM admissions WHERE admissions.subject_id = 19144 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1 | mimic_iii |
CREATE TABLE invoices (
customer_id VARCHAR
)
CREATE TABLE customers (
first_name VARCHAR,
last_name VARCHAR,
id VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Find out the top 10 customers by total number of orders. List customers' first and last n... | SELECT T1.first_name, T1.last_name, COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 10 | sql_create_context |
CREATE TABLE table_name_80 (
score_points VARCHAR,
rank_points VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What Score points has a Rank points of defending champion?
| SELECT score_points FROM table_name_80 WHERE rank_points = "defending champion" | sql_create_context |
CREATE TABLE table_51587 (
"Condition" text,
"Prothrombin time" text,
"Partial thromboplastin time" text,
"Bleeding time" text,
"Platelet count" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- I want to know the condition with Prothrombin time of una... | SELECT "Condition" FROM table_51587 WHERE "Prothrombin time" = 'unaffected' AND "Bleeding time" = 'prolonged' AND "Partial thromboplastin time" = 'unaffected' AND "Platelet count" = 'decreased or unaffected' | wikisql |
CREATE TABLE table_14609295_4 (
season VARCHAR,
overall VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What season was the overall record 29-7?
| SELECT season FROM table_14609295_4 WHERE overall = "29-7" | sql_create_context |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND prescriptions.drug = "Syringe" | mimicsql_data |
CREATE TABLE table_203_287 (
id number,
"rank" number,
"area" text,
"date" text,
"presenter" text,
"seven wonders covered" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the name of the first presenter on this chart ?
| SELECT "presenter" FROM table_203_287 WHERE id = 1 | squall |
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostLinks (
Id number,
CreationDate time,
Pos... | WITH USER_BY_TAG AS (SELECT ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) AS Rank, u.Id AS "user_link", COUNT(*) AS UpVotes FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS p ON p.ParentId = pt.PostId INNER JOIN Votes AS v ON v.PostId = p.Id AND VoteTypeId = 2 INNER JOIN Users AS u ON u.Id =... | sede |
CREATE TABLE table_18003 (
"Year" real,
"Dates" text,
"Champion" text,
"Score" real,
"To par" text,
"Margin of victory" text,
"Purse ( $ )" real,
"Winners share ($)" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the most recent ... | SELECT MAX("Year") FROM table_18003 | 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... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND lab.itemid = "51492" | mimicsql_data |
CREATE TABLE t_kc24 (
MED_SAFE_PAY_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
MED_CLINIC_ID text,
REF_SLT_FLG number,
CLINIC_SLT_DATE time,
COMP_ID text,
PERSON_ID text,
FLX_MED_ORG_ID text,
INSU_TYPE text,
MED_AMOUT number,
PER_ACC_PAY number,
OVE_PAY numb... | 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.MED_SER_ORG_NO = '1033267' AND t_kc22.STA_DATE BETWEEN '2009-05-09' AND '2019-05-08' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' | css |
CREATE TABLE course (
course_id int,
name varchar,
department varchar,
number varchar,
credits varchar,
advisory_requirement varchar,
enforced_requirement varchar,
description varchar,
num_semesters int,
num_enrolled int,
has_discussion varchar,
has_lab varchar,
has_p... | SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instr... | advising |
CREATE TABLE table_73608 (
"County" text,
"Kerry%" text,
"Kerry#" real,
"Bush%" text,
"Bush#" real,
"Others%" text,
"Others#" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many different counts of the votes for Bush are there in the cou... | SELECT COUNT("Bush#") FROM table_73608 WHERE "Bush%" = '69.7%' | wikisql |
CREATE TABLE customers (
customer_details VARCHAR,
customer_id VARCHAR
)
CREATE TABLE policies (
customer_id VARCHAR,
policy_type_code VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Find the names of customers who either have an deputy policy or uni... | SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = "Deputy" OR t1.policy_type_code = "Uniform" | sql_create_context |
CREATE TABLE table_6814 (
"Position" real,
"Club" text,
"Games played" real,
"Wins" real,
"Draws" real,
"Loses" real,
"Goals scored" real,
"Goals conceded" real,
"Points" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the hig... | SELECT MAX("Games played") FROM table_6814 WHERE "Draws" = '3' AND "Loses" = '5' AND "Points" < '39' | wikisql |
CREATE TABLE table_24129 (
"Game" real,
"Date" text,
"Opponent" text,
"Result" text,
"Black Knights points" real,
"Opponents" real,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the date for 6-2 record
| SELECT "Date" FROM table_24129 WHERE "Record" = '6-2' | wikisql |
CREATE TABLE table_name_19 (
sub_parish__sokn_ VARCHAR,
year_built VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Sub-Parish has a church built in 1866?
| SELECT sub_parish__sokn_ FROM table_name_19 WHERE year_built = "1866" | sql_create_context |
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,
... | SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-24595')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput.ce... | eicu |
CREATE TABLE table_55927 (
"Position" real,
"Club" text,
"Played" real,
"Points" text,
"Wins" real,
"Draws" real,
"Losses" real,
"Goals for" real,
"Goals against" real,
"Goal Difference" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.... | SELECT COUNT("Played") FROM table_55927 WHERE "Points" = '31-7' AND "Position" = '16' AND "Goals for" < '35' | wikisql |
CREATE TABLE table_6386 (
"Rank" real,
"Name" text,
"Attempts" real,
"Net Yds" real,
"Yds/Att" real,
"Touchdowns" real,
"Long" real,
"Start" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many attempts did the player ranking with a n... | SELECT SUM("Attempts") FROM table_6386 WHERE "Start" > '1997' AND "Yds/Att" = '5' AND "Rank" > '1' | wikisql |
CREATE TABLE captain (
Captain_ID int,
Name text,
Ship_ID int,
age text,
Class text,
Rank text
)
CREATE TABLE Ship (
Ship_ID int,
Name text,
Type text,
Built_Year real,
Class text,
Flag text
)
-- Using valid SQLite, answer the following questions for the tables provide... | SELECT Class, COUNT(Class) FROM captain GROUP BY Class ORDER BY COUNT(Class) DESC | nvbench |
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId ... | SELECT p.Id, p.Title, p.Tags, COUNT(t.TagName) FROM Posts AS p INNER JOIN Tags AS t ON p.Id = t.Id WHERE P.Id = 53243136 GROUP BY p.Id, p.Title, p.Tags | sede |
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
RejectionDate time,
OwnerUserId number,
Comment text,
Text text,
Title text,
Tags text,
RevisionGUID other
)
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
... | SELECT Users.DisplayName, COUNT(Posts.Id) AS Posts, Users.DownVotes, Users.DownVotes / CAST(s.Total AS FLOAT) AS "% of All Downvotes", Users.DownVotes / CAST(COUNT(Posts.Id) AS FLOAT) AS "Downvotes/Posts", Users.DownVotes / CAST(Users.UpVotes AS FLOAT) AS "Downvotes/upvotes" FROM Users JOIN Posts ON Users.Id = Posts.Ow... | sede |
CREATE TABLE table_name_24 (
notes VARCHAR,
time___sec__ VARCHAR,
rank VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Notes have a Time larger than 23.34, and a Rank of 8?
| SELECT notes FROM table_name_24 WHERE time___sec__ > 23.34 AND rank = 8 | 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 outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
va... | SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23721) AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') | mimic_iii |
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_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE admissions (
... | SELECT COUNT(*) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14355) AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', prescriptions.startdate) = '02' | mimic_iii |
CREATE TABLE t_kc21_t_kc24 (
MED_CLINIC_ID text,
MED_SAFE_PAY_ID number
)
CREATE TABLE t_kc21 (
CLINIC_ID text,
CLINIC_TYPE text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD... | SELECT AVG(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc21_t_kc24.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_AGE > 17) | css |
CREATE TABLE table_name_62 (
number VARCHAR,
school_club_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many total players came from the school/club team of De La Salle?
| SELECT COUNT(number) FROM table_name_62 WHERE school_club_team = "de la salle" | sql_create_context |
CREATE TABLE table_204_95 (
id number,
"name" text,
"title" text,
"first year\nin this position" number,
"years at nebraska" text,
"alma mater" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- which coach started in the same year as charles armstr... | SELECT "name" FROM table_204_95 WHERE "name" <> 'charles armstrong' AND "first year\nin this position" = (SELECT "first year\nin this position" FROM table_204_95 WHERE "name" = 'charles armstrong') | squall |
CREATE TABLE table_13564637_5 (
points_for VARCHAR,
club VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What were all the points for Tonyrefail RFC?
| SELECT points_for FROM table_13564637_5 WHERE club = "Tonyrefail RFC" | sql_create_context |
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE d_items (
row_id number,
... | SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 29161) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND chartevents... | mimic_iii |
CREATE TABLE table_name_64 (
date VARCHAR,
opponents VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the date for zi yan jie zheng opponent
| SELECT date FROM table_name_64 WHERE opponents = "zi yan jie zheng" | sql_create_context |
CREATE TABLE Apartment_Facilities (
apt_id INTEGER,
facility_code CHAR(15)
)
CREATE TABLE Apartment_Bookings (
apt_booking_id INTEGER,
apt_id INTEGER,
guest_id INTEGER,
booking_status_code CHAR(15),
booking_start_date DATETIME,
booking_end_date DATETIME
)
CREATE TABLE View_Unit_Status ... | SELECT apt_number, COUNT(apt_number) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id GROUP BY apt_number ORDER BY COUNT(apt_number) | nvbench |
CREATE TABLE media_types (
id VARCHAR,
name VARCHAR
)
CREATE TABLE tracks (
name VARCHAR,
genre_id VARCHAR,
media_type_id VARCHAR
)
CREATE TABLE genres (
id VARCHAR,
name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- List the name of t... | SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = "Rock" AND T3.name = "MPEG audio file" | sql_create_context |
CREATE TABLE table_name_4 (
years_as_tallest VARCHAR,
floors INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the years as tallest when floors are larger than 18
| SELECT years_as_tallest FROM table_name_4 WHERE floors > 18 | sql_create_context |
CREATE TABLE table_name_18 (
grid INTEGER,
driver VARCHAR,
laps VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the low grid for gerhard berger for laps over 56?
| SELECT MIN(grid) FROM table_name_18 WHERE driver = "gerhard berger" AND laps > 56 | sql_create_context |
CREATE TABLE table_73390 (
"District" text,
"Vacator" text,
"Reason for change" text,
"Successor" text,
"Date successor seated" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the successor for the Kentucky 2nd district?
| SELECT "Successor" FROM table_73390 WHERE "District" = 'Kentucky 2nd' | wikisql |
CREATE TABLE jyjgzbb (
BGDH text,
BGRQ time,
CKZFWDX text,
CKZFWSX number,
CKZFWXX number,
JCFF text,
JCRGH text,
JCRXM text,
JCXMMC text,
JCZBDM text,
JCZBJGDL number,
JCZBJGDW text,
JCZBJGDX text,
JCZBMC text,
JLDW text,
JYRQ time,
JYZBLSH text,
... | 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 table_27923 (
"meas. num" real,
"passed" text,
"YES votes" real,
"NO votes" real,
"% YES" text,
"Const. Amd.?" text,
"type" text,
"description" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the result of the ballot... | SELECT "passed" FROM table_27923 WHERE "% YES" = '52.49%' | wikisql |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob... | SELECT MAX(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27656)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'temp... | mimic_iii |
CREATE TABLE table_169766_13 (
new_returning_same_network VARCHAR,
previous_network VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- For the NBC network, what was the new/returning/same network status?
| SELECT new_returning_same_network FROM table_169766_13 WHERE previous_network = "NBC" | sql_create_context |
CREATE TABLE employee (
eid number,
name text,
salary number
)
CREATE TABLE certificate (
eid number,
aid number
)
CREATE TABLE aircraft (
aid number,
name text,
distance number
)
CREATE TABLE flight (
flno number,
origin text,
destination text,
distance number,
de... | SELECT flno, distance FROM flight ORDER BY price DESC LIMIT 1 | spider |
CREATE TABLE hz_info_mzjzjlb (
JZLSH number,
YLJGDM number,
mzjzjlb_id number
)
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 t... | SELECT * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH ... | css |
CREATE TABLE table_62675 (
"Position" real,
"Team" text,
"Played" real,
"Drawn" real,
"Lost" real,
"Goals For" real,
"Goals Against" real,
"Goal Difference" text,
"Points 1" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many tim... | SELECT MIN("Lost") FROM table_62675 WHERE "Points 1" = '37' AND "Goals Against" < '60' | wikisql |
CREATE TABLE table_12040 (
"Rank" real,
"Player" text,
"Country" text,
"Earnings ( $ )" real,
"Events" real,
"Wins" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest rank of the player who played 30 events and made less than $2,... | SELECT MAX("Rank") FROM table_12040 WHERE "Earnings ( $ )" < '2,708,005' AND "Events" = '30' | wikisql |
CREATE TABLE table_30737 (
"Region name" text,
"State name" text,
"Region #" real,
"Page count" real,
"Regional Page #" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which region has a regional page # of 1-3, 5-7, 9-11, 13-15?
| SELECT "Region name" FROM table_30737 WHERE "Regional Page #" = '1-3, 5-7, 9-11, 13-15' | wikisql |
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(... | SELECT COMMISSION_PCT, DEPARTMENT_ID FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' | nvbench |
CREATE TABLE zyjzjlb (
YLJGDM text,
JZLSH text,
MZJZLSH text,
KH text,
KLX number,
HZXM text,
WDBZ number,
RYDJSJ time,
RYTJDM number,
RYTJMC text,
JZKSDM text,
JZKSMC text,
RZBQDM text,
RZBQMC text,
RYCWH text,
CYKSDM text,
CYKSMC text,
CYBQDM tex... | SELECT BGRGH, BGRXM FROM jybgb WHERE BGDH = '38449722176' | css |
CREATE TABLE Apartment_Buildings (
building_id INTEGER,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80)
)
CREATE TABLE View_Unit_Status (
apt_id INTEG... | SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id ORDER BY COUNT(booking_start_date) DESC | nvbench |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.