instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
CREATE TABLE coach (
Coach_ID int,
Coach_name text,
Gender text,
Club_ID int,
Rank int
)
CREATE TABLE match_result (
Rank int,
Club_ID int,
Gold int,
Big_Silver int,
Small_Silver int,
Bronze int,
Points int
)
CREATE TABLE club (
Club_ID int,
Club_name text,
... | SELECT Gender, COUNT(Gender) FROM player GROUP BY Gender | nvbench |
CREATE TABLE table_name_6 (
score VARCHAR,
player VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What did Phil Rodgers score?
| SELECT score FROM table_name_6 WHERE player = "phil rodgers" | sql_create_context |
CREATE TABLE table_name_17 (
cuts_made INTEGER,
top_5 VARCHAR,
top_10 VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What's the listed average of Cuts made that has a Top-5 of 3, and a Top-10 that's smaller than 5?
| SELECT AVG(cuts_made) FROM table_name_17 WHERE top_5 = 3 AND top_10 < 5 | sql_create_context |
CREATE TABLE city (
Status VARCHAR,
City_ID VARCHAR
)
CREATE TABLE farm_competition (
Host_city_ID VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Show the status of the city that has hosted the greatest number of competitions.
| SELECT T1.Status FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID ORDER BY COUNT(*) DESC LIMIT 1 | sql_create_context |
CREATE TABLE university (
School_ID int,
School text,
Location text,
Founded real,
Affiliation text,
Enrollment real,
Nickname text,
Primary_conference text
)
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Per... | SELECT ACC_Percent, All_Games_Percent FROM basketball_match GROUP BY ACC_Regular_Season | nvbench |
CREATE TABLE table_44901 (
"Game" real,
"Team" text,
"Score" text,
"Location Attendance" text,
"Series" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which team was the opponent that had a location of Madison Square Garden with a score of 87-83?
| SELECT "Team" FROM table_44901 WHERE "Location Attendance" = 'madison square garden' AND "Score" = '87-83' | wikisql |
CREATE TABLE airports (
name VARCHAR,
apid VARCHAR
)
CREATE TABLE routes (
src_apid VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Find the number of routes and airport name for each source airport, order the results by decreasing number of routes.
| SELECT COUNT(*), T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.src_apid GROUP BY T1.name ORDER BY COUNT(*) DESC | sql_create_context |
CREATE TABLE table_203_239 (
id number,
"year" number,
"title" text,
"chinese title" text,
"role" text,
"notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what film was done next after ` once a cop ' ?
| SELECT "title" FROM table_203_239 WHERE id = (SELECT id FROM table_203_239 WHERE "title" = 'once a cop') + 1 | squall |
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(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'hepatic dysfunction - with cirrhosis' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-3 ... | eicu |
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Na... | SELECT p.Id, p.PostTypeId, p.CreationDate, u.DisplayName, p.Score, p.Tags FROM Posts AS p INNER JOIN Users AS u ON p.OwnerUserId = u.Id WHERE p.Body LIKE '%cpearson.com%' ORDER BY p.CreationDate | sede |
CREATE TABLE table_13812785_5 (
high_rebounds VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was responsible and what was the number for the high rebounds on December 22?
| SELECT high_rebounds FROM table_13812785_5 WHERE date = "December 22" | sql_create_context |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.days_stay > "10" AND demographic.admityear < "2148" | mimicsql_data |
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
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,... | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3929) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT prescriptions.drug FROM prescriptions WHERE ... | mimic_iii |
CREATE TABLE table_11528 (
"Club" text,
"Position in 2012\u201313" text,
"First season in top division" text,
"Number of seasons in top division" real,
"Number of seasons in the Premier League" real,
"First season of current spell in top division" text,
"Top division titles" real,
"Last ... | SELECT SUM("Number of seasons in top division") FROM table_11528 WHERE "Position in 2012\u201313" = '009 9th' AND "Number of seasons in the Premier League" < '3' | wikisql |
CREATE TABLE table_name_28 (
current_club VARCHAR,
player VARCHAR,
first_team_appearances VARCHAR,
position VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the name of the club that has ongoing first-team appearances, a midfielder, and whose p... | SELECT current_club FROM table_name_28 WHERE first_team_appearances = "ongoing" AND position = "midfielder" AND player = "samir carruthers" | sql_create_context |
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... | SELECT YEAR(CreationDate) AS "year", COUNT(1) AS total, SUM(CASE WHEN Score > @good_question_score THEN 1 ELSE 0 END) AS total_good_question, SUM(CASE WHEN Score > @good_question_score AND AcceptedAnswerId IS NULL THEN 1 ELSE 0 END) AS total_good_question_no_accepted_answer, SUM(CASE WHEN Score > @good_question_score A... | sede |
CREATE TABLE table_68966 (
"Draw" real,
"Country" text,
"Language" text,
"Artist" text,
"Song" text,
"English translation" text,
"Result" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the song for draw less than 7 and artists of martin... | SELECT "Song" FROM table_68966 WHERE "Draw" < '7' AND "Artist" = 'martin & johannes' | wikisql |
CREATE TABLE jybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH text,
BGJGDM text,
BGJGMC text,
BGRGH text,
BGRQ time,
BGRXM text,
BGSJ time,
CJRQ time,
JSBBRQSJ time,
JSBBSJ time,
JYBBH text,
JYJGMC text,
JYJSGH text,
JYJSQM text,
JY... | SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jyb... | css |
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 SOC_SRT_DIRE_CD, SOC_SRT_DIRE_NM FROM t_kc22 WHERE MED_CLINIC_ID = '66513709021' GROUP BY SOC_SRT_DIRE_CD ORDER BY SUM(SELF_PAY_AMO) DESC LIMIT 1 | css |
CREATE TABLE zyjybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH number,
BGJGDM text,
BGJGMC text,
BGRGH text,
BGRQ time,
BGRXM text,
BGSJ time,
CJRQ time,
JSBBRQSJ time,
JSBBSJ time,
JYBBH text,
JYJGMC text,
JYJSGH text,
JYJSQM text,
... | SELECT COUNT(*) FROM zyjybgb WHERE zyjybgb.JZLSH = '76583474062' UNION SELECT COUNT(*) FROM mzjybgb WHERE mzjybgb.JZLSH = '76583474062' | css |
CREATE TABLE table_name_11 (
losses VARCHAR,
draws INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the sum of losses when draws are larger than 0?
| SELECT COUNT(losses) FROM table_name_11 WHERE draws > 0 | 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 demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "ASIAN" AND demographic.admityear < "2158" | mimicsql_data |
CREATE TABLE table_17467578_1 (
written_by VARCHAR,
us_viewers__million_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who wrote the episode 'The Dream Lover', which was viewed by 3.96 million viewers?
| SELECT written_by FROM table_17467578_1 WHERE us_viewers__million_ = "3.96" | sql_create_context |
CREATE TABLE table_name_64 (
against INTEGER,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many against on the date of 08/06/1985?
| SELECT SUM(against) FROM table_name_64 WHERE date = "08/06/1985" | sql_create_context |
CREATE TABLE table_203_592 (
id number,
"institution" text,
"location" text,
"athletic nickname" text,
"undergraduate enrollment" number,
"graduate enrollment" number,
"total enrollment" number,
"2013 endowment\n(and us rank)" text,
"academic staff" number,
"motto" text
)
-- Us... | SELECT MAX("total enrollment") - MIN("total enrollment") FROM table_203_592 | squall |
CREATE TABLE book (
book_id number,
title text,
issues number,
writer text
)
CREATE TABLE publication (
publication_id number,
book_id number,
publisher text,
publication_date text,
price number
)
-- Using valid SQLite, answer the following questions for the tables provided above.... | SELECT COUNT(*) FROM book | spider |
CREATE TABLE table_24725951_1 (
episode VARCHAR,
directed_and_produced_by VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- List episode directed and produced by Karen Selway?
| SELECT episode FROM table_24725951_1 WHERE directed_and_produced_by = "Karen Selway" | sql_create_context |
CREATE TABLE Courses (
course_id INTEGER,
author_id INTEGER,
subject_id INTEGER,
course_name VARCHAR(120),
course_description VARCHAR(255)
)
CREATE TABLE Student_Course_Enrolment (
registration_id INTEGER,
student_id INTEGER,
course_id INTEGER,
date_of_enrolment DATETIME,
date_o... | SELECT T2.middle_name, T1.student_id FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.student_id DESC | nvbench |
CREATE TABLE table_5306 (
"Round" real,
"Pick #" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which college did kevin landolt attend?
| SELECT "College" FROM table_5306 WHERE "Name" = 'kevin landolt' | wikisql |
CREATE TABLE table_name_31 (
recipient VARCHAR,
director_s_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the name of the recipient when the director was Susan Jacobson?
| SELECT recipient FROM table_name_31 WHERE director_s_ = "susan jacobson" | sql_create_context |
CREATE TABLE table_37109 (
"Position" real,
"Team" text,
"Points" real,
"Played" real,
"Drawn" real,
"Lost" real,
"Against" real,
"Difference" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which average Drawn has Points smaller than 14,... | SELECT AVG("Drawn") FROM table_37109 WHERE "Points" < '14' AND "Lost" < '4' AND "Played" > '9' | wikisql |
CREATE TABLE table_name_27 (
years_for_grizzlies VARCHAR,
player VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- In which years did Zach Randolph play for the Grizzlies?
| SELECT years_for_grizzlies FROM table_name_27 WHERE player = "zach randolph" | sql_create_context |
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
RejectionDate time,
OwnerUserId number,
Comment text,
Text te... | SELECT Id AS "post_link" FROM Posts WHERE Tags LIKE '%c#%' AND Body LIKE '%generic%' AND Body LIKE '%partial%' AND Body LIKE '%inference%' | sede |
CREATE TABLE jybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH text,
BGJGDM text,
BGJGMC text,
BGRGH text,
BGRQ time,
BGRXM text,
BGSJ time,
CJRQ time,
JSBBRQSJ time,
JSBBSJ time,
JYBBH text,
JYJGMC text,
JYJSGH text,
JYJSQM text,
JY... | SELECT wdmzjzjlb.JZLSH FROM person_info JOIN hz_info JOIN wdmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE person_info.XM = '李弘伟' AND NOT wdmzjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ <= '2016-05-1... | css |
CREATE TABLE ref_document_types (
document_type_code text,
document_type_name text,
document_type_description text
)
CREATE TABLE documents (
document_id number,
document_type_code text,
project_id number,
document_date time,
document_name text,
document_description text,
other_... | SELECT document_type_description FROM ref_document_types WHERE document_type_name = "Film" | spider |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE vitalperiodi... | SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '016-35266' AND patient.hospitaladmitsource = 'other hospital' ORDER BY patient.hospitaladmittime DESC LIMIT 1 | eicu |
CREATE TABLE table_train_233 (
"id" int,
"serum_bicarbonate" int,
"language" string,
"hemoglobin_a1c_hba1c" float,
"creatinine_clearance_cl" float,
"admission_blood_glucose" int,
"urine_albumin" int,
"ketoacidosis" bool,
"age" float,
"NOUSE" float
)
-- Using valid SQLite, answe... | SELECT * FROM table_train_233 WHERE language = 'english' OR language = 'spanish' | criteria2sql |
CREATE TABLE table_204_87 (
id number,
"courthouse" text,
"city" text,
"street address" text,
"jurisdiction" text,
"dates of use" text,
"named for" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how many courthouses were in the n.d. miss jur... | SELECT COUNT("courthouse") FROM table_204_87 WHERE "jurisdiction" = 'n.d. miss' | squall |
CREATE TABLE table_52797 (
"Superlative" text,
"Actress" text,
"Record Set" text,
"Year" real,
"Notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What year did Shelley Winters win?
| SELECT "Year" FROM table_52797 WHERE "Actress" = 'shelley winters' | wikisql |
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 jyjgzbb (
BGDH text,
BGRQ tim... | SELECT zyjzjlb.ZYZDBM, zyjzjlb.ZYZDMC FROM hz_info JOIN zyjzjlb JOIN hz_info_zyjzjlb ON hz_info.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND hz_info_zyjzjlb.JZLSH = zyjzjlb.JZLSH AND hz_info_zyjzjlb.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info_zyjzjlb.JZLSH = zyjzjlb.JZLS... | css |
CREATE TABLE table_name_40 (
_inns VARCHAR,
player VARCHAR,
wickets VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many 5+/inns have tyron henderson as the player, with wickets less than 21?
| SELECT COUNT(5) + _inns FROM table_name_40 WHERE player = "tyron henderson" AND wickets < 21 | sql_create_context |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25),
COUNTRY_ID varchar(2)
)
CREATE TABLE countries (
COUNTRY_ID... | SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) | nvbench |
CREATE TABLE location (
restaurant_id int,
house_number int,
street_name varchar,
city_name varchar
)
CREATE TABLE geographic (
city_name varchar,
county varchar,
region varchar
)
CREATE TABLE restaurant (
id int,
name varchar,
food_type varchar,
city_name varchar,
rati... | SELECT location.house_number, restaurant.name FROM location, restaurant WHERE location.city_name = 'mountain view' AND restaurant.food_type = 'arabic' AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5 | restaurants |
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... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Government" AND lab.label = "Hemoglobin" | mimicsql_data |
CREATE TABLE table_name_2 (
football VARCHAR,
soccer VARCHAR,
golf VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which foot ball team played soccer at wooster, and Gold in Ashland?
| SELECT football FROM table_name_2 WHERE soccer = "wooster" AND golf = "ashland" | sql_create_context |
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
Dele... | SELECT @n | sede |
CREATE TABLE table_name_10 (
Leading VARCHAR,
opponent VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Leading Scorer has an Opponent of @ indiana?
| SELECT Leading AS scorer FROM table_name_10 WHERE opponent = "@ indiana" | sql_create_context |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.long_title = "Initial insertion of dual-chamber device" | mimicsql_data |
CREATE TABLE table_66336 (
"Restaurant Name" text,
"Original Name" text,
"Location" text,
"Chef" text,
"Designer" text,
"Still Open?" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the designer for The Grapefruit Moon?
| SELECT "Designer" FROM table_66336 WHERE "Restaurant Name" = 'the grapefruit moon' | wikisql |
CREATE TABLE building (
building_id text,
Name text,
Street_address text,
Years_as_tallest text,
Height_feet int,
Floors int
)
CREATE TABLE protein (
common_name text,
protein_name text,
divergence_from_human_lineage real,
accession_number text,
sequence_length real,
seq... | SELECT Type, COUNT(*) FROM Institution GROUP BY Type | nvbench |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND diagnoses.icd9_code = "5839" | mimicsql_data |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime... | SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-76770') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1 | eicu |
CREATE TABLE table_49965 (
"Res." text,
"Record" text,
"Opponent" text,
"Method" text,
"Event" text,
"Round" text,
"Location" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Where was the match held when the result was win, and tko as the met... | SELECT "Location" FROM table_49965 WHERE "Res." = 'win' AND "Method" = 'tko' | wikisql |
CREATE TABLE table_name_93 (
location VARCHAR,
result VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is Location, when Result is 28-21?
| SELECT location FROM table_name_93 WHERE result = "28-21" | sql_create_context |
CREATE TABLE table_28628309_8 (
team VARCHAR,
player VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the team when player is listed as Ronjay Buenafe?
| SELECT team FROM table_28628309_8 WHERE player = "Ronjay Buenafe" | sql_create_context |
CREATE TABLE lessons (
lesson_id number,
customer_id number,
lesson_status_code text,
staff_id number,
vehicle_id number,
lesson_date time,
lesson_time text,
price number
)
CREATE TABLE addresses (
address_id number,
line_1_number_building text,
city text,
zip_postcode t... | SELECT T1.zip_postcode FROM addresses AS T1 JOIN staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" | spider |
CREATE TABLE table_train_20 (
"id" int,
"exercise_rehabilitation" bool,
"severe_sepsis" bool,
"active_infection" bool,
"mental_status" bool,
"functional_disability" bool,
"septic_shock" bool,
"NOUSE" float
)
-- Using valid SQLite, answer the following questions for the tables provided ... | SELECT * FROM table_train_20 WHERE severe_sepsis = 1 OR septic_shock = 1 | criteria2sql |
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... | SELECT COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_ID = '07587349' AND t_kc22.STA_DATE BETWEEN '2006-09-09' AND '2013-09-24' AND t_kc22.SOC_SRT_DIRE_CD = '7589' | css |
CREATE TABLE table_22072 (
"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.
-- Which clubs ha... | SELECT "Club" FROM table_22072 WHERE "Draws" = '9' | wikisql |
CREATE TABLE exhibition (
exhibition_id number,
year number,
theme text,
artist_id number,
ticket_price number
)
CREATE TABLE artist (
artist_id number,
name text,
country text,
year_join number,
age number
)
CREATE TABLE exhibition_record (
exhibition_id number,
date t... | SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance < 100 INTERSECT SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 500 | spider |
CREATE TABLE table_18042409_1 (
player VARCHAR,
alma_mater VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- List the plats that attended Wilfrid Laurier University.
| SELECT player FROM table_18042409_1 WHERE alma_mater = "Wilfrid Laurier University" | 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... | SELECT jybgb.JYKSBM, jybgb.JYKSMC FROM jybgb WHERE jybgb.JZLSH = '85475109029' | css |
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 medication (
med... | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-45919... | eicu |
CREATE TABLE t_kc22 (
MED_EXP_DET_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
MED_CLINIC_ID text,
MED_EXP_BILL_ID text,
SOC_SRT_DIRE_CD text,
SOC_SRT_DIRE_NM text,
DIRE_TYPE number,
CHA_ITEM_LEV number,
MED_INV_ITEM_TYPE text,
MED_DIRE_CD text,
MED_DIRE_NM text,... | SELECT COUNT(*) FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_ID = '52511497' AND t_kc22.STA_DATE BETWEEN '2004-11-24' AND '2016-01-08' AND t_kc22.SOC_SRT_DIRE_CD = '107476384' | css |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | SELECT demographic.days_stay, procedures.long_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "71798" | mimicsql_data |
CREATE TABLE table_name_21 (
release_date VARCHAR,
production_num VARCHAR,
characters VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When was the film released that a less than 5038 production number and was of the character Bosko?
| SELECT release_date FROM table_name_21 WHERE production_num < 5038 AND characters = "bosko" | sql_create_context |
CREATE TABLE table_54750 (
"Rider" text,
"Manufacturer" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the grid for dirk heidolf?
| SELECT SUM("Grid") FROM table_54750 WHERE "Rider" = 'dirk heidolf' | wikisql |
CREATE TABLE table_204_334 (
id number,
"opposition" text,
"matches" number,
"won" number,
"drawn" number,
"lost" number,
"for" number,
"against" number,
"win%" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- did the pune strykers or ... | SELECT "opposition" FROM table_204_334 WHERE "opposition" IN ('pune strykers', 'karnataka lions') ORDER BY "win%" DESC LIMIT 1 | squall |
CREATE TABLE table_204_958 (
id number,
"episode" number,
"original broadcast date" text,
"average" number,
"rank" number,
"remarks" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- in what month was the last episode broadcast ?
| SELECT "original broadcast date" FROM table_204_958 ORDER BY "episode" DESC LIMIT 1 | squall |
CREATE TABLE t_kc22 (
AMOUNT number,
CHA_ITEM_LEV number,
DATA_ID text,
DIRE_TYPE number,
DOSE_FORM text,
DOSE_UNIT text,
EACH_DOSAGE text,
EXP_OCC_DATE time,
FLX_MED_ORG_ID text,
FXBZ number,
HOSP_DOC_CD text,
HOSP_DOC_NM text,
MED_CLINIC_ID text,
MED_DIRE_CD tex... | SELECT SUM(t_kc22.AMOUNT) FROM t_kc22 JOIN mzb ON mzb.MED_ORG_DEPT_CD = t_kc22.MED_CLINIC_ID WHERE mzb.PERSON_SEX = '魏蕴美' AND t_kc22.STA_DATE BETWEEN '2010-12-02' AND '2015-12-23' AND t_kc22.MED_INV_ITEM_TYPE = '手术费' | css |
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_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE departments (
DEP... | SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY AVG(MANAGER_ID) DESC | nvbench |
CREATE TABLE month (
month_number int,
month_name text
)
CREATE TABLE airline (
airline_code varchar,
airline_name text,
note text
)
CREATE TABLE airport (
airport_code varchar,
airport_name text,
airport_location text,
state_code varchar,
country_name varchar,
time_zone_co... | SELECT DISTINCT aircraft.aircraft_code FROM aircraft, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, equipment_sequence, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND date_day.day_number = 7 ... | atis |
CREATE TABLE table_22860_1 (
america VARCHAR,
atlantic_europe VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is every entry for America when Atlantic Europe is Hoxniense?
| SELECT america FROM table_22860_1 WHERE atlantic_europe = "Hoxniense" | sql_create_context |
CREATE TABLE table_40182 (
"Rank" real,
"Prev" real,
"Player" text,
"Rating" real,
"Chng" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What player has a rating greater than 2746, with a prev less than 4, and +4 as the chng?
| SELECT "Player" FROM table_40182 WHERE "Rating" > '2746' AND "Prev" < '4' AND "Chng" = '+4' | wikisql |
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
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,
... | SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8421) AND prescriptions.drug IN ('vancomycin', 'oxycodone liquid', 'ns (mini bag plus)') AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start... | mimic_iii |
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 procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
... | SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'debrid opn fx-tibia/fib')) AND STRFTIME('%y', cost.charge... | mimic_iii |
CREATE TABLE table_62375 (
"1999/ 00" text,
"2000/ 01" text,
"2001/ 02" text,
"2002/ 03" text,
"2003/ 04" text,
"2004/ 05" text,
"2005/ 06" text,
"2006/ 07" text,
"2007/ 08" text,
"2008/ 09" text,
"2009/ 10" text,
"2010/ 11" text,
"2011/ 12" text,
"2012/ 13" text
... | SELECT "2006/ 07" FROM table_62375 WHERE "2011/ 12" = 'tournament not held' AND "2005/ 06" = 'tournament not held' AND "2002/ 03" = '1r' | wikisql |
CREATE TABLE table_name_79 (
laps INTEGER,
team VARCHAR,
driver VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the lowest laps Alex Tagliani did for the Forsythe Racing team?
| SELECT MIN(laps) FROM table_name_79 WHERE team = "forsythe racing" AND driver = "alex tagliani" | sql_create_context |
CREATE TABLE table_name_59 (
sales VARCHAR,
year INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What were the number of sales before 1991?
| SELECT sales FROM table_name_59 WHERE year < 1991 | sql_create_context |
CREATE TABLE table_name_2 (
pos VARCHAR,
year INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the position for years under 1999?
| SELECT pos FROM table_name_2 WHERE year < 1999 | sql_create_context |
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TABLE food_service (
meal_code text,
meal_number int,
compartment text,
meal_description varchar
)
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
CREATE T... | SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE (((flight.airline_code = 'UA') AND flight.flight_number = 21) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANC... | atis |
CREATE TABLE table_72447 (
"Club" text,
"Played" text,
"Won" 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 follo... | SELECT "Club" FROM table_72447 WHERE "Points against" = '239' | wikisql |
CREATE TABLE table_name_78 (
circuit VARCHAR,
class VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the circuit with class of gts
| SELECT circuit FROM table_name_78 WHERE class = "gts" | sql_create_context |
CREATE TABLE table_21261 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What w... | SELECT "Location Attendance" FROM table_21261 WHERE "Team" = 'Indiana' | wikisql |
CREATE TABLE table_15754 (
"Player" text,
"League" real,
"Scottish Cup" real,
"League Cup" real,
"Challenge Cup" real,
"Total" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the greatest Challenge Cup with a League smaller than 2, Total ... | SELECT MAX("Challenge Cup") FROM table_15754 WHERE "League" < '2' AND "Total" > '2' AND "League Cup" > '1' | wikisql |
CREATE TABLE table_50499 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" real,
"Money ( $ )" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who is the player from the United States with a 4 to par and a 74-73-72-69=288 scor... | SELECT "Player" FROM table_50499 WHERE "Country" = 'united states' AND "To par" = '4' AND "Score" = '74-73-72-69=288' | wikisql |
CREATE TABLE table_name_35 (
fcc_info VARCHAR,
erp_w VARCHAR,
call_sign VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which FCC info has a ERP W smaller than 222, and a Call sign of k297ai?
| SELECT fcc_info FROM table_name_35 WHERE erp_w < 222 AND call_sign = "k297ai" | sql_create_context |
CREATE TABLE table_name_9 (
date VARCHAR,
label VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the date of the label Dos or Die Recordings?
| SELECT date FROM table_name_9 WHERE label = "dos or die recordings" | 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... | SELECT jybgb.BGDH FROM jybgb WHERE jybgb.JZLSH = '49142439579' AND jybgb.KSMC LIKE '%美容%' | css |
CREATE TABLE table_64554 (
"Year" real,
"Champion" text,
"Score" text,
"Runner-up" text,
"City" text,
"Arena" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- In what arena was the North Dakota the runner-up?
| SELECT "Arena" FROM table_64554 WHERE "Runner-up" = 'north dakota' | wikisql |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE intakeoutput (
intakeoutpu... | SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-16314')) AND lab.labname = 'vitamin b12' AND STRFTIME('%y-%m', lab.labresulttime) <=... | eicu |
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 prescriptions.drug_type, prescriptions.route FROM prescriptions WHERE prescriptions.drug = "Lidocaine 5% Patch" | mimicsql_data |
CREATE TABLE table_35283 (
"Year" real,
"Location" text,
"Gold" text,
"Silver" text,
"Bronze" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which location had a year over 2006?
| SELECT "Location" FROM table_35283 WHERE "Year" > '2006' | wikisql |
CREATE TABLE city (
city VARCHAR,
city_id VARCHAR
)
CREATE TABLE temperature (
city_id VARCHAR,
Mar VARCHAR,
Jul VARCHAR,
Oct VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Give me a list of cities whose temperature in March is lower than th... | SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul OR T2.Mar > T2.Oct | sql_create_context |
CREATE TABLE table_name_55 (
margin_of_victory VARCHAR,
tournament VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What's the margin of victory during the Pocono Northeast Classic?
| SELECT margin_of_victory FROM table_name_55 WHERE tournament = "pocono northeast classic" | sql_create_context |
CREATE TABLE table_name_40 (
gold VARCHAR,
bronze VARCHAR,
silver VARCHAR,
total VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many golds for nations with over 0 silvers, over 1 total, and over 3 bronze?
| SELECT COUNT(gold) FROM table_name_40 WHERE silver > 0 AND total > 1 AND bronze > 3 | sql_create_context |
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
dual_airline varchar,
service_name text
)... | 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, fare, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MONTREAL' AND NOT fare.round_trip_cost IS NULL AND flight_fare.fare_id... | atis |
CREATE TABLE table_70320 (
"Date" text,
"Opponent" text,
"Home/Away" text,
"Field" text,
"Result" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What Field was played at in an away game against the bayhawks?
| SELECT "Field" FROM table_70320 WHERE "Home/Away" = 'away' AND "Opponent" = 'bayhawks' | wikisql |
CREATE TABLE table_10748727_1 (
position VARCHAR,
races VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What place is the team that completed 6 races?
| SELECT position FROM table_10748727_1 WHERE races = 6 | sql_create_context |
CREATE TABLE table_204_842 (
id number,
"institution" text,
"city" text,
"state" text,
"team name" text,
"affiliation" text,
"enrollment" number,
"home conference" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the total number o... | SELECT "enrollment" FROM table_204_842 WHERE "institution" = 'college of mount st. joseph' | squall |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.