instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
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 SUM(cost.cost) FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-57574' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1) | eicu |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREAT... | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '027-85328' AND patient.wardid = 996 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1 | eicu |
CREATE TABLE table_name_32 (
Id VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the result for 2004 when A is the result for 2005, and the result of q1 when 2009?
| SELECT 2004 FROM table_name_32 WHERE 2005 = "a" AND 2009 = "q1" | sql_create_context |
CREATE TABLE table_31909 (
"Round" real,
"Circuit" text,
"Date" text,
"Pole Position" text,
"Fastest Lap" text,
"Winning Driver" text,
"Winning Team" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the winning driver for round 7
| SELECT "Winning Driver" FROM table_31909 WHERE "Round" = '7' | wikisql |
CREATE TABLE table_name_91 (
long INTEGER,
car VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who has the highest Long with 59 Car?
| SELECT MAX(long) FROM table_name_91 WHERE car = 59 | 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 procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CONGESTIVE HEART FAILURE" AND demographic.dod_year <= "2115.0" | mimicsql_data |
CREATE TABLE table_63816 (
"Position" real,
"Team" text,
"Played" real,
"Wins" real,
"Draws" real,
"Losses" real,
"Scored" real,
"Conceded" real,
"Points" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the number of losses wh... | SELECT "Losses" FROM table_63816 WHERE "Draws" < '4' AND "Points" = '9' | wikisql |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
C... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "20" AND prescriptions.formulary_drug_cd = "WARF0" | mimicsql_data |
CREATE TABLE table_64561 (
"Team" text,
"Outgoing manager" text,
"Manner of departure" text,
"Date of vacancy" text,
"Replaced by" text,
"Date of appointment" text,
"Position in table" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is t... | SELECT "Team" FROM table_64561 WHERE "Position in table" = '24th' AND "Date of appointment" = '15 september 2008' | wikisql |
CREATE TABLE table_69142 (
"Round" real,
"Name" text,
"Position" text,
"School" text,
"Signed" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the position played for the player drafted in round 2?
| SELECT "Position" FROM table_69142 WHERE "Round" = '2' | wikisql |
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code tex... | SELECT MAX(vitalperiodic.heartrate) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-79656')) AND NOT vitalperiodic.heartrate IS NULL... | eicu |
CREATE TABLE mzjzjlb_jybgb (
YLJGDM_MZJZJLB text,
BGDH number,
YLJGDM number
)
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
CREATE TABLE mzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
... | SELECT mzjzjlb.KH, mzjzjlb.KLX FROM mzjzjlb WHERE mzjzjlb.JZLSH = '18195078262' | css |
CREATE TABLE table_34835 (
"Place" text,
"Player" text,
"Country" text,
"Score" real,
"To par" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many scores have paul casey as a player?
| SELECT COUNT("Score") FROM table_34835 WHERE "Player" = 'paul casey' | wikisql |
CREATE TABLE table_name_69 (
draws INTEGER,
wins VARCHAR,
points VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average draws with less than 3 wins and more than 5 points?
| SELECT AVG(draws) FROM table_name_69 WHERE wins < 3 AND points > 5 | sql_create_context |
CREATE TABLE airport_aircraft (
id number,
airport_id number,
aircraft_id number
)
CREATE TABLE airport (
airport_id number,
airport_name text,
total_passengers number,
%_change_2007 text,
international_passengers number,
domestic_passengers number,
transit_passengers number,
... | SELECT name FROM pilot WHERE NOT pilot_id IN (SELECT winning_pilot FROM match WHERE country = 'Australia') | spider |
CREATE TABLE table_name_24 (
loser VARCHAR,
date VARCHAR,
location VARCHAR,
winner VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who lost when the philadelphia eagles won at lincoln financial field on september 30?
| SELECT loser FROM table_name_24 WHERE location = "lincoln financial field" AND winner = "philadelphia eagles" AND date = "september 30" | sql_create_context |
CREATE TABLE table_30324 (
"Year Location" text,
"Mens Singles" text,
"Womens Singles" text,
"Mens Doubles" text,
"Womens Doubles" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the year location for haruna fukuoka
| SELECT "Year Location" FROM table_30324 WHERE "Womens Singles" = 'Haruna Fukuoka' | wikisql |
CREATE TABLE table_name_16 (
Id VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How much is the highest number in 2006 with fewer than 0 in 2002?
| SELECT MAX(2006) FROM table_name_16 WHERE 2002 < 0 | sql_create_context |
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE transfers (
row_id number,
subject_id number,
... | 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 = 'other pleural incision') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 81840) AND STRFTIME('%y', pr... | mimic_iii |
CREATE TABLE table_name_78 (
estimate VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the estimated number of victims for the April 27, 1865 sinking?
| SELECT estimate FROM table_name_78 WHERE date = "april 27, 1865" | sql_create_context |
CREATE TABLE table_name_22 (
drawn VARCHAR,
played VARCHAR,
position VARCHAR,
competition VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how many times what the position 6th, the competition was super league xvii and played was larger than 27?
| SELECT COUNT(drawn) FROM table_name_22 WHERE position = "6th" AND competition = "super league xvii" AND played > 27 | sql_create_context |
CREATE TABLE store_district (
Store_ID int,
District_ID int
)
CREATE TABLE product (
product_id int,
product text,
dimensions text,
dpi real,
pages_per_minute_color real,
max_page_size text,
interface text
)
CREATE TABLE store (
Store_ID int,
Store_Name text,
Type text,... | SELECT Headquartered_City, COUNT(*) FROM store AS t1 JOIN store_district AS t2 ON t1.Store_ID = t2.Store_ID JOIN district AS t3 ON t2.District_ID = t3.District_ID GROUP BY t3.Headquartered_City ORDER BY Headquartered_City | nvbench |
CREATE TABLE student_record (
student_id int,
course_id int,
semester int,
grade varchar,
how varchar,
transfer_source varchar,
earn_credit varchar,
repeat_term varchar,
test_id varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE semester (
... | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number BETWEEN 300 AND 300 + 100 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester... | advising |
CREATE TABLE table_49778 (
"Year" real,
"Series" text,
"Make" text,
"Driver" text,
"Team" text,
"Schedule" text,
"Role" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the series when the team is gunbroker racing?
| SELECT "Series" FROM table_49778 WHERE "Team" = 'gunbroker racing' | wikisql |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id n... | SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'prescriptions' AND cost.event_id IN (SELECT prescriptions.row_id FROM prescriptions WHERE prescriptions.drug = 'dibucaine') | mimic_iii |
CREATE TABLE table_38183 (
"Rank" real,
"Matches as champion" real,
"Reigns as champion" real,
"Title matches won*" real,
"Title last held" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Matches has champion Rank of 5?
| SELECT MAX("Matches as champion") FROM table_38183 WHERE "Rank" = '5' | 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 procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.admityear < "2103" | mimicsql_data |
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
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 T... | SELECT Id, DisplayName, Reputation, WebsiteUrl, Location FROM Users WHERE Location LIKE '%Kenya%' ORDER BY Reputation DESC LIMIT 50 | sede |
CREATE TABLE Dorm_amenity (
amenid INTEGER,
amenity_name VARCHAR(25)
)
CREATE TABLE Dorm (
dormid INTEGER,
dorm_name VARCHAR(20),
student_capacity INTEGER,
gender VARCHAR(1)
)
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCH... | SELECT city_code, AVG(Age) FROM Student GROUP BY city_code ORDER BY city_code DESC | nvbench |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "URGENT" AND prescriptions.formulary_drug_cd = "PHEN100IVPB" | mimicsql_data |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose... | SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 74716 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label ... | mimic_iii |
CREATE TABLE table_62454 (
"Name" text,
"Pos." text,
"Height" text,
"Weight" text,
"Date of Birth" text,
"Club" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What D Player with a Height of m (ft 4in) is in the Spandau 04 Club?
| SELECT "Name" FROM table_62454 WHERE "Club" = 'spandau 04' AND "Height" = 'm (ft 4in)' AND "Pos." = 'd' | wikisql |
CREATE TABLE policies (
customer_id VARCHAR
)
CREATE TABLE customers (
customer_id VARCHAR,
customer_details VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Find all the policy type codes associated with the customer 'Dayana Robel
| SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t2.customer_details = "Dayana Robel" | sql_create_context |
CREATE TABLE table_11780179_1 (
gdp_per_capita__nominal_ VARCHAR,
gdp__nominal_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the gpa per capita (nominal) for the country with gdp (nominal) is $52.0 billion?
| SELECT gdp_per_capita__nominal_ FROM table_11780179_1 WHERE gdp__nominal_ = "$52.0 billion" | sql_create_context |
CREATE TABLE table_204_467 (
id number,
"date" text,
"opponents" text,
"h/a" text,
"result\nf-a" text,
"scorers" text,
"attendance" number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how many attendees were present at the february 11 match aga... | SELECT "attendance" FROM table_204_467 WHERE "date" = 2 AND "date" = 11 AND "opponents" = 'huddersfield town' | squall |
CREATE TABLE table_11058032_1 (
title VARCHAR,
directed_by VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the title of the episode directed by Mark Tinker?
| SELECT title FROM table_11058032_1 WHERE directed_by = "Mark Tinker" | sql_create_context |
CREATE TABLE table_27490 (
"Rank" real,
"District" text,
"Population" real,
"Growth Rate" text,
"Sex Ratio" real,
"Literacy" text,
"Density/KM" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the growth rate for hooghly
| SELECT "Growth Rate" FROM table_27490 WHERE "District" = 'Hooghly' | wikisql |
CREATE TABLE t_kc22 (
AMOUNT number,
CHA_ITEM_LEV number,
DATA_ID text,
DIRE_TYPE number,
DOSE_FORM text,
DOSE_UNIT text,
EACH_DOSAGE text,
EXP_OCC_DATE time,
FLX_MED_ORG_ID text,
FXBZ number,
HOSP_DOC_CD text,
HOSP_DOC_NM text,
MED_CLINIC_ID text,
MED_DIRE_CD tex... | SELECT COUNT(*) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '5304983' AND t_kc21.IN_HOSP_DATE BETWEEN '2001-01-07' AND '2001-12-23' AND t_kc21.INSURED_STS = '未就业' | css |
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescript... | SELECT PostId AS "post_link" FROM PostHistory WHERE PostHistoryTypeId = 10 AND Comment = '102' LIMIT 100 | sede |
CREATE TABLE table_14938 (
"Week" real,
"Opponent" text,
"Result" text,
"Game site" text,
"Attendance" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many people were in attendance at week 16?
| SELECT AVG("Attendance") FROM table_14938 WHERE "Week" = '16' | wikisql |
CREATE TABLE table_59904 (
"Name" text,
"Position" text,
"League Apps" text,
"League Goals" real,
"FA Cup Apps" text,
"FA Cup Goals" real,
"League Cup Apps" text,
"League Cup Goals" real,
"Total Apps" text,
"Total Goals" real
)
-- Using valid SQLite, answer the following questi... | SELECT MIN("League Goals") FROM table_59904 WHERE "FA Cup Goals" = '0' AND "FA Cup Apps" = '0' AND "Position" = 'df' AND "Total Apps" = '3' | 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 diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug_type = "BASE" | mimicsql_data |
CREATE TABLE table_200_32 (
id number,
"year" number,
"w" number,
"l" number,
"t" number,
"finish" text,
"coach" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how many years did earl ball coach the muncie flyers ?
| SELECT COUNT("year") FROM table_200_32 WHERE "coach" = 'earl ball' | squall |
CREATE TABLE table_name_55 (
title VARCHAR,
story VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the title of the episode that martin worth wrote the story for?
| SELECT title FROM table_name_55 WHERE story = "martin worth" | sql_create_context |
CREATE TABLE table_name_17 (
laps VARCHAR,
pos VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the total number of laps for 23rd position
| SELECT COUNT(laps) FROM table_name_17 WHERE pos = "23rd" | sql_create_context |
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 departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE... | SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) | nvbench |
CREATE TABLE table_name_44 (
debut_year INTEGER,
player VARCHAR,
games VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Debut year has a Player of bob hayton, and Games smaller than 2?
| SELECT AVG(debut_year) FROM table_name_44 WHERE player = "bob hayton" AND games < 2 | sql_create_context |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime t... | SELECT DISTINCT medication.routeadmin FROM medication WHERE medication.drugname = 'sodium chloride 0.9%' | eicu |
CREATE TABLE table_52053 (
"Ethnic group" text,
"Christian" text,
"Buddhist" text,
"Hindu" text,
"Jewish" text,
"Muslim" text,
"Sikh" text,
"Other" text,
"No religion" text,
"Not stated" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.... | SELECT "Hindu" FROM table_52053 WHERE "Jewish" = 'source: uk 2001 census' | wikisql |
CREATE TABLE channel (
Channel_ID int,
Name text,
Owner text,
Share_in_percent real,
Rating_in_percent real
)
CREATE TABLE broadcast_share (
Channel_ID int,
Program_ID int,
Date text,
Share_in_percent real
)
CREATE TABLE program (
Program_ID int,
Name text,
Origin text,... | SELECT Time_of_day, COUNT(*) FROM broadcast GROUP BY Time_of_day | nvbench |
CREATE TABLE table_train_239 (
"id" int,
"basal_c_peptide" float,
"body_weight" float,
"renal_disease" bool,
"creatinine_clearance_cl" float,
"serum_creatinine" float,
"stimulated" bool,
"body_mass_index_bmi" float,
"NOUSE" float
)
-- Using valid SQLite, answer the following questi... | SELECT * FROM table_train_239 WHERE stimulated = 1 OR basal_c_peptide > 0.3 | criteria2sql |
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 MIN(demographic.age) FROM demographic WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE\CORONARY ARTERY BYPASS GRAFT WITH MVR; ? MAZE" AND demographic.admityear >= "2146" | mimicsql_data |
CREATE TABLE table_22669044_9 (
high_rebounds VARCHAR,
team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the high rebounds for new york
| SELECT high_rebounds FROM table_22669044_9 WHERE team = "New York" | sql_create_context |
CREATE TABLE days (
days_code varchar,
day_name varchar
)
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fare int
)
CREATE TABLE flight (
aircraft_code_sequence text,
airline_code varchar,
airline_flight text,
arrival_time int,
... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (((flight.departure_time BETWEEN 1200 AND 1800) AND date_day.day_number = 25 AND date_day.month_number = 6 AND date_day.year = 1991 AND days.day_... | atis |
CREATE TABLE voting_record (
stuid number,
registration_date text,
election_cycle text,
president_vote number,
vice_president_vote number,
secretary_vote number,
treasurer_vote number,
class_president_vote number,
class_senator_vote number
)
CREATE TABLE student (
stuid number,
... | SELECT major FROM student GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1 | spider |
CREATE TABLE table_203_577 (
id number,
"tenure" text,
"coach" text,
"years" number,
"record" text,
"pct." number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- who was coach after b.l. noojin ?
| SELECT "coach" FROM table_203_577 WHERE "tenure" > (SELECT "tenure" FROM table_203_577 WHERE "coach" = 'b. l. noojin') ORDER BY "tenure" LIMIT 1 | squall |
CREATE TABLE furniture_manufacte (
Manufacturer_ID int,
Furniture_ID int,
Price_in_Dollar real
)
CREATE TABLE furniture (
Furniture_ID int,
Name text,
Num_of_Component int,
Market_Rate real
)
CREATE TABLE manufacturer (
Manufacturer_ID int,
Open_Year real,
Name text,
Num_of... | SELECT Name, COUNT(*) FROM manufacturer AS t1 JOIN furniture_manufacte AS t2 ON t1.Manufacturer_ID = t2.Manufacturer_ID GROUP BY t1.Manufacturer_ID | nvbench |
CREATE TABLE table_23953 (
"Position" real,
"Race number" text,
"Sail number" text,
"Yacht" text,
"State/country" text,
"Yacht type" text,
"LOA (Metres)" text,
"Skipper" text,
"Elapsed time d:hh:mm:ss" text
)
-- Using valid SQLite, answer the following questions for the tables prov... | SELECT "Race number" FROM table_23953 WHERE "Elapsed time d:hh:mm:ss" = '1:23:19:31' | wikisql |
CREATE TABLE table_37771 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the opponent during the game that had more than 31,891 people in attendance?
| SELECT "Opponent" FROM table_37771 WHERE "Attendance" > '31,891' | wikisql |
CREATE TABLE table_27166 (
"Tie no" real,
"Home team" text,
"Score 1" text,
"Away team" text,
"Attendance" real,
"Date" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What tie has Orient as the home team?
| SELECT "Tie no" FROM table_27166 WHERE "Home team" = 'Orient' | wikisql |
CREATE TABLE table_19331 (
"Rank" real,
"Name" text,
"Nationality" text,
"1st (m)" text,
"2nd (m)" text,
"Points" text,
"Overall WC points (Rank)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the overall wc points for points of 39... | SELECT "Overall WC points (Rank)" FROM table_19331 WHERE "Points" = '397.2' | wikisql |
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,
COM_PAY number,
DATA_ID text,
ENT_ACC_PAY number,
ENT_PAY number,
F... | SELECT COUNT(*) FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '吴莹华' AND t_kc22.STA_DATE BETWEEN '2003-12-27' AND '2019-01-29' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC LIMIT 1 | css |
CREATE TABLE table_203_737 (
id number,
"#" number,
"employer" text,
"# of employees" number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- how many employers listed have less than 250 employees ?
| SELECT COUNT("employer") FROM table_203_737 WHERE "# of employees" < 250 | squall |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
CREATE TABLE fzzmzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH number,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
... | SELECT zzmzjzjlb.JZZTDM, zzmzjzjlb.JZZTMC FROM zzmzjzjlb WHERE zzmzjzjlb.JZLSH = '01573441264' UNION SELECT fzzmzjzjlb.JZZTDM, fzzmzjzjlb.JZZTMC FROM fzzmzjzjlb WHERE fzzmzjzjlb.JZLSH = '01573441264' | css |
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
-- Using valid SQLite, answer the following questions for the... | SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name ORDER BY T1.Code DESC | nvbench |
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,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... | SELECT PHONE_NUMBER, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) | nvbench |
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE Badges (
Id number,
UserId numb... | SELECT * FROM Posts WHERE CreationDate <= '2012-09-30' AND NOT OwnerUserId IS NULL AND OwnerUserId != -1 AND (PostTypeId = 1 OR PostTypeId = 2) | sede |
CREATE TABLE qtb (
CLINIC_ID text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD text,
INPT_AREA_BED text,
INSURED_IDENTITY number,
INSURED_STS text,
INSU_TYPE text,
IN... | SELECT qtb.OUT_DIAG_DOC_CD, qtb.OUT_DIAG_DOC_NM FROM qtb WHERE qtb.PERSON_ID = '51510159' AND qtb.IN_HOSP_DATE BETWEEN '2012-11-30' AND '2020-03-24' GROUP BY qtb.OUT_DIAG_DOC_CD ORDER BY COUNT(*) DESC LIMIT 1 UNION SELECT gyb.OUT_DIAG_DOC_CD, gyb.OUT_DIAG_DOC_NM FROM gyb WHERE gyb.PERSON_ID = '51510159' AND gyb.IN_HOSP... | css |
CREATE TABLE table_6111 (
"Name" text,
"Birth" text,
"Marriage" text,
"Became Queen" text,
"Ceased to be Queen" text,
"Death" text,
"Spouse" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When was the person who died on 16 July 1946 born?
| SELECT "Birth" FROM table_6111 WHERE "Death" = '16 july 1946' | wikisql |
CREATE TABLE table_27961 (
"Player" text,
"Touchdowns" real,
"Extra points" real,
"Field goals" real,
"Points" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the highest number of touchdowns by a player?
| SELECT MAX("Touchdowns") FROM table_27961 | wikisql |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime... | SELECT (SELECT vitalperiodic.heartrate FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-74343') AND NOT patient.unitdischargetime IS ... | eicu |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2172" AND lab.itemid = "50976" | mimicsql_data |
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom t... | SELECT COUNT(*) > 0 FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 6705) AND DATETIME(labevents.charttime) >= DATETIME(CURRENT_TIME(), '-155 month') | mimic_iii |
CREATE TABLE table_name_91 (
date VARCHAR,
tie_no VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When was the game that has tie no 2?
| SELECT date FROM table_name_91 WHERE tie_no = "2" | sql_create_context |
CREATE TABLE table_34148 (
"Rank" text,
"Common of" text,
"Population" real,
"Area (km 2 )" real,
"Density (inhabitants/km 2 )" real,
"Altitude (mslm)" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many people have an Altitude (mslm) larger... | SELECT COUNT("Population") FROM table_34148 WHERE "Altitude (mslm)" > '302' AND "Area (km 2 )" = '29.2' | wikisql |
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE Badges (
Id number,
UserId number,
Name text,
... | 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_10953197_4 (
no_in_season VARCHAR,
production_code VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What's the number of the episode with production code 2395118?
| SELECT no_in_season FROM table_10953197_4 WHERE production_code = "2395118" | sql_create_context |
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE... | SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1918) AND microbiologyevents.spec_type_desc = 'blood culture' AND DATETIME(microbiologyevents.charttime) <= DATETIME(CURRENT_TIME(), '-1 year') | mimic_iii |
CREATE TABLE table_52045 (
"Series" text,
"Years" text,
"Magazine" text,
"Albums" text,
"Editor" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What years did the magazine Vaillant and Pif run?
| SELECT "Years" FROM table_52045 WHERE "Magazine" = 'vaillant and pif' | wikisql |
CREATE TABLE actor (
actor_id number,
first_name text,
last_name text,
last_update time
)
CREATE TABLE city (
city_id number,
city text,
country_id number,
last_update time
)
CREATE TABLE address (
address_id number,
address text,
address2 text,
district text,
city_... | SELECT COUNT(*) FROM address WHERE district = 'California' | spider |
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 countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE regions (
REGION_ID decimal(5,0),
... | SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(DEPARTMENT_ID) DESC | nvbench |
CREATE TABLE t_kc22 (
AMOUNT number,
CHA_ITEM_LEV number,
DATA_ID text,
DIRE_TYPE number,
DOSE_FORM text,
DOSE_UNIT text,
EACH_DOSAGE text,
EXP_OCC_DATE time,
FLX_MED_ORG_ID text,
FXBZ number,
HOSP_DOC_CD text,
HOSP_DOC_NM text,
MED_CLINIC_ID text,
MED_DIRE_CD tex... | SELECT COUNT(*) FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_ID = '97737667' AND t_kc22.STA_DATE BETWEEN '2015-12-22' AND '2020-08-25' AND t_kc22.SELF_PAY_PRO < 0.04 | css |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.dod_year <= "2138.0" | mimicsql_data |
CREATE TABLE table_25008327_8 (
croatian VARCHAR,
english VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is every value for Croatian when value for English is dog?
| SELECT croatian FROM table_25008327_8 WHERE english = "dog" | sql_create_context |
CREATE TABLE table_51332 (
"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.
-- Which crowd had an Away team score of 7.12 (54)?... | SELECT AVG("Crowd") FROM table_51332 WHERE "Away team score" = '7.12 (54)' | wikisql |
CREATE TABLE Addresses (
Address_ID VARCHAR(100),
Line_1 VARCHAR(255),
Line_2 VARCHAR(255),
City_Town VARCHAR(255),
State_County VARCHAR(255),
Other_Details VARCHAR(255)
)
CREATE TABLE Bookings (
Booking_ID INTEGER,
Customer_ID INTEGER,
Workshop_Group_ID VARCHAR(100),
Status_Cod... | SELECT Actual_Delivery_Date, COUNT(Actual_Delivery_Date) FROM Bookings | nvbench |
CREATE TABLE table_63058 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"TV Time" text,
"Attendance" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Tv Time of the game with an Attendance of 73,578?
| SELECT "TV Time" FROM table_63058 WHERE "Attendance" = '73,578' | wikisql |
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.
-- Who has friends that are ol... | SELECT T1.name, T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age > (SELECT AVG(age) FROM Person) ORDER BY T1.age DESC | nvbench |
CREATE TABLE table_22805 (
"Club" text,
"Position in 2012\u201313" text,
"First season in top division" text,
"Number of seasons in top division" real,
"First season of current spell in top division" text,
"Top division titles" real,
"Last top division title" text
)
-- Using valid SQLite, ... | SELECT COUNT("Top division titles") FROM table_22805 WHERE "Position in 2012\u201313" = '5th' | wikisql |
CREATE TABLE table_11630008_4 (
season_no VARCHAR,
series_no VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many seasons was series number 47 shown?
| SELECT COUNT(season_no) FROM table_11630008_4 WHERE series_no = 47 | sql_create_context |
CREATE TABLE student (
stuid VARCHAR,
sex VARCHAR
)
CREATE TABLE lives_in (
stuid VARCHAR,
dormid VARCHAR
)
CREATE TABLE dorm (
dormid VARCHAR,
dorm_name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Find the number of female students (wit... | SELECT COUNT(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' AND T1.sex = 'F' | sql_create_context |
CREATE TABLE table_name_11 (
license VARCHAR,
name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the license for Rygel?
| SELECT license FROM table_name_11 WHERE name = "rygel" | sql_create_context |
CREATE TABLE job_history (
employee_id VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- display the ID for those employees who did two or more jobs in the past.
| SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*) >= 2 | sql_create_context |
CREATE TABLE table_17987 (
"No." real,
"Air Date" text,
"Rating" text,
"Share" real,
"18-49 (Rating/Share)" text,
"Viewers (m)" text,
"Night" real,
"Timeslot" real,
"Overall" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what are al... | SELECT "Overall" FROM table_17987 WHERE "Rating" = '1.4' | wikisql |
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text... | SELECT Id AS "comment_link", UserId AS "user_link", Score, CreationDate FROM Comments WHERE Text LIKE '%##searchString##%' ORDER BY CreationDate DESC | sede |
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND prescriptions.route = "NEB" | mimicsql_data |
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
meter_600 text,
meter_700 text,
Time text
)
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
... | SELECT name, COUNT(name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID WHERE Result = 'Win' GROUP BY name ORDER BY name | nvbench |
CREATE TABLE table_71791 (
"Player" text,
"Country" text,
"Year(s) won" text,
"Total" real,
"To par" text,
"Finish" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- In 1991, what was the lowest total?
| SELECT MIN("Total") FROM table_71791 WHERE "Year(s) won" = '1991' | wikisql |
CREATE TABLE table_21227 (
"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 d... | SELECT "Date" FROM table_21227 WHERE "Team" = 'Charlotte' | wikisql |
CREATE TABLE table_203_437 (
id number,
"year" number,
"laureate" text,
"relation" text,
"category" text,
"rationale" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- who is after robert hofstadter on the list ?
| SELECT "laureate" FROM table_203_437 WHERE id = (SELECT id FROM table_203_437 WHERE "laureate" = 'robert hofstadter') + 1 | squall |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.