instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
CREATE TABLE Orders (
order_id INTEGER,
customer_id INTEGER,
date_order_placed DATETIME,
order_details VARCHAR(255)
)
CREATE TABLE Financial_Transactions (
transaction_id INTEGER,
account_id INTEGER,
invoice_number INTEGER,
transaction_type VARCHAR(15),
transaction_date DATETIME,
... | SELECT date_account_opened, COUNT(date_account_opened) FROM Accounts ORDER BY date_account_opened DESC | nvbench |
CREATE TABLE table_1702 (
"Series #" real,
"Title" text,
"Directed by" text,
"Written by" text,
"U.S. viewers (million)" text,
"Original airdate" text,
"Production Code" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When there are 12.70 mil... | SELECT "Directed by" FROM table_1702 WHERE "U.S. viewers (million)" = '12.70' | wikisql |
CREATE TABLE table_26336739_1 (
result VARCHAR,
elected VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the result for the district with an election in 1986
| SELECT result FROM table_26336739_1 WHERE elected = 1986 | sql_create_context |
CREATE TABLE problems (
problem_id number,
product_id number,
closure_authorised_by_staff_id number,
reported_by_staff_id number,
date_problem_reported time,
date_problem_closed time,
problem_description text,
other_problem_details text
)
CREATE TABLE problem_log (
problem_log_id nu... | SELECT problem_log_id, log_entry_date FROM problem_log WHERE problem_id = 10 | spider |
CREATE TABLE table_name_78 (
week INTEGER,
opponent VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average number of weeks that the opponent was the Denver Broncos?
| SELECT AVG(week) FROM table_name_78 WHERE opponent = "denver broncos" | sql_create_context |
CREATE TABLE hz_info_zyjzjlb (
JZLSH number,
YLJGDM number,
zyjzjlb_id number
)
CREATE TABLE jyjgzbb (
BGDH text,
BGRQ time,
CKZFWDX text,
CKZFWSX number,
CKZFWXX number,
JCFF text,
JCRGH text,
JCRXM text,
JCXMMC text,
JCZBDM text,
JCZBJGDL number,
JCZBJGDW t... | SELECT jybgb.BBCJBW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN 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 = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE person_info.XM = '郑和璧' AND jy... | css |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.icd9_code = "99811" | mimicsql_data |
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 WHERE demographic.gender = "F" AND demographic.diagnosis = "S/P FALL" | mimicsql_data |
CREATE TABLE table_4380 (
"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 total amount of Gold from guatemala and silver smaller than 0?
| SELECT SUM("Gold") FROM table_4380 WHERE "Nation" = 'guatemala' AND "Silver" < '0' | wikisql |
CREATE TABLE table_name_41 (
loss VARCHAR,
long VARCHAR,
name VARCHAR,
gain VARCHAR,
avg_g VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the total number of losses Jackson, T., who had more than 27 gain, an avg/g smaller than 55.9, and a... | SELECT COUNT(loss) FROM table_name_41 WHERE gain > 27 AND avg_g < 55.9 AND name = "jackson, t." AND long < 34 | sql_create_context |
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
HIRE_DATE date,
JOB_ID varchar(10),
SALARY decimal(8,2),
COMMISSION_PCT decimal(2,2),
MANAGER_ID decimal(6,0),
DEPARTMENT_ID decimal(... | SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY COUNT(HIRE_DATE) | nvbench |
CREATE TABLE table_171356_2 (
status VARCHAR,
official_name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many statuses are listed for the parish officially named Gagetown?
| SELECT COUNT(status) FROM table_171356_2 WHERE official_name = "Gagetown" | sql_create_context |
CREATE TABLE Accounts (
Id VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many accounts do we have?
| SELECT COUNT(*) FROM Accounts | sql_create_context |
CREATE TABLE table_name_16 (
pick__number INTEGER,
pl_gp INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the pick # of the player with a PI GP less than 0?
| SELECT SUM(pick__number) FROM table_name_16 WHERE pl_gp < 0 | sql_create_context |
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,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
wardid number,
intime time,
outtime time
)
... | 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 FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissi... | mimic_iii |
CREATE TABLE table_7792 (
"Name" text,
"Team" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the grid sum with more than 50 laps?
| SELECT SUM("Grid") FROM table_7792 WHERE "Laps" > '50' | 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,
... | SELECT (CAST(COUNT(a.Id) AS FLOAT) / (SELECT COUNT(p.Id) FROM Posts AS p INNER JOIN Users AS u ON p.OwnerUserId = u.Id WHERE u.Reputation > 3000 AND PostTypeId = 2) * 100) AS AcceptedPercentage FROM Posts AS q INNER JOIN Posts AS a ON q.AcceptedAnswerId = a.Id INNER JOIN Users AS u ON a.OwnerUserId = u.Id WHERE u.Reput... | sede |
CREATE TABLE Product_Suppliers (
total_amount_purchased INTEGER,
total_value_purchased INTEGER,
supplier_id VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the average amount purchased and value purchased for the supplier who supplies the most pr... | SELECT AVG(total_amount_purchased), AVG(total_value_purchased) FROM Product_Suppliers WHERE supplier_id = (SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id ORDER BY COUNT(*) DESC LIMIT 1) | sql_create_context |
CREATE TABLE table_name_83 (
visa_3 VARCHAR,
visa_1 VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Visa 3 has gui finkler as Visa 1?
| SELECT visa_3 FROM table_name_83 WHERE visa_1 = "gui finkler" | sql_create_context |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE chartevents ... | SELECT COUNT(*) > 0 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'dmii wo cmp nt st uncntr') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12307) AND DATETIME(diagnose... | mimic_iii |
CREATE TABLE mzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH text,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
KH text,
KLX number,
MJZH text,
ML number,
MZZYZDZZBM text,
MZZYZDZZMC ... | SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jyjgzbb 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 = jyjgzbb.jybgb_YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jyjgzbb.jybgb_JZLSH_MZJZJLB WHERE person_info.XM = '冯文轩'... | css |
CREATE TABLE gwyjzb (
CLINIC_ID text,
CLINIC_TYPE text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD text,
INPT_AREA_BED text,
INSURED_IDENTITY number,
INSURED_STS text,
... | SELECT gwyjzb.MED_ORG_DEPT_NM, gwyjzb.OUT_DIAG_DIS_CD, MIN(t_kc24.PER_EXP) FROM gwyjzb JOIN t_kc24 ON gwyjzb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE gwyjzb.MED_SER_ORG_NO = '3349404' GROUP BY gwyjzb.MED_ORG_DEPT_NM, gwyjzb.OUT_DIAG_DIS_CD ORDER BY MIN(t_kc24.PER_EXP / t_kc24.MED_AMOUT) UNION SELECT fgwyjzb.MED_ORG_D... | css |
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 gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_ID = '37030215' AND NOT gwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT > 2381.99) UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_ID = '37030215' AND NOT fgwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLI... | css |
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_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.t_kc21_MED_SER_ORG_NO = '1492666' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2005-11-10' AND '2020-05-05' | css |
CREATE TABLE table_16278 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"U.S. viewers (millions)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many episodes ... | SELECT "No. in season" FROM table_16278 WHERE "Title" = 'Crow''s Feet' | wikisql |
CREATE TABLE settlements (
settlement_id number,
claim_id number,
date_claim_made time,
date_claim_settled time,
amount_claimed number,
amount_settled number,
customer_policy_id number
)
CREATE TABLE payments (
payment_id number,
settlement_id number,
payment_method_code text,
... | SELECT DISTINCT customer_details FROM customers | spider |
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 INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND procedures.long_title = "Initial insertion of single-chamber device, rate responsive" | mimicsql_data |
CREATE TABLE table_name_86 (
total_capacity__mwe_ INTEGER,
power_plant VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- At the power plant located in ramakkalmedu, what is the sum of the total capacity (MWe)?
| SELECT SUM(total_capacity__mwe_) FROM table_name_86 WHERE power_plant = "ramakkalmedu" | sql_create_context |
CREATE TABLE table_41866 (
"Peel" text,
"Wins" real,
"Byes" real,
"Losses" real,
"Draws" real,
"Against" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Draws has a Wins of 10, and a Peel of south mandurah, and a Byes larger than 0?
| SELECT AVG("Draws") FROM table_41866 WHERE "Wins" = '10' AND "Peel" = 'south mandurah' AND "Byes" > '0' | wikisql |
CREATE TABLE table_71698 (
"Builder" text,
"Model" text,
"Length (ft/m)" text,
"Order Year" text,
"Fuel Propulsion" text,
"Fleet Series (Quantity)" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Fleet Series (Quantity) has an Order Year of... | SELECT "Fleet Series (Quantity)" FROM table_71698 WHERE "Order Year" = '2010' AND "Model" = 'de40lfr' | wikisql |
CREATE TABLE table_name_15 (
venue VARCHAR,
runner_up VARCHAR,
winner VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the venue of the game where hibernian won and the rangers were the runner-up?
| SELECT venue FROM table_name_15 WHERE runner_up = "rangers" AND winner = "hibernian" | sql_create_context |
CREATE TABLE accounts (
account_id number,
customer_id number,
account_name text,
other_account_details text
)
CREATE TABLE customers_cards (
card_id number,
customer_id number,
card_type_code text,
card_number text,
date_valid_from time,
date_valid_to time,
other_card_detai... | SELECT other_account_details FROM accounts WHERE account_name = "338" | spider |
CREATE TABLE film_text (
film_id number,
title text,
description text
)
CREATE TABLE address (
address_id number,
address text,
address2 text,
district text,
city_id number,
postal_code text,
phone text,
last_update time
)
CREATE TABLE inventory (
inventory_id number,
... | SELECT title, film_id FROM film WHERE rental_rate = 0.99 INTERSECT SELECT T1.title, T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id HAVING COUNT(*) < 3 | spider |
CREATE TABLE table_203_288 (
id number,
"season" text,
"premiere date" text,
"the winner" text,
"runner-up" text,
"finalists" text,
"contestants in order of elimination" text,
"number of contestants" text,
"number of concerts" number
)
-- Using valid SQLite, answer the following qu... | SELECT "premiere date" FROM table_203_288 ORDER BY "premiere date" DESC LIMIT 1 | squall |
CREATE TABLE city (
city_code varchar,
city_name varchar,
state_code varchar,
country_name varchar,
time_zone_code varchar
)
CREATE TABLE food_service (
meal_code text,
meal_number int,
compartment text,
meal_description varchar
)
CREATE TABLE flight_fare (
flight_id int,
f... | SELECT DISTINCT ground_service.transport_type FROM airport, airport_service, city, ground_service WHERE airport.airport_code = airport_service.airport_code AND city.city_code = airport_service.city_code AND city.city_name = 'DALLAS' AND ground_service.airport_code = airport.airport_code | atis |
CREATE TABLE table_22733636_1 (
tournament_winner VARCHAR,
regular_season_winner VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When Princeton was the regular season winner, who was the tournament winner?
| SELECT tournament_winner FROM table_22733636_1 WHERE regular_season_winner = "Princeton" | sql_create_context |
CREATE TABLE table_10638523_1 (
mid_hill_zone VARCHAR,
particulars_and_characteristics VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- For mid-hill zone what is the altitude?
| SELECT mid_hill_zone FROM table_10638523_1 WHERE particulars_and_characteristics = "Altitude" | sql_create_context |
CREATE TABLE mzjzjlb_jybgb (
YLJGDM_MZJZJLB text,
BGDH number,
YLJGDM number
)
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,
X... | SELECT * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb ON 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 = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.... | css |
CREATE TABLE table_name_98 (
visitor VARCHAR,
record VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Visitor in the game with a Record of 11 49 7?
| SELECT visitor FROM table_name_98 WHERE record = "11–49–7" | 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 MIN(demographic.age) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.dod_year < "2138.0" | mimicsql_data |
CREATE TABLE table_name_85 (
highest_point VARCHAR,
canton VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Canton of Vaud's highest point?
| SELECT highest_point FROM table_name_85 WHERE canton = "vaud" | sql_create_context |
CREATE TABLE table_59116 (
"Benalla DFL" text,
"Wins" real,
"Losses" real,
"Draws" real,
"Byes" real,
"Against" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What are the average byes of Bonnie Doon having more than 16 wins?
| SELECT AVG("Byes") FROM table_59116 WHERE "Benalla DFL" = 'bonnie doon' AND "Wins" > '16' | wikisql |
CREATE TABLE table_name_1 (
elevation VARCHAR,
route VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Elevation of the mountain on Route 62?
| SELECT elevation FROM table_name_1 WHERE route = 62 | sql_create_context |
CREATE TABLE table_name_49 (
standard_name VARCHAR,
version VARCHAR,
downstream_rate VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What's the standard name with an ADSL2 version and a 01.5 1.5 mbit/s downstream rate?
| SELECT standard_name FROM table_name_49 WHERE version = "adsl2" AND downstream_rate = "01.5 1.5 mbit/s" | sql_create_context |
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense text
)
CREATE TABLE SuggestedEdits (
Id number,
... | SELECT answers.Id AS "post_link" FROM Posts AS answers INNER JOIN Posts AS questions ON answers.ParentId = questions.Id WHERE answers.OwnerUserId = @UserId AND NOT questions.ClosedDate IS NULL ORDER BY answers.CreationDate DESC | sede |
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE patient (
uniquep... | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '006-133605' AND patient.wardid = 384 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1 | eicu |
CREATE TABLE table_21321804_3 (
pick__number INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest number any of the players were picked at?
| SELECT MAX(pick__number) FROM table_21321804_3 | sql_create_context |
CREATE TABLE table_name_55 (
read_by VARCHAR,
un__abridged VARCHAR,
author VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who read the unabridged novel written by John D. Fitzgerald?
| SELECT read_by FROM table_name_55 WHERE un__abridged = "unabridged" AND author = "john d. fitzgerald" | sql_create_context |
CREATE TABLE candidate (
Candidate_ID int,
People_ID int,
Poll_Source text,
Date text,
Support_rate real,
Consider_rate real,
Oppose_rate real,
Unsure_rate real
)
CREATE TABLE people (
People_ID int,
Sex text,
Name text,
Date_of_Birth text,
Height real,
Weight re... | SELECT AVG(Weight), MIN(Weight) FROM people GROUP BY Sex | nvbench |
CREATE TABLE table_7089 (
"Rank" real,
"Name" text,
"Population 1991" real,
"Population 2001" real,
"Population 2007" real,
"State" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the highest population in 1991 in Baden Bei Wien, and a 20... | SELECT MAX("Population 1991") FROM table_7089 WHERE "Name" = 'baden bei wien' AND "Population 2007" > '25,284' | wikisql |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
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,
... | SELECT jyjgzbb.JYZBLSH 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 = jybgb.JZLSH_... | css |
CREATE TABLE table_1013129_11 (
college_junior_club_team VARCHAR,
player VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What club team is Per Gustafsson play for?
| SELECT college_junior_club_team FROM table_1013129_11 WHERE player = "Per Gustafsson" | sql_create_context |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE intakeoutput (
intakeo... | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'prophylactic antibacterials - for surgery' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(),... | eicu |
CREATE TABLE table_name_73 (
rank INTEGER,
silver VARCHAR,
nation VARCHAR,
bronze VARCHAR,
gold VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the rank when bronze was more than 0, gold more than 1, Nation is japan, and silver less than 0... | SELECT AVG(rank) FROM table_name_73 WHERE bronze > 0 AND gold > 1 AND nation = "japan" AND silver < 0 | sql_create_context |
CREATE TABLE table_34798 (
"Games" real,
"Drawn" real,
"Lost" real,
"Points difference" text,
"Points" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many Games have a Lost of 6, and Points smaller than 7?
| SELECT SUM("Games") FROM table_34798 WHERE "Lost" = '6' AND "Points" < '7' | wikisql |
CREATE TABLE table_name_52 (
team_record VARCHAR,
result VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Team Record, when the Result is l 0 24?
| SELECT team_record FROM table_name_52 WHERE result = "l 0–24" | sql_create_context |
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 microlab.culturesite FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-23724' AND NOT patient.hospitaldischargetime IS NULL ORDER BY pati... | eicu |
CREATE TABLE hosting_city (
year number,
match_id number,
host_city text
)
CREATE TABLE match (
match_id number,
date text,
venue text,
score text,
result text,
competition text
)
CREATE TABLE city (
city_id number,
city text,
hanzi text,
hanyu_pinyin text,
regi... | SELECT T2.jan FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T1.city = "Shanghai" | spider |
CREATE TABLE table_73113 (
"Song" text,
"Porsgrunn" real,
"Bergen" real,
"Bod\u00f8" real,
"Stavanger" real,
"\u00c5lesund" real,
"Elverum" real,
"Troms\u00f8" real,
"Fredrikstad" real,
"Trondheim" real,
"Oslo" real,
"Total" real
)
-- Using valid SQLite, answer the foll... | SELECT "Total" FROM table_73113 WHERE "Song" = 'Radio Luxembourg' | wikisql |
CREATE TABLE table_name_67 (
tournament VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the results from 2003 that has a 2012 result of 1r and a 2004 result of 2r and from the Australian Open?
| SELECT 2003 FROM table_name_67 WHERE 2012 = "1r" AND 2004 = "2r" AND tournament = "australian open" | sql_create_context |
CREATE TABLE table_name_8 (
league VARCHAR,
sport VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Sport of gaelic football and hurling is what league?
| SELECT league FROM table_name_8 WHERE sport = "gaelic football and hurling" | sql_create_context |
CREATE TABLE table_name_93 (
mixed_doubles VARCHAR,
year VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which mixed doubles was featured in 2006?
| SELECT mixed_doubles FROM table_name_93 WHERE year = 2006 | sql_create_context |
CREATE TABLE table_47792 (
"Year" real,
"Date" text,
"Winner" text,
"Result" text,
"Loser" text,
"Location" text
)
-- 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_47792 WHERE "Location" = 'lincoln financial field' AND "Winner" = 'philadelphia eagles' AND "Date" = 'september 30' | wikisql |
CREATE TABLE table_train_173 (
"id" int,
"hiv_infection" bool,
"hemoglobin_a1c_hba1c" float,
"hepatitis_c" bool,
"hepatitis_b" bool,
"cirrhosis" bool,
"renal_disease" bool,
"hepatic_disease" bool,
"allergy_to_egg" bool,
"estimated_glomerular_filtration_rate_egfr" int,
"NOUSE"... | SELECT * FROM table_train_173 WHERE allergy_to_egg = 1 | criteria2sql |
CREATE TABLE table_72521 (
"School" text,
"Winners" real,
"Finalists" real,
"Total Finals" real,
"Year of last win" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many total finals where there when the last win was in 2012-13?
| SELECT "Total Finals" FROM table_72521 WHERE "Year of last win" = '2012-13' | wikisql |
CREATE TABLE table_36346 (
"Throne Name" text,
"Title" text,
"Born-Died" text,
"Entered office" text,
"Left office" text,
"Family Relations" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When did the king who entered office in 1012 leave office... | SELECT "Left office" FROM table_36346 WHERE "Entered office" = '1012' | wikisql |
CREATE TABLE table_46027 (
"Date" text,
"Time" text,
"Score" text,
"Set 1" text,
"Set 2" text,
"Set 3" text,
"Total" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Set 1 of 25 20, what was Set 2?
| SELECT "Set 2" FROM table_46027 WHERE "Set 1" = '25–20' | wikisql |
CREATE TABLE table_name_91 (
pick VARCHAR,
player VARCHAR,
round VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the total number for the pick of the player Wayne Fowler and a round after 7?
| SELECT COUNT(pick) FROM table_name_91 WHERE player = "wayne fowler" AND round > 7 | sql_create_context |
CREATE TABLE table_10748727_1 (
season VARCHAR,
team_name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What years did art grand prix compete?
| SELECT season FROM table_10748727_1 WHERE team_name = "ART Grand Prix" | sql_create_context |
CREATE TABLE table_37576 (
"Name" text,
"Style" text,
"Opened" real,
"Manufacturer" text,
"Themed Area" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which average Opened has a Manufacturer of vekoma?
| SELECT AVG("Opened") FROM table_37576 WHERE "Manufacturer" = 'vekoma' | wikisql |
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 demographic ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "CALCG2/100NS" | mimicsql_data |
CREATE TABLE table_204_669 (
id number,
"rank" number,
"athlete" text,
"nationality" text,
"time" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- which athlete from kenya participated but came in third place ?
| SELECT "athlete" FROM table_204_669 WHERE id = 3 | squall |
CREATE TABLE table_50887 (
"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.
-- Who won in 1991?
| SELECT "Player" FROM table_50887 WHERE "Year(s) won" = '1991' | wikisql |
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 jybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH text,
BGJGDM text,
BGJGMC text,
BGRG... | SELECT mzjzjlb.JZZDBM, mzjzjlb.JZZDSM FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE hz_info.RYBH = '81795336' | css |
CREATE TABLE PostsWithDeleted (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate time,
Score number,
ViewCount number,
Body text,
OwnerUserId number,
OwnerDisplayName text,
LastEditorUserId number,
LastEditorDispl... | SELECT p.Id, p.Title, p.Score FROM Posts AS p WHERE p.Score > 100 AND p.AnswerCount < 4 ORDER BY p.Score DESC | sede |
CREATE TABLE Order_Items (
order_item_id INTEGER,
order_id INTEGER,
product_id INTEGER,
order_quantity VARCHAR(80)
)
CREATE TABLE Customers (
customer_id INTEGER,
payment_method_code VARCHAR(15),
customer_number VARCHAR(20),
customer_name VARCHAR(80),
customer_address VARCHAR(255),
... | SELECT state_province_county, COUNT(*) FROM Addresses GROUP BY state_province_county ORDER BY COUNT(*) | nvbench |
CREATE TABLE table_71437 (
"Result" text,
"Date" text,
"Race" text,
"Venue" text,
"Group" text,
"Distance" text,
"Weight (kg)" real,
"Jockey" text,
"Winner/2nd" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which race has D. Beadman... | SELECT "Race" FROM table_71437 WHERE "Jockey" = 'd. beadman' AND "Result" = '4th' | wikisql |
CREATE TABLE table_2668401_12 (
result VARCHAR,
incumbent VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the result for Andrew Gregg?
| SELECT result FROM table_2668401_12 WHERE incumbent = "Andrew Gregg" | sql_create_context |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationD... | SELECT neighbour.TagName, COUNT(*) FROM PostTags AS pt INNER JOIN Tags AS main ON main.Id = pt.TagId INNER JOIN PostTags AS nt ON nt.PostId = pt.PostId INNER JOIN Tags AS neighbour ON nt.TagId = neighbour.Id AND neighbour.Id != main.Id WHERE main.TagName = 'google-sheets' GROUP BY neighbour.TagName ORDER BY 2 DESC | sede |
CREATE TABLE table_name_83 (
theaters INTEGER,
rank INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the Theaters that has a Rank larger than 7?
| SELECT MAX(theaters) FROM table_name_83 WHERE rank > 7 | 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND lab.label = "Magnesium" | mimicsql_data |
CREATE TABLE table_24795 (
"Pilot" text,
"Organization" text,
"Total Flights" real,
"USAF space flights" real,
"FAI space flights" real,
"Max Mach" text,
"Max speed (mph)" real,
"Max altitude (miles)" text
)
-- Using valid SQLite, answer the following questions for the tables provided ... | SELECT "USAF space flights" FROM table_24795 WHERE "Max speed (mph)" = '3822' | wikisql |
CREATE TABLE table_13923 (
"SEASON" text,
"TEAM" text,
"LEAGUE" text,
"GAMES" text,
"GOALS" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the league listed that has goals of 10?
| SELECT "LEAGUE" FROM table_13923 WHERE "GOALS" = '10' | 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 demographic.age, demographic.language FROM demographic WHERE demographic.subject_id = "31066" | mimicsql_data |
CREATE TABLE hz_info (
KH text,
KLX number,
RYBH text,
YLJGDM text
)
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,
... | SELECT AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN jybgb_jyjgzbb ON mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jybgb_jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH AND jybgb_jyjgzbb.JYZBLSH = jyjgzbb.JY... | css |
CREATE TABLE jyjgzbb (
JYZBLSH text,
YLJGDM text,
BGDH text,
BGRQ time,
JYRQ time,
JCRGH text,
JCRXM text,
SHRGH text,
SHRXM text,
JCXMMC text,
JCZBDM text,
JCFF text,
JCZBMC text,
JCZBJGDX text,
JCZBJGDL number,
JCZBJGDW text,
SBBM text,
YQBH text... | SELECT SQKS, SQKSMC FROM jybgb WHERE BGDH = '46976563661' | css |
CREATE TABLE table_47238 (
"1998" text,
"2000" text,
"2004" text,
"2007" text,
"2011" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the 1998 value if the 2000 value is 25?
| SELECT "1998" FROM table_47238 WHERE "2000" = '25' | wikisql |
CREATE TABLE table_name_12 (
finals_venue__surface_ VARCHAR,
year VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Where was the 1966 final played?
| SELECT finals_venue__surface_ FROM table_name_12 WHERE year = 1966 | sql_create_context |
CREATE TABLE table_name_22 (
round INTEGER,
pick__number VARCHAR,
position VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average Round, when Pick # is greater than 70, and when Position is Tackle?
| SELECT AVG(round) FROM table_name_22 WHERE pick__number > 70 AND position = "tackle" | sql_create_context |
CREATE TABLE airport_aircraft (
ID int,
Airport_ID int,
Aircraft_ID int
)
CREATE TABLE match (
Round real,
Location text,
Country text,
Date text,
Fastest_Qualifying text,
Winning_Pilot text,
Winning_Aircraft text
)
CREATE TABLE aircraft (
Aircraft_ID int(11),
Aircraft ... | SELECT Aircraft, COUNT(*) FROM aircraft AS T1 JOIN match AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft ORDER BY COUNT(*) | nvbench |
CREATE TABLE table_27816 (
"Position" real,
"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 provided above.
-- What is ... | SELECT "Sail Number" FROM table_27816 WHERE "Skipper" = 'Matt Allen' | wikisql |
CREATE TABLE Faculty_Participates_in (
FacID INTEGER,
actid INTEGER
)
CREATE TABLE Participates_in (
stuid INTEGER,
actid INTEGER
)
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
c... | SELECT Sex, COUNT(*) FROM Faculty WHERE Rank = "AsstProf" GROUP BY Sex ORDER BY Sex | nvbench |
CREATE TABLE table_15554 (
"Year" real,
"Award" text,
"Category" text,
"Recipient(s)" text,
"Result" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the award for the Choice TV: Breakout Star Female category?
| SELECT "Award" FROM table_15554 WHERE "Category" = 'choice tv: breakout star female' | 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 INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.short_title = "Liver transplant NEC" | mimicsql_data |
CREATE TABLE table_31439 (
"model" text,
"Sonnet" text,
"Apple" text,
"NUpowr 117" text,
"NUpowr 167" text,
"NUpowr 183" text,
"NUpowr G3" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When maker is the model what is the nupowr 167?
| SELECT "NUpowr 167" FROM table_31439 WHERE "model" = 'Maker' | wikisql |
CREATE TABLE table_72427 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" real,
"Result" text,
"Candidates" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the result for south carolina 4?
| SELECT "Result" FROM table_72427 WHERE "District" = 'South Carolina 4' | wikisql |
CREATE TABLE table_53731 (
"Outcome" text,
"Date" real,
"Tournament" text,
"Partner" text,
"Opponents in the final" text,
"Score in the final" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Score in the final with an Outcome with run... | SELECT "Score in the final" FROM table_53731 WHERE "Outcome" = 'runner-up' AND "Date" = '1970' | wikisql |
CREATE TABLE course_offering (
offering_id int,
course_id int,
semester int,
section_number int,
start_time time,
end_time time,
monday varchar,
tuesday varchar,
wednesday varchar,
thursday varchar,
friday varchar,
saturday varchar,
sunday varchar,
has_final_proje... | SELECT COUNT(*) > 0 FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.department = 'MEDEDUC' AND course.number = 499 AND program_course.category LIKE '%ULCS%' | advising |
CREATE TABLE table_name_67 (
score VARCHAR,
date VARCHAR,
away_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is Score, when Date is '13 March 1985', and when Away Team is 'Millwall'?
| SELECT score FROM table_name_67 WHERE date = "13 march 1985" AND away_team = "millwall" | sql_create_context |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugst... | SELECT COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '021-221706' AND STRFTIME('%y', patient.hospitaladmittime) <= '2104' | eicu |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.