instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
CREATE TABLE table_13622 (
"School" text,
"Location" text,
"Mascot" text,
"Enrollment" real,
"IHSAA Class" text,
"# / County" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the IHSAA class for the school where the mascot is the Rebels?
| SELECT "IHSAA Class" FROM table_13622 WHERE "Mascot" = 'rebels' | wikisql |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND prescriptions.formulary_drug_cd = "HYDR20/100NS" | mimicsql_data |
CREATE TABLE news_report (
journalist_id number,
event_id number,
work_type text
)
CREATE TABLE event (
event_id number,
date text,
venue text,
name text,
event_attendance number
)
CREATE TABLE journalist (
journalist_id number,
name text,
nationality text,
age text,
... | SELECT T3.name FROM news_report AS T1 JOIN event AS T2 ON T1.event_id = T2.event_id JOIN journalist AS T3 ON T1.journalist_id = T3.journalist_id GROUP BY T3.name HAVING COUNT(*) > 1 | spider |
CREATE TABLE table_27409644_1 (
location VARCHAR,
ground VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Where is lootospark from?
| SELECT location FROM table_27409644_1 WHERE ground = "Lootospark" | sql_create_context |
CREATE TABLE Problem_Log (
problem_log_id INTEGER,
assigned_to_staff_id INTEGER,
problem_id INTEGER,
problem_category_code VARCHAR(20),
problem_status_code VARCHAR(20),
log_entry_date DATETIME,
log_entry_description VARCHAR(255),
log_entry_fix VARCHAR(255),
other_log_details VARCHAR(... | SELECT log_entry_description, COUNT(log_entry_description) FROM Problem_Log GROUP BY log_entry_description ORDER BY log_entry_description DESC | nvbench |
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
DeletionDate time,
ReviewTaskStateId number,
PostId number,
SuggestedEditId number,
CompletedByReviewTaskId number
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId... | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%rajkot%' OR UPPER(Location) LIKE '%RAJKOT' ORDER BY Reputation DESC LIMIT 50 | sede |
CREATE TABLE table_name_10 (
race_name VARCHAR,
round VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which race was in round 6?
| SELECT race_name FROM table_name_10 WHERE round = 6 | sql_create_context |
CREATE TABLE table_name_95 (
date VARCHAR,
score VARCHAR,
loss VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What date has 5-3 as the score, and holt (1-1) as a loss?
| SELECT date FROM table_name_95 WHERE score = "5-3" AND loss = "holt (1-1)" | sql_create_context |
CREATE TABLE table_63941 (
"Rank" real,
"Lane" real,
"Athlete" text,
"Time ( sec )" real,
"Notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the lane for notes Q, SB and time less than 11.22?
| SELECT SUM("Lane") FROM table_63941 WHERE "Notes" = 'q, sb' AND "Time ( sec )" < '11.22' | wikisql |
CREATE TABLE table_name_22 (
bronze INTEGER,
total VARCHAR,
nation VARCHAR,
silver VARCHAR,
gold VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many Bronzes that has a Silver of 0, and a Gold of 0, and a Nation of denmark, and a Total larger ... | SELECT SUM(bronze) FROM table_name_22 WHERE silver = 0 AND gold = 0 AND nation = "denmark" AND total > 1 | sql_create_context |
CREATE TABLE table_203_836 (
id number,
"title" text,
"year" number,
"platforms" text,
"developer" text,
"publisher" text,
"notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- according to the table , what is the last title that spicy hors... | SELECT "title" FROM table_203_836 WHERE "developer" = 'spicy horse' ORDER BY "year" DESC LIMIT 1 | squall |
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE month (
month_number int,
month_name text
)
CREATE TABLE flight (
aircraft_code_sequence text,
airline_code varchar,
airline_flight text,
arrival_time int,
connections int,
departure_time... | 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 AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis AS FARE_BASIS_0, fare_basis AS FARE_BASIS_1, flight, flight_fare WHERE ((((DA... | atis |
CREATE TABLE table_name_30 (
nationality VARCHAR,
years_for_jazz VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the nationality of the Jazz player 1977-79?
| SELECT nationality FROM table_name_30 WHERE years_for_jazz = "1977-79" | sql_create_context |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid num... | SELECT t1.drugname FROM (SELECT medication.drugname, COUNT(medication.drugstarttime) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007... | eicu |
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 course.department, course.name, course.number, instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.name LIKE '%Medieval Music%' AND NOT instructor.name LIKE '%Radosevich%' AND offering_instructor.instructor_id = inst... | advising |
CREATE TABLE table_11240028_1 (
episodes VARCHAR,
portrayed_by VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many episodes did actress Vanessa Ferlito appear in?
| SELECT episodes FROM table_11240028_1 WHERE portrayed_by = "Vanessa Ferlito" | sql_create_context |
CREATE TABLE table_70385 (
"Year" real,
"Entrant" text,
"Class" text,
"Chassis" text,
"Engine" text,
"Tyres" text,
"Rank" text,
"Points" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the rank of the cadillac northstar lmp02 chas... | SELECT "Rank" FROM table_70385 WHERE "Chassis" = 'cadillac northstar lmp02' | wikisql |
CREATE TABLE table_40990 (
"Date" text,
"Tournament" text,
"Winning score" text,
"To par" text,
"Margin of victory" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which tournament had a winning score of 67-61-68-67=263?
| SELECT "Tournament" FROM table_40990 WHERE "Winning score" = '67-61-68-67=263' | wikisql |
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.dod_year <= "2122.0" | mimicsql_data |
CREATE TABLE table_78493 (
"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.
-- Where does South Melbourne play?
| SELECT "Venue" FROM table_78493 WHERE "Away team" = 'south melbourne' | wikisql |
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event... | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT procedures_icd.icd9_code FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 7375) ORDER BY procedures_icd.charttime LIMIT 1) | mimic_iii |
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 jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH =... | css |
CREATE TABLE table_7006 (
"City" text,
"Country" text,
"IATA" text,
"ICAO" text,
"Airport" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- WHich Country has a ICAO of ltcd?
| SELECT "Country" FROM table_7006 WHERE "ICAO" = 'ltcd' | wikisql |
CREATE TABLE table_23344 (
"#" real,
"Episode" text,
"Rating" text,
"Share" real,
"Rating/Share (18-49)" text,
"Viewers (millions)" text,
"Rank (Night)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- If the amount of viewers is 5.14 million ... | SELECT "Rating" FROM table_23344 WHERE "Rating/Share (18-49)" = '2.0/6' AND "Viewers (millions)" = '5.14' | wikisql |
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25... | SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY AVG(EMPLOYEE_ID) DESC | nvbench |
CREATE TABLE table_18594107_1 (
points INTEGER,
team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the least number of poins for San Lorenzo?
| SELECT MIN(points) FROM table_18594107_1 WHERE team = "San Lorenzo" | sql_create_context |
CREATE TABLE table_name_4 (
visa_5 VARCHAR,
visa_1 VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Visa 5 has a Visa 1 of emile heskey?
| SELECT visa_5 FROM table_name_4 WHERE visa_1 = "emile heskey" | sql_create_context |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
CREATE TABLE zzmzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH number,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
K... | SELECT COUNT(*) FROM zzmzjzjlb WHERE zzmzjzjlb.YLJGDM = '5126566' AND zzmzjzjlb.JZKSRQ BETWEEN '2003-10-14' AND '2014-10-02' AND zzmzjzjlb.WDBZ > 0 UNION SELECT COUNT(*) FROM fzzmzjzjlb WHERE fzzmzjzjlb.YLJGDM = '5126566' AND fzzmzjzjlb.JZKSRQ BETWEEN '2003-10-14' AND '2014-10-02' AND fzzmzjzjlb.WDBZ > 0 | css |
CREATE TABLE Reviewer (
rID int,
name text
)
CREATE TABLE Movie (
mID int,
title text,
year int,
director text
)
CREATE TABLE Rating (
rID int,
mID int,
stars int,
ratingDate date
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- In wh... | SELECT year, COUNT(year) FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1.year | nvbench |
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 WHERE demographic.discharge_location = "REHAB/DISTINCT PART HOSP" | mimicsql_data |
CREATE TABLE table_name_99 (
place VARCHAR,
country VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was Australia's place?
| SELECT place FROM table_name_99 WHERE country = "australia" | 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 ph.PostId AS "post_link", pht.Name FROM PostHistory AS ph JOIN PostHistoryTypes AS pht ON ph.PostHistoryTypeId = pht.Id WHERE ph.PostHistoryTypeId = @HistoryEventType | sede |
CREATE TABLE weather (
date text,
max_temperature_f number,
mean_temperature_f number,
min_temperature_f number,
max_dew_point_f number,
mean_dew_point_f number,
min_dew_point_f number,
max_humidity number,
mean_humidity number,
min_humidity number,
max_sea_level_pressure_inc... | SELECT date, cloud_cover FROM weather ORDER BY cloud_cover DESC LIMIT 5 | spider |
CREATE TABLE table_73295 (
"Expression" text,
"Y = 2008" text,
"Y = 2009" text,
"Y = 2010" text,
"Y = 2011" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the y = 2008 when the expression is easter day (julian calendar)?
| SELECT "Y = 2008" FROM table_73295 WHERE "Expression" = 'Easter Day (Julian calendar)' | wikisql |
CREATE TABLE table_29281529_2 (
challenger VARCHAR,
iron_chef VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the challenger when guillaume brahimi was the iron chef?
| SELECT challenger FROM table_29281529_2 WHERE iron_chef = "Guillaume Brahimi" | sql_create_context |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,... | SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-18714')) AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME()... | eicu |
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 INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "SINGLE" AND diagnoses.short_title = "Malfunc oth device/graft" | mimicsql_data |
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE cours... | SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%Core%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_co... | advising |
CREATE TABLE jybgb (
YLJGDM text,
YLJGDM_MZJZJLB text,
YLJGDM_ZYJZJLB text,
BGDH text,
BGRQ time,
JYLX number,
JZLSH text,
JZLSH_MZJZJLB text,
JZLSH_ZYJZJLB text,
JZLX number,
KSBM text,
KSMC text,
SQRGH text,
SQRXM text,
BGRGH text,
BGRXM text,
SHRGH ... | SELECT * FROM person_info JOIN hz_info JOIN zyjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE person_info.XM = '喻浩岚' AND hz_info.YLJGDM = '8360401' AND NOT zyjzjlb.CYKSMC LIKE '%整形科%' | css |
CREATE TABLE table_18278508_6 (
position VARCHAR,
main_contestant VARCHAR,
date_performed VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was Kashmira Shah's position on August 14?
| SELECT position FROM table_18278508_6 WHERE main_contestant = "Kashmira Shah" AND date_performed = "August 14" | sql_create_context |
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fare int
)
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_dista... | 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, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis, flight, flight_fare WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND C... | atis |
CREATE TABLE table_16099880_5 (
pole_position VARCHAR,
race VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was on the pole at Chicagoland?
| SELECT pole_position FROM table_16099880_5 WHERE race = "Chicagoland" | sql_create_context |
CREATE TABLE all_star (
player_id TEXT,
year INTEGER,
game_num INTEGER,
game_id TEXT,
team_id TEXT,
league_id TEXT,
gp NUMERIC,
starting_pos NUMERIC
)
CREATE TABLE player_award (
player_id TEXT,
award_id TEXT,
year INTEGER,
league_id TEXT,
tie TEXT,
notes TEXT
)
... | SELECT year, SUM(COUNT(*)) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' | nvbench |
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number,
Name text,
Body text,
IsHidden boolean,
Predefined boolean,
PostNoticeDurationId number
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number,
PostId number,
RevisionGUID other,
CreationDate time,
U... | SELECT c.Id, c.CreationDate, c.PostId, c.Score, c.Text, c.UserId, 'https://askubuntu.com/questions/' + CAST(PostId AS TEXT(6)) AS "Link" FROM Comments AS c WHERE UPPER(Text) LIKE UPPER('%As a famous philosopher once said%') ORDER BY CreationDate | sede |
CREATE TABLE table_28051859_3 (
tenure VARCHAR,
school VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When were the members tenured in the Field school?
| SELECT tenure FROM table_28051859_3 WHERE school = "Field" | sql_create_context |
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minutes_distant int
)
CREATE TABLE food_service (
meal_code text,
meal_number int,
compartment text,
meal_description varchar
)
CREATE TABLE restriction (
restriction_c... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHI... | atis |
CREATE TABLE table_28688313_1 (
written_by VARCHAR,
us_viewers__in_millions_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who wrote the episode with 9.81 million US viewers?
| SELECT written_by FROM table_28688313_1 WHERE us_viewers__in_millions_ = "9.81" | sql_create_context |
CREATE TABLE t_kc21 (
MED_CLINIC_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
COMP_ID text,
PERSON_ID text,
PERSON_NM text,
IDENTITY_CARD text,
SOC_SRT_CARD text,
PERSON_SEX number,
PERSON_AGE number,
IN_HOSP_DATE time,
OUT_HOSP_DATE time,
DIFF_PLACE_FLG numb... | SELECT (SELECT SUM(STA_FLG) FROM t_kc22 WHERE MED_CLINIC_ID = '66095385712') = (SELECT COUNT(*) FROM t_kc22 WHERE MED_CLINIC_ID = '66095385712') | css |
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
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... | SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.credits = 4 AND program_course.category LIKE 'ULCS' | advising |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE icustays (
ro... | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'pseudoephedrine hcl' AND DATETIME(prescriptions.startdate) >= DAT... | mimic_iii |
CREATE TABLE table_35181 (
"Year" real,
"Title" text,
"Director" text,
"Writer" text,
"Notes" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the earliest year of Wallace & Gromit: The Curse of the Were-Rabbit?
| SELECT MIN("Year") FROM table_35181 WHERE "Title" = 'wallace & gromit: the curse of the were-rabbit' | wikisql |
CREATE TABLE table_62501 (
"Club" text,
"Sport" text,
"Founded" real,
"League" text,
"Venue" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which club was founded in 1962?
| SELECT "Club" FROM table_62501 WHERE "Founded" = '1962' | wikisql |
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
CREATE TABLE Allergy_Type (
Allergy VARCHAR(20),
AllergyType VARCHAR(20)
)
CREATE TABLE Has_Allergy (
StuID INTEGE... | SELECT Sex, AVG(Age) FROM Student GROUP BY Sex ORDER BY AVG(Age) | nvbench |
CREATE TABLE table_35266 (
"Name" text,
"Term start" real,
"Term end" text,
"Date of Birth" text,
"Date of Death" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When was the start of the leader's term who was born on January 8, 1859 and whose term e... | SELECT "Term start" FROM table_35266 WHERE "Term end" = '1919' AND "Date of Birth" = 'january 8, 1859' | wikisql |
CREATE TABLE table_60594 (
"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 average total for 0 bronze?
| SELECT AVG("Total") FROM table_60594 WHERE "Bronze" < '0' | wikisql |
CREATE TABLE Transactions_Lots (
transaction_id INTEGER,
lot_id INTEGER
)
CREATE TABLE Sales (
sales_transaction_id INTEGER,
sales_details VARCHAR(255)
)
CREATE TABLE Investors (
investor_id INTEGER,
Investor_details VARCHAR(255)
)
CREATE TABLE Ref_Transaction_Types (
transaction_type_cod... | SELECT T2.date_of_transaction, COUNT(T2.date_of_transaction) FROM Ref_Transaction_Types AS T1 JOIN Transactions AS T2 ON T1.transaction_type_code = T2.transaction_type_code WHERE T2.share_count < 10 GROUP BY transaction_type_description ORDER BY COUNT(date_of_transaction) DESC | nvbench |
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 lab (
subject_id text,
hadm_id text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "WIDOWED" AND procedures.icd9_code = "8968" | mimicsql_data |
CREATE TABLE table_name_40 (
attendance INTEGER,
home VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average attendance of the game where the home team was the Blues?
| SELECT AVG(attendance) FROM table_name_40 WHERE home = "blues" | sql_create_context |
CREATE TABLE table_27011761_2 (
train_no VARCHAR,
arrival VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many trains arrive at 11:00?
| SELECT COUNT(train_no) FROM table_27011761_2 WHERE arrival = "11:00" | sql_create_context |
CREATE TABLE table_name_11 (
start INTEGER,
lost VARCHAR,
tries VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the number of starts for the player who lost fewer than 22 and has more than 4 tries?
| SELECT AVG(start) FROM table_name_11 WHERE lost < 22 AND tries > 4 | sql_create_context |
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
CREATE TABLE month (
month_number int,
month_name text
)
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
CREATE TABLE code_description (
code varchar,
descript... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FR... | atis |
CREATE TABLE table_name_97 (
away_team VARCHAR,
venue VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- In the venue Corio Oval, who was the away team?
| SELECT away_team FROM table_name_97 WHERE venue = "corio oval" | sql_create_context |
CREATE TABLE table_name_46 (
tournament VARCHAR,
date VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the tournament on 22 October 2012?
| SELECT tournament FROM table_name_46 WHERE date = "22 october 2012" | 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 Name, Price FROM Products WHERE Price BETWEEN 60 AND 120 ORDER BY Price DESC | nvbench |
CREATE TABLE table_name_15 (
poll_losses INTEGER,
wins VARCHAR,
ties VARCHAR,
poll_wins VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the lowest poll losses of the 0 ties, poll wins greater than 1 and wins less than 2?
| SELECT MIN(poll_losses) FROM table_name_15 WHERE ties = 0 AND poll_wins > 1 AND wins < 2 | 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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "80" AND prescriptions.formulary_drug_cd = "TACR5SM" | mimicsql_data |
CREATE TABLE table_name_61 (
result VARCHAR,
location VARCHAR,
odds VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the score for an n/a location with the odds of p + 1?
| SELECT result FROM table_name_61 WHERE location = "n/a" AND odds = "p + 1" | sql_create_context |
CREATE TABLE table_23919 (
"Year" text,
"Head Coach" text,
"Regular Season Record (W-L)" text,
"NEC Record" text,
"Standing" text,
"NEC Tournament Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the regular season record for standing... | SELECT "Regular Season Record (W-L)" FROM table_23919 WHERE "Standing" = '11th' | wikisql |
CREATE TABLE table_name_91 (
launched VARCHAR,
completed VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the launched for 13 september 1934 completion
| SELECT launched FROM table_name_91 WHERE completed = "13 september 1934" | sql_create_context |
CREATE TABLE table_name_38 (
points INTEGER,
name VARCHAR,
drawn VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What's the most points for Ea Schongau with more than 1 drawn?
| SELECT MAX(points) FROM table_name_38 WHERE name = "ea schongau" AND drawn > 1 | sql_create_context |
CREATE TABLE table_255602_1 (
area__km²_ VARCHAR,
population__2010_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the area where population in 2010 is 38062?
| SELECT area__km²_ FROM table_255602_1 WHERE population__2010_ = 38062 | 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 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2190" AND procedures.short_title = "Trnsplnt live nonrel don" | mimicsql_data |
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 jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb 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 jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.... | css |
CREATE TABLE table_28467 (
"Institution" text,
"Location" text,
"Nickname" text,
"Founded" real,
"Enrollment" text,
"Joined" real,
"Left" real,
"Current Conference" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When was alfred universit... | SELECT MAX("Founded") FROM table_28467 WHERE "Institution" = 'Alfred University' | wikisql |
CREATE TABLE table_name_10 (
week INTEGER,
opponent VARCHAR,
attendance VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- In what Weeks is the game against the Tampa Bay Buccaneers with less than 44,506 in Attendance?
| SELECT SUM(week) FROM table_name_10 WHERE opponent = "tampa bay buccaneers" AND attendance < 44 OFFSET 506 | sql_create_context |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
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),
CO... | SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY COUNT(HIRE_DATE) DESC | nvbench |
CREATE TABLE table_30349 (
"Season" text,
"Games" real,
"Won" real,
"Lost" real,
"Tied" real,
"Points" real,
"Goals for" real,
"Goals against" real,
"Standing" text,
"Head coaches" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- W... | SELECT "Season" FROM table_30349 WHERE "Goals against" = '254' | wikisql |
CREATE TABLE table_13570_1 (
specifically_stains VARCHAR,
nucleus VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- A nucleus that is blue/black will specifically stain what?
| SELECT specifically_stains FROM table_13570_1 WHERE nucleus = "Blue/black" | sql_create_context |
CREATE TABLE table_1346137_4 (
candidates VARCHAR,
first_elected VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who were the candidates when the winner was first elected in 1910?
| SELECT candidates FROM table_1346137_4 WHERE first_elected = "1910" | sql_create_context |
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 * FROM hz_info JOIN wdmzjzjlb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE hz_info.RYBH = '45461281' AND hz_info.YLJGDM = '2926207' AND NOT wdmzjzjlb.JZZDSM LIKE '%硅肺%' UNION SELECT * FROM hz_info JOIN bdmzjzjlb ON hz_info.YLJGDM = bdmzjzjlb.YLJGDM AND ... | css |
CREATE TABLE table_30202 (
"No." real,
"Title" text,
"Lyricist" text,
"Composer" text,
"Arrangement" text,
"Sound Engineer" text,
"Length" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many numbers are there for kam wa7ed fina?
| SELECT COUNT("No.") FROM table_30202 WHERE "Title" = 'Kam Wa7ed Fina' | wikisql |
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
CREATE TABLE Allergy_Type (
Allergy VARCHAR(20),
AllergyType VARCHAR(20)
)
CREATE TABLE Has_Allergy (
StuID INTEGE... | SELECT AllergyType, COUNT(*) FROM Allergy_Type GROUP BY AllergyType ORDER BY COUNT(*) DESC | nvbench |
CREATE TABLE table_name_98 (
attendance INTEGER,
opponent VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average attendance for the New York Jets?
| SELECT AVG(attendance) FROM table_name_98 WHERE opponent = "new york jets" | sql_create_context |
CREATE TABLE table_1341577_44 (
party VARCHAR,
incumbent VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What party did Beau Boulter represent?
| SELECT party FROM table_1341577_44 WHERE incumbent = "Beau Boulter" | sql_create_context |
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.short_title = "Oth cardiac mon output" | mimicsql_data |
CREATE TABLE table_11545282_17 (
no VARCHAR,
years_for_jazz VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the number of players that played 1987-89?
| SELECT no FROM table_11545282_17 WHERE years_for_jazz = "1987-89" | sql_create_context |
CREATE TABLE table_name_66 (
rowers VARCHAR,
country VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who are the Rowers from Poland?
| SELECT rowers FROM table_name_66 WHERE country = "poland" | sql_create_context |
CREATE TABLE table_49031 (
"Season" real,
"Level" text,
"Division" text,
"Administration" text,
"Position" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the position in the 2004 season?
| SELECT "Position" FROM table_49031 WHERE "Season" > '2004' | wikisql |
CREATE TABLE exhibition_record (
Exhibition_ID int,
Date text,
Attendance int
)
CREATE TABLE exhibition (
Exhibition_ID int,
Year int,
Theme text,
Artist_ID int,
Ticket_Price real
)
CREATE TABLE artist (
Artist_ID int,
Name text,
Country text,
Year_Join int,
Age int... | SELECT Year_Join, COUNT(Year_Join) FROM artist WHERE Country <> 'United States' GROUP BY Name | nvbench |
CREATE TABLE procedures (
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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "ASIAN" AND prescriptions.drug = "Talc" | mimicsql_data |
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE transfers (
row_id... | SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 75658) AND DATETIME(microbiologyevents.charttime) >= DATETIME(CURRENT_TIME(), '-4 year') | mimic_iii |
CREATE TABLE table_name_52 (
callsign VARCHAR,
area_served VARCHAR,
freq_currently VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Callsign in Brisbane with a Freq currently of 4rph?
| SELECT callsign FROM table_name_52 WHERE area_served = "brisbane" AND freq_currently = "4rph" | sql_create_context |
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 d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_i... | mimic_iii |
CREATE TABLE table_80273 (
"Year" text,
"Team" text,
"Chassis" text,
"Engine" text,
"Rank" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What engine was used in 1999?
| SELECT "Engine" FROM table_80273 WHERE "Year" = '1999' | wikisql |
CREATE TABLE advisor (
s_ID varchar(5),
i_ID varchar(5)
)
CREATE TABLE time_slot (
time_slot_id varchar(4),
day varchar(1),
start_hr numeric(2),
start_min numeric(2),
end_hr numeric(2),
end_min numeric(2)
)
CREATE TABLE section (
course_id varchar(8),
sec_id varchar(8),
sem... | SELECT building, COUNT(building) FROM course AS T1 JOIN section AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' GROUP BY building ORDER BY building DESC | nvbench |
CREATE TABLE table_22539 (
"Position" text,
"Country" text,
"Floor" text,
"Pommel Horse" text,
"Rings" text,
"Vault" text,
"Parallel Bars" text,
"Horizontal Bar" text,
"Team Total" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- If th... | SELECT COUNT("Vault") FROM table_22539 WHERE "Rings" = '60.000' | wikisql |
CREATE TABLE table_19847 (
"No." real,
"Date" text,
"Tournament" text,
"Winning score" text,
"To par" text,
"Margin of victory" text,
"Runner-up" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who are all runner-ups for No. 2?
| SELECT "Runner-up" FROM table_19847 WHERE "No." = '2' | wikisql |
CREATE TABLE table_46702 (
"Position" real,
"Team" text,
"Played" real,
"Drawn" real,
"Lost" real,
"Goals For" real,
"Goals Against" real,
"Goal Difference" text,
"Points 1" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- W hat was th... | SELECT MIN("Goals For") FROM table_46702 WHERE "Team" = 'goole town' AND "Position" < '9' | wikisql |
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE course (
course_id int,
name varchar,
department varchar,
number varchar,
credits varchar,
advisory_requirement varchar,
enforced_requirement varchar,
description varchar,
num_seme... | SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.credits = 8 AND program_course.category LIKE 'ULCS' | advising |
CREATE TABLE table_28210383_1 (
directed_by VARCHAR,
_number__season__number_ VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who directed # (season #) is 1 ( 2 )?
| SELECT directed_by FROM table_28210383_1 WHERE _number__season__number_ = "1 ( 2 )" | sql_create_context |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.