instruction stringlengths 151 7.46k | output stringlengths 2 4.44k | source stringclasses 26
values |
|---|---|---|
CREATE TABLE table_name_97 (
ratt VARCHAR,
long VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Ratt of the year with a 78 long?
| SELECT ratt FROM table_name_97 WHERE long = "78" | sql_create_context |
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 Activity (
actid INTEGER,
activity_name varchar(25)
)
CREATE TABLE Faculty_Participates_in (
FacID IN... | SELECT Rank, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.Rank ORDER BY Rank | nvbench |
CREATE TABLE bdmzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH number,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
KH text,
KLX number,
MJZH text,
ML number,
MZZYZDZZBM text,
MZZYZDZ... | SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZ... | css |
CREATE TABLE table_name_43 (
architect VARCHAR,
built VARCHAR,
building VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the architect that built the Electric Railway Chambers before 1915?
| SELECT architect FROM table_name_43 WHERE built < 1915 AND building = "electric railway chambers" | sql_create_context |
CREATE TABLE table_name_2 (
player VARCHAR,
position VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What players have a position of F?
| SELECT player FROM table_name_2 WHERE position = "f" | sql_create_context |
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId number,
ApprovalDate time
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
... | SELECT P.Id AS "post_link", P.Tags FROM Posts AS P, PostTags AS Pt, Tags AS T WHERE P.Id = Pt.PostId AND T.Id = Pt.TagId AND T.TagName = '##tag1##' AND P.PostTypeId = 1 AND P.AnswerCount > 0 AND NOT P.AcceptedAnswerId IS NULL AND NOT (SELECT P2.Id FROM Posts AS P2 WHERE P2.Id = P.AcceptedAnswerId AND P2.Body LIKE '%##t... | sede |
CREATE TABLE table_59909 (
"Tie no" text,
"Home team" text,
"Score" text,
"Away team" text,
"Date" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who was the away team against Newton Heath?
| SELECT "Away team" FROM table_59909 WHERE "Home team" = 'newton heath' | wikisql |
CREATE TABLE table_56197 (
"Outcome" text,
"Date" real,
"Championship" text,
"Surface" text,
"Opponent" text,
"Score" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- On what Date was the Score of 3 6, 6 4, 3 6, 6 1, 6 2
| SELECT SUM("Date") FROM table_56197 WHERE "Score" = '3–6, 6–4, 3–6, 6–1, 6–2' | wikisql |
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 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '013-38992' AND patient.wardid = 561 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1 | eicu |
CREATE TABLE table_79341 (
"Rank" real,
"Group" text,
"Athlete" text,
"Nationality" text,
"Result" real
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which athlete, has an 18.55 result
| SELECT "Athlete" FROM table_79341 WHERE "Result" = '18.55' | wikisql |
CREATE TABLE fgwyjzb (
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.OUT_DIAG_DOC_CD, gwyjzb.OUT_DIAG_DOC_NM FROM gwyjzb WHERE gwyjzb.PERSON_NM = '朱淑兰' AND gwyjzb.IN_HOSP_DATE BETWEEN '2001-07-24' AND '2018-09-06' GROUP BY gwyjzb.OUT_DIAG_DOC_CD ORDER BY COUNT(*) DESC LIMIT 1 UNION SELECT fgwyjzb.OUT_DIAG_DOC_CD, fgwyjzb.OUT_DIAG_DOC_NM FROM fgwyjzb WHERE fgwyjzb.PERSON_NM... | css |
CREATE TABLE table_71693 (
"Year" real,
"Class" text,
"Vehicle" text,
"Position" text,
"Stages won" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What position did the BMW vehicle made in 2006 hold?
| SELECT "Position" FROM table_71693 WHERE "Vehicle" = 'bmw' AND "Year" = '2006' | wikisql |
CREATE TABLE Students (
student_id INTEGER,
date_of_registration DATETIME,
date_of_latest_logon DATETIME,
login_name VARCHAR(40),
password VARCHAR(10),
personal_name VARCHAR(40),
middle_name VARCHAR(40),
family_name VARCHAR(40)
)
CREATE TABLE Courses (
course_id INTEGER,
author_... | SELECT personal_name, author_id FROM Course_Authors_and_Tutors ORDER BY personal_name | nvbench |
CREATE TABLE month (
month_number int,
month_name text
)
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE fare (
fare_id int,
from_airport varchar,
to_airport varchar,
fare_basis_code text,
fare_airline text,
restriction_code text,
... | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((((flight.departure_time BETWEEN 1800 AND 2200) OR (NOT flight.departure_time BETWEEN 601 AND 1759)) AND date_day.day_number = 20 AND date_day.m... | atis |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
... | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') | eicu |
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
-- Using valid SQLite, answer the following questions for the... | SELECT T2.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T1.Price | nvbench |
CREATE TABLE table_name_82 (
new_council VARCHAR,
previous_council VARCHAR,
staying_councillors VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the full number of New Council when the previous council was 54 and the staying councilor number is big... | SELECT COUNT(new_council) FROM table_name_82 WHERE previous_council = 54 AND staying_councillors > 36 | sql_create_context |
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 JZJSSJ FROM mzjzjlb WHERE JZLSH = '45655595406' | css |
CREATE TABLE table_name_35 (
date VARCHAR,
attendance VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- On what date was the crowd size of 71,789?
| SELECT date FROM table_name_35 WHERE attendance = "71,789" | sql_create_context |
CREATE TABLE table_16388439_3 (
date VARCHAR,
home_team VARCHAR,
ground VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the date for adelaide for westpac stadium
| SELECT date FROM table_16388439_3 WHERE home_team = "Adelaide" AND ground = "Westpac Stadium" | sql_create_context |
CREATE TABLE table_974 (
"Quarter" text,
"Android" text,
"iOS" text,
"Symbian" text,
"BlackBerry OS" text,
"Linux" text,
"Windows Phone" text,
"Other" text,
"Total" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many total smartp... | SELECT COUNT("Total") FROM table_974 WHERE "Quarter" = '2012 Q1' | wikisql |
CREATE TABLE table_20174050_1 (
release_date VARCHAR,
target__number VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When was the audio book with target number 069 69 released?
| SELECT release_date FROM table_20174050_1 WHERE target__number = "069 69" | sql_create_context |
CREATE TABLE table_204_643 (
id number,
"release" number,
"artist" text,
"title" text,
"notes" text,
"album" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what song was this artist on after utabito ?
| SELECT "title" FROM table_204_643 WHERE "release" > (SELECT "release" FROM table_204_643 WHERE "title" = 'utabito (歌人 singer?)') ORDER BY "release" LIMIT 1 | squall |
CREATE TABLE table_204_771 (
id number,
"rank" number,
"nation" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- name the nations that won at least 2 gold medals .
| SELECT "nation" FROM table_204_771 WHERE "gold" >= 2 | squall |
CREATE TABLE table_7871 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What's the score on february 18 when the visitors are the montreal canadiens?
| SELECT "Score" FROM table_7871 WHERE "Visitor" = 'montreal canadiens' AND "Date" = 'february 18' | wikisql |
CREATE TABLE team (
Team_id int,
Name text
)
CREATE TABLE country (
Country_id int,
Country_name text,
Capital text,
Official_native_language text
)
CREATE TABLE player (
Player_ID int,
Player text,
Years_Played text,
Total_WL text,
Singles_WL text,
Doubles_WL text,
... | SELECT Country_name, COUNT(*) FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country GROUP BY T1.Country_name | nvbench |
CREATE TABLE table_75469 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Save" text,
"Attendance" real,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the score of the game that had a loss of Chad Fox (3 3)?
| SELECT "Score" FROM table_75469 WHERE "Loss" = 'chad fox (3–3)' | wikisql |
CREATE TABLE table_14565 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" text,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Which Record that has a Loss of mays (0-3)?
| SELECT "Record" FROM table_14565 WHERE "Loss" = 'mays (0-3)' | wikisql |
CREATE TABLE table_74944 (
"Club" text,
"Played" text,
"Drawn" text,
"Lost" text,
"Points for" text,
"Points against" text,
"Tries for" text,
"Tries against" text,
"Try bonus" text,
"Losing bonus" text,
"Points" text
)
-- Using valid SQLite, answer the following questions f... | SELECT "Drawn" FROM table_74944 WHERE "Points against" = '371' | wikisql |
CREATE TABLE table_77741 (
"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.
-- When the home team was fitzroy, what did the awa... | SELECT "Away team score" FROM table_77741 WHERE "Home team" = 'fitzroy' | wikisql |
CREATE TABLE customers (
customer_id VARCHAR
)
CREATE TABLE orders (
customer_id VARCHAR,
order_status VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Find the id of the customers who have order status both 'On Road' and 'Shipped'.
| SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "On Road" INTERSECT SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "Shipped" | sql_create_context |
CREATE TABLE table_name_17 (
away_team VARCHAR,
home_team VARCHAR,
score VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Can you tell me the Away team that has the Home team of south dragons, and the Score of 94-81?
| SELECT away_team FROM table_name_17 WHERE home_team = "south dragons" AND score = "94-81" | sql_create_context |
CREATE TABLE stadium (
id number,
name text,
home_games number,
average_attendance number,
total_attendance number,
capacity_percentage number
)
CREATE TABLE game (
stadium_id number,
id number,
season number,
date text,
home_team text,
away_team text,
score text,
... | SELECT T1.season, T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.injury = 'Foot injury' OR T3.injury = 'Knee problem' | spider |
CREATE TABLE table_80153 (
"Year" text,
"Men's singles" text,
"Women's singles" text,
"Men's doubles" text,
"Women's doubles" text,
"Mixed doubles" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Who won the Mixed doubles when Juliane Schenk won ... | SELECT "Mixed doubles" FROM table_80153 WHERE "Women's singles" = 'juliane schenk' | wikisql |
CREATE TABLE table_train_130 (
"id" int,
"gender" string,
"systolic_blood_pressure_sbp" int,
"right_bundle_branch_block" bool,
"space_occupying_cerebral_lesion" bool,
"huntington_disease" bool,
"psychiatric_disease" bool,
"mental_illness" bool,
"treatment_regimen" bool,
"psychoti... | SELECT * FROM table_train_130 WHERE hypertension = 1 OR (diastolic_blood_pressure_dbp < 95 OR systolic_blood_pressure_sbp < 160) OR right_bundle_branch_block = 1 | criteria2sql |
CREATE TABLE t_kc21_t_kc22 (
MED_CLINIC_ID text,
MED_EXP_DET_ID number
)
CREATE TABLE t_kc21 (
CLINIC_ID text,
CLINIC_TYPE text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD ... | SELECT COUNT(*) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '4944209' AND t_kc21.IN_HOSP_DATE BETWEEN '2019-11-19' AND '2020-02-23' AND t_kc21.REMOTE_SETTLE_FLG = '异地1' OR t_kc21.REMOTE_SETTLE_FLG = '异地2' | css |
CREATE TABLE Ref_Document_Types (
document_type_code CHAR(15),
document_type_description VARCHAR(255)
)
CREATE TABLE Ref_Shipping_Agents (
shipping_agent_code CHAR(15),
shipping_agent_name VARCHAR(255),
shipping_agent_description VARCHAR(255)
)
CREATE TABLE Circulation_History (
document_id IN... | SELECT receipt_date, COUNT(receipt_date) FROM Documents ORDER BY COUNT(receipt_date) | nvbench |
CREATE TABLE Allergy_Type (
Allergy VARCHAR(20),
AllergyType VARCHAR(20)
)
CREATE TABLE Has_Allergy (
StuID INTEGER,
Allergy VARCHAR(20)
)
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER... | SELECT AllergyType, COUNT(*) FROM Allergy_Type GROUP BY AllergyType ORDER BY AllergyType DESC | nvbench |
CREATE TABLE table_39380 (
"Year" real,
"English title" text,
"Original title" text,
"Country" text,
"Director" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Original title of das leben der anderen had what director?
| SELECT "Director" FROM table_39380 WHERE "Original title" = 'das leben der anderen' | wikisql |
CREATE TABLE table_name_81 (
goals INTEGER,
apps VARCHAR,
team VARCHAR,
season VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average Goals for team Kairat, in the 2002 season with more than 29 apps?
| SELECT AVG(goals) FROM table_name_81 WHERE team = "kairat" AND season = "2002" AND apps > 29 | sql_create_context |
CREATE TABLE table_name_55 (
total_apps VARCHAR,
league_cup_apps VARCHAR,
position VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Total Apps when League Cup Apps is 0 (1), and position is df?
| SELECT total_apps FROM table_name_55 WHERE league_cup_apps = "0 (1)" AND position = "df" | sql_create_context |
CREATE TABLE table_40871 (
"Round" real,
"Pick" real,
"Player" text,
"Position" text,
"School" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What school did draft pick from round 3 go to?
| SELECT "School" FROM table_40871 WHERE "Round" = '3' | wikisql |
CREATE TABLE table_44803 (
"Outcome" text,
"Date" text,
"Tournament" text,
"Surface" text,
"Opponent" text,
"Score" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is Score, when Date is 10 July 2011?
| SELECT "Score" FROM table_44803 WHERE "Date" = '10 july 2011' | wikisql |
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CRE... | SELECT q.Id AS "post_link", q.Score AS "Question Score", MAX(a.Score) AS "Top Answer Score", CAST(q.Score AS FLOAT) / CAST(CASE WHEN MAX(a.Score) = 0 THEN 1 ELSE MAX(a.Score) END AS FLOAT) AS Ratio FROM Posts AS q INNER JOIN Posts AS a ON q.PostTypeId = 1 AND a.ParentId = q.Id GROUP BY q.Id, q.Score ORDER BY Ratio DESC... | sede |
CREATE TABLE table_203_790 (
id number,
"week" number,
"date" text,
"opponent" text,
"result" text,
"attendance" number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- was attendance higher week 4 or week 8 ?
| SELECT "week" FROM table_203_790 WHERE "week" IN (4, 8) ORDER BY "attendance" DESC LIMIT 1 | squall |
CREATE TABLE table_name_50 (
nation VARCHAR,
name VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What country did Chris Witty represent?
| SELECT nation FROM table_name_50 WHERE name = "chris witty" | sql_create_context |
CREATE TABLE table_name_9 (
venue VARCHAR,
competition VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What venue was the 2000 AFC Asian Cup qualification held at?
| SELECT venue FROM table_name_9 WHERE competition = "2000 afc asian cup qualification" | sql_create_context |
CREATE TABLE table_name_94 (
finish VARCHAR,
player VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Name the finish for lee janzen
| SELECT finish FROM table_name_94 WHERE player = "lee janzen" | 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.expire_flag = "0" AND procedures.icd9_code = "3512" | mimicsql_data |
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 prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time... | SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'therapeu plasmapheres... | mimic_iii |
CREATE TABLE repair_assignment (
technician_id int,
repair_ID int,
Machine_ID int
)
CREATE TABLE machine (
Machine_ID int,
Making_Year int,
Class text,
Team text,
Machine_series text,
value_points real,
quality_rank int
)
CREATE TABLE technician (
technician_id real,
Na... | SELECT Name, COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_id = T2.technician_id GROUP BY T2.Name ORDER BY Name | nvbench |
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,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 regions (
REGION_ID decimal(5,0),
... | SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID | nvbench |
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId n... | SELECT p.Id AS "post_link", ph.CreationDate AS "closure_date", ph.Comment AS "close_reason", ph.Text AS Voters FROM PostHistory AS ph INNER JOIN Posts AS p ON p.Id = ph.PostId WHERE ph.PostHistoryTypeId = 10 ORDER BY ph.CreationDate DESC | sede |
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE employees (
EMPLOYE... | SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID) | nvbench |
CREATE TABLE table_name_24 (
attendance VARCHAR,
away_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- WHAT IS THE ATTENDANCE WITH A READING AWAY TEAM?
| SELECT attendance FROM table_name_24 WHERE away_team = "reading" | sql_create_context |
CREATE TABLE table_48398 (
"Region" text,
"Date" text,
"Label" text,
"Format" text,
"Catalog" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When did the United Kingdom format a stereo LP?
| SELECT "Date" FROM table_48398 WHERE "Region" = 'united kingdom' AND "Format" = 'stereo lp' | wikisql |
CREATE TABLE table_18159601_1 (
status VARCHAR,
city VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the status in vestal
| SELECT status FROM table_18159601_1 WHERE city = "Vestal" | sql_create_context |
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CRE... | SELECT (SELECT vitalperiodic.systemicmean FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-88691') AND patient.unitdischargetime IS N... | eicu |
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.admityear < "2156" AND procedures.long_title = "Laryngoscopy and other tracheoscopy" | mimicsql_data |
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
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
)
... | SELECT meter_200, SUM(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 DESC | nvbench |
CREATE TABLE table_45035 (
"Heat" real,
"Lane" real,
"Name" text,
"Country" text,
"Mark" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- When the lane is under 2 and the name is virgen benavides with a mark of 7.29, what's the total number of Heat fo... | SELECT COUNT("Heat") FROM table_45035 WHERE "Mark" = '7.29' AND "Name" = 'virgen benavides' AND "Lane" < '2' | wikisql |
CREATE TABLE table_14849 (
"Name" text,
"Code" text,
"Capacity" text,
"Power" text,
"Acceleration 0\u2013100km/h" text,
"Top speed" text,
"Combined consumption" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what is the capacity when the cod... | SELECT "Capacity" FROM table_14849 WHERE "Code" = 'd4f bi-fuel 732' | wikisql |
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
... | SELECT u.Location, u.Id, u.Reputation FROM Users AS u WHERE u.Location = 'Cheyenne, WY' | sede |
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 AVG(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_AGE > 20 UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_AGE > 20) | css |
CREATE TABLE table_11174 (
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Date with a Result of 8 2, and a Score with 6 2?
| SELECT "Date" FROM table_11174 WHERE "Result" = '8–2' AND "Score" = '6–2' | wikisql |
CREATE TABLE table_204_668 (
id number,
"#" number,
"menteri besar" text,
"took office" text,
"left office" text,
"party" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- what was the date the last person on the list left office ?
| SELECT "left office" FROM table_204_668 ORDER BY id DESC LIMIT 1 | squall |
CREATE TABLE table_28578 (
"Athlete" text,
"Event" text,
"Round of 32" text,
"Round of 16" text,
"Quarterfinals" text,
"Semifinals" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many times was lakpa tashi sherpa ( bhu ) w pts 12-5 in round ... | SELECT COUNT("Round of 16") FROM table_28578 WHERE "Round of 32" = 'Lakpa Tashi Sherpa ( BHU ) W PTS 12-5' | wikisql |
CREATE TABLE table_204_975 (
id number,
"year" number,
"competition" text,
"location" text,
"event" text,
"final-rank" text,
"final-score" number,
"qualifying rank" number,
"qualifying score" number
)
-- Using valid SQLite, answer the following questions for the tables provided abo... | SELECT "competition" FROM table_204_975 GROUP BY "competition" HAVING COUNT("event") = 1 | squall |
CREATE TABLE table_75507 (
"Season" text,
"Competition" text,
"Round" text,
"Club" text,
"Home result" text,
"Away result" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Away result of 0 3, and a Season of 1969-70 is what competition?
| SELECT "Competition" FROM table_75507 WHERE "Away result" = '0–3' AND "Season" = '1969-70' | 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 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "CHRISTIAN SCIENTIST" AND lab.label = "Total Protein, Urine" | mimicsql_data |
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 mzjzjlb.JZJSSJ FROM mzjzjlb WHERE mzjzjlb.JZLSH = '47178546840' | css |
CREATE TABLE table_203_450 (
id number,
"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 abo... | SELECT COUNT("team") FROM table_203_450 WHERE "manner of departure" = 'contract terminated' | squall |
CREATE TABLE Student (
age INTEGER
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- Show the minimum, average, and maximum age of all students.
| SELECT MIN(age), AVG(age), MAX(age) FROM Student | sql_create_context |
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 qtb.OUT_DIAG_DIS_CD, qtb.OUT_DIAG_DIS_NM FROM qtb WHERE qtb.PERSON_NM = '邹宏富' AND qtb.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 6492.34) UNION SELECT gyb.OUT_DIAG_DIS_CD, gyb.OUT_DIAG_DIS_NM FROM gyb WHERE gyb.PERSON_NM = '邹宏富' AND gyb.MED_CLINIC_ID IN (SELECT t_kc24.MED_... | css |
CREATE TABLE t_kc21 (
CLINIC_ID text,
CLINIC_TYPE text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD text,
INPT_AREA_BED text,
INSURED_IDENTITY number,
INSURED_STS text,
... | SELECT t_kc21.OUT_DIAG_DIS_CD, t_kc21.OUT_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_ID = '48858661' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 759.51) | css |
CREATE TABLE table_17783 (
"Day" text,
"Sunday Surya (the Sun)" text,
"Monday Soma (the Moon)" text,
"Tuesday Mangala (Mars)" text,
"Wednesday Budha (Mercury)" text,
"Thursday Guru (Jupiter)" text,
"Friday Shukra (Venus)" text,
"Saturday Shani (Saturn)" text
)
-- Using valid SQLite, an... | SELECT "Saturday Shani (Saturn)" FROM table_17783 WHERE "Sunday Surya (the Sun)" = 'ஞாயிற்று கிழமை Nyāyitru kizhamai' | wikisql |
CREATE TABLE table_name_13 (
gold INTEGER,
rank VARCHAR,
silver VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the average number of golds for teams in rank 17 with more than 4 silver?
| SELECT AVG(gold) FROM table_name_13 WHERE rank = "17" AND silver > 4 | sql_create_context |
CREATE TABLE table_name_30 (
pick INTEGER,
player VARCHAR,
round VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the highest Pick for Lonnie Brockman before round 9?
| SELECT MAX(pick) FROM table_name_30 WHERE player = "lonnie brockman" AND round < 9 | sql_create_context |
CREATE TABLE table_42627 (
"Position" real,
"Team" text,
"Points" real,
"Played" real,
"Drawn" real,
"Lost" real,
"Against" real,
"Difference" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- How many average plays have points greater than... | SELECT AVG("Played") FROM table_42627 WHERE "Points" > '14' AND "Against" > '17' | wikisql |
CREATE TABLE race (
race_id number,
name text,
class text,
date text,
track_id text
)
CREATE TABLE track (
track_id number,
name text,
location text,
seating number,
year_opened number
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- W... | SELECT DISTINCT location FROM track | spider |
CREATE TABLE table_57043 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" text,
"Record" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the attendance at the Red Sox game that had a loss of Wakefield (7 10)?
| SELECT "Attendance" FROM table_57043 WHERE "Loss" = 'wakefield (7–10)' | 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 t_kc21.MED_ORG_DEPT_NM, t_kc21.IN_DIAG_DIS_CD, AVG(t_kc21.PERSON_AGE) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '8040470' GROUP BY t_kc21.MED_ORG_DEPT_NM, t_kc21.IN_DIAG_DIS_CD | css |
CREATE TABLE table_26633 (
"Name" text,
"Deceased Spouse" text,
"Cause of Death" text,
"Date of Spouses Death" text,
"Length of Marriage" text,
"Children Together" text,
"Current Marital Status" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
--... | SELECT "Deceased Spouse" FROM table_26633 WHERE "Length of Marriage" = '4 years' | wikisql |
CREATE TABLE degrees (
year number,
campus number,
degrees number
)
CREATE TABLE discipline_enrollments (
campus number,
discipline number,
year number,
undergraduate number,
graduate number
)
CREATE TABLE enrollments (
campus number,
year number,
totalenrollment_ay number,... | SELECT campus FROM campuses WHERE year = 1958 | spider |
CREATE TABLE table_1601792_4 (
site VARCHAR,
television_station VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What site(s) for tv station tv3?
| SELECT site FROM table_1601792_4 WHERE television_station = "TV3" | sql_create_context |
CREATE TABLE table_name_30 (
name VARCHAR,
year VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What actor made a film in 1957?
| SELECT name FROM table_name_30 WHERE year = "1957" | sql_create_context |
CREATE TABLE university (
School_ID int,
School text,
Location text,
Founded real,
Affiliation text,
Enrollment real,
Nickname text,
Primary_conference text
)
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Per... | SELECT All_Home, SUM(School_ID) FROM basketball_match GROUP BY All_Home | nvbench |
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
sc... | SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instr... | advising |
CREATE TABLE checking (
custid number,
balance number
)
CREATE TABLE savings (
custid number,
balance number
)
CREATE TABLE accounts (
custid number,
name text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the total balance of savings acco... | SELECT SUM(T2.balance) FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T1.name <> 'Brown' | spider |
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CRE... | SELECT p.Id, COUNT(pht.Name) FROM Posts AS p, PostTypes AS pt, PostHistoryTypes AS pht, PostHistory AS ph WHERE p.Id = ph.PostId AND ph.PostHistoryTypeId = pht.Id AND p.PostTypeId = pt.Id AND pt.Name = 'Question' AND pht.Id IN (17, 35, 36) GROUP BY p.Id ORDER BY p.Id | sede |
CREATE TABLE Activity (
actid INTEGER,
activity_name varchar(25)
)
CREATE TABLE Faculty (
FacID INTEGER,
Lname VARCHAR(15),
Fname VARCHAR(15),
Rank VARCHAR(15),
Sex VARCHAR(1),
Phone INTEGER,
Room VARCHAR(5),
Building VARCHAR(13)
)
CREATE TABLE Faculty_Participates_in (
Fac... | SELECT Rank, COUNT(Rank) FROM Faculty GROUP BY Rank | nvbench |
CREATE TABLE table_name_83 (
crowd INTEGER,
away_team VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What was the smallest crowd for a Melbourne away game?
| SELECT MIN(crowd) FROM table_name_83 WHERE away_team = "melbourne" | sql_create_context |
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname var... | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Ej Westlake%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offer... | advising |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE lab (
labid numb... | SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-49375')) AND intakeoutput.cellpath LIKE '%intake%... | eicu |
CREATE TABLE table_26041144_16 (
catches INTEGER,
player VARCHAR
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- If the player is Hashan Tillakaratne, what is the catches minimum?
| SELECT MIN(catches) FROM table_26041144_16 WHERE player = "Hashan Tillakaratne" | sql_create_context |
CREATE TABLE table_50160 (
"Outcome" text,
"Date" text,
"Tournament" text,
"Surface" text,
"Partner" text,
"Opponents" text,
"Score" text
)
-- Using valid SQLite, answer the following questions for the tables provided above.
-- What is the Outcome of the match with Partner Andoni Vivanco?... | SELECT "Outcome" FROM table_50160 WHERE "Partner" = 'andoni vivanco' | wikisql |
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE PostHistory (
Id number,
PostHistoryTypeId number... | SELECT DATEADD(week, DATEDIFF(day, '20000109', CreationDate) / 7, '20000109') AS "week", COUNT(DISTINCT Posts.Id) AS Posts, COUNT(Posts.AcceptedAnswerId) * 100 / COUNT(DISTINCT Posts.Id) AS PercentWithAcceptedAnswer, SUM(Posts.AnswerCount) AS Answers, SUM(Posts.CommentCount) AS Comments FROM Posts INNER JOIN PostTags O... | sede |
CREATE TABLE flight (
aircraft_code_sequence text,
airline_code varchar,
airline_flight text,
arrival_time int,
connections int,
departure_time int,
dual_carrier text,
flight_days text,
flight_id int,
flight_number int,
from_airport varchar,
meal_code text,
stops int,... | SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'SEATTLE' AND ground_service.city_code = city.city_code | atis |
CREATE TABLE jybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH text,
BGJGDM text,
BGJGMC text,
BGRGH text,
BGRQ time,
BGRXM text,
BGSJ time,
CJRQ time,
JSBBRQSJ time,
JSBBSJ time,
JYBBH text,
JYJGMC text,
JYJSGH text,
JYJSQM text,
JY... | SELECT jybgb.BGRQ FROM jybgb WHERE jybgb.BGDH = '45430196189' | css |
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE Tags (
Id number,
TagName text,
C... | SELECT YEAR(Posts.ClosedDate) AS y, MONTH(Posts.ClosedDate) AS m, CAST(YEAR(Posts.ClosedDate) AS TEXT(10)) + '/' + CAST(MONTH(Posts.ClosedDate) AS TEXT(19)) AS ym, COUNT(CONCAT('http://programmers.stackexchange.com/q/', Posts.Id)) AS Questions FROM PostHistory JOIN Posts ON Posts.Id = PostHistory.PostId WHERE Posts.Clo... | sede |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.