context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE table_1140116_6 (
race_name VARCHAR,
circuit VARCHAR
) | How many races take place in Dessau circuit? | SELECT COUNT(race_name) FROM table_1140116_6 WHERE circuit = "Dessau" | sql_create_context |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
... | how many patients were given the drug citalopram hydrobromide? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Citalopram Hydrobromide" | mimicsql_data |
CREATE TABLE Courses (
course_id INTEGER,
author_id INTEGER,
subject_id INTEGER,
course_name VARCHAR(120),
course_description VARCHAR(255)
)
CREATE TABLE Student_Tests_Taken (
registration_id INTEGER,
date_test_taken DATETIME,
test_result VARCHAR(255)
)
CREATE TABLE Student_Course_Enro... | What are the student IDs and middle names of the students enrolled in at most two courses, rank x axis from low to high order please. | SELECT T2.middle_name, T1.student_id FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id ORDER BY T2.middle_name | nvbench |
CREATE TABLE table_40797 (
"Free" text,
"Free polite" text,
"Genitive 1" text,
"Genitive 2" text,
"Genitive 3" text
) | Which Free polite has a Genitive 1 of *=ku? | SELECT "Free polite" FROM table_40797 WHERE "Genitive 1" = '*=ku' | wikisql |
CREATE TABLE table_27170987_5 (
total_goals INTEGER,
league_goals VARCHAR
) | What is the lowest number of total goals for a player with 6 league goals? | SELECT MIN(total_goals) FROM table_27170987_5 WHERE league_goals = 6 | sql_create_context |
CREATE TABLE table_51248 (
"Team" text,
"Games Played" real,
"Wins" real,
"Losses" real,
"Ties" real,
"Goals For" real,
"Goals Against" real
) | Which team has the most ties with fewer than 4 losses and GA smaller than 20? | SELECT MAX("Ties") FROM table_51248 WHERE "Losses" < '4' AND "Goals Against" < '20' | wikisql |
CREATE TABLE hz_info (
KH text,
KLX number,
YLJGDM text,
RYBH text
)
CREATE TABLE person_info (
RYBH text,
XBDM number,
XBMC text,
XM text,
CSRQ time,
CSD text,
MZDM text,
MZMC text,
GJDM text,
GJMC text,
JGDM text,
JGMC text,
XLDM text,
XLMC text... | 在这个编号为29694116748的住院就诊中,查一下主要诊断的名称列表、编码类型和编码列表 | SELECT ZYBMLX, ZYZDBM, ZYZDMC FROM zyjzjlb WHERE JZLSH = '29694116748' | css |
CREATE TABLE climber (
Climber_ID int,
Name text,
Country text,
Time text,
Points real,
Mountain_ID int
)
CREATE TABLE mountain (
Mountain_ID int,
Name text,
Height real,
Prominence real,
Range text,
Country text
) | What are the number of the countries of mountains with height bigger than 5000?, and sort names from high to low order. | SELECT Country, COUNT(Country) FROM mountain WHERE Height > 5000 GROUP BY Country ORDER BY Country DESC | nvbench |
CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE employees (
EMPLO... | For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of hire_date and the average of salary bin hire_date by weekday, could you order the average of salary in ascending order? | SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(SALARY) | nvbench |
CREATE TABLE program (
program_id int,
name varchar,
college varchar,
introduction varchar
)
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total_gpa float,
entered_as varchar,
admi... | In order to fulfill the ULCS requirement , which classes are the easiest ? | SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_co... | advising |
CREATE TABLE table_train_48 (
"id" int,
"in_another_study" bool,
"renal_disease" bool,
"receiving_vasopressor" bool,
"sepsis" bool,
"hypotension" bool,
"septic_shock" bool,
"age" float,
"NOUSE" float
) | enrolled in a competing study | SELECT * FROM table_train_48 WHERE in_another_study = 1 | criteria2sql |
CREATE TABLE table_name_28 (
length VARCHAR,
remarks VARCHAR
) | What is the length of the highway with remarks that it was replaced by lp 20? | SELECT length FROM table_name_28 WHERE remarks = "replaced by lp 20" | sql_create_context |
CREATE TABLE table_21786 (
"Poll Source" text,
"Dates administered" text,
"Democrat: John Lynch" text,
"Republican: Joe Kenney" text,
"Lead Margin" real
) | Namethe democrat john lynch for joe kenney being 27% | SELECT "Democrat: John Lynch" FROM table_21786 WHERE "Republican: Joe Kenney" = '27%' | wikisql |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (... | What is the number of patients on multivitamins prescription who died in or before the year the year 2164? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2164.0" AND prescriptions.drug = "Multivitamins" | mimicsql_data |
CREATE TABLE table_name_61 (
team VARCHAR
) | Name the 1st match for brisbane bears | SELECT 1 AS st_match FROM table_name_61 WHERE team = "brisbane bears" | sql_create_context |
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... | 能列举出患者编号87435774在2013年5月27日到2018年10月29日内所有检验报告单中的标本搜集部位吗? | SELECT jybgb.BBCJBW FROM hz_info JOIN mzjzjlb JOIN jybgb 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 WHERE hz_info.RYBH = '87435774' AND jybgb.BGRQ BETWEEN '2013-05-27' AND '2018-10-29' UNI... | css |
CREATE TABLE table_78811 (
"Election" text,
"1st Member" text,
"1st Party" text,
"2nd Member" text,
"2nd Party" text
) | What election has a 1st member of richard blakemore and a 2nd member of william goodenough hayter? | SELECT "Election" FROM table_78811 WHERE "2nd Member" = 'william goodenough hayter' AND "1st Member" = 'richard blakemore' | wikisql |
CREATE TABLE table_name_46 (
example VARCHAR,
environment VARCHAR
) | Name the example when the environment is #_x | SELECT example FROM table_name_46 WHERE environment = "#_x" | sql_create_context |
CREATE TABLE table_8987 (
"Side" text,
"Group" text,
"Inscription" text,
"Official history" text,
"Identification" text
) | Which side has Orcagna as the inscription? | SELECT "Side" FROM table_8987 WHERE "Inscription" = 'orcagna' | wikisql |
CREATE TABLE table_name_25 (
diameter__km_ INTEGER,
latitude VARCHAR
) | COunt the sum of Diameter (km) which has a Latitude of 62.7n? | SELECT SUM(diameter__km_) FROM table_name_25 WHERE latitude = "62.7n" | sql_create_context |
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE student_record (
student_id int,
course_id int,
semester int,
grade varchar,
how varchar,
transfer_source varchar,
earn_credit varchar,
repeat_term varchar,
test_id varchar
)
CREATE TABLE requirement (... | What requirements are there for a degree in CS-LSA ? | SELECT DISTINCT program_requirement.additional_req, program_requirement.category, program_requirement.min_credit, program.name FROM program, program_requirement WHERE program.name LIKE '%CS-LSA%' AND program.program_id = program_requirement.program_id | advising |
CREATE TABLE table_name_82 (
manufacturer VARCHAR,
wheel_arrangement VARCHAR,
year_made VARCHAR
) | What is the manufacturer with a wheel arrangement of 2-8-0, and Year made of 1883? | SELECT manufacturer FROM table_name_82 WHERE wheel_arrangement = "2-8-0" AND year_made = "1883" | sql_create_context |
CREATE TABLE table_204_689 (
id number,
"year" number,
"title" text,
"album" text,
"uk" number,
"b-sides" text
) | which title has no b sides ? | SELECT "title" FROM table_204_689 WHERE "b-sides" IS NULL | squall |
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
)
... | how many patients have stayed in the hospital for more than 16 days with a globulin lab test done? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "16" AND lab.label = "Globulin" | mimicsql_data |
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total_gpa float,
entered_as varchar,
admit_term int,
predicted_graduation_semester int,
degree varchar,
minor varchar,
internship varch... | When does the class meet for RCHUMS 218 ? | SELECT DISTINCT course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_i... | advising |
CREATE TABLE table_65630 (
"Club" text,
"Total points" text,
"Bonus points" text,
"Match points" text,
"Games" text,
"Drawn" text,
"Lost" text,
"Points for" text,
"Points against" text,
"Diff" text
) | Which lost has 84 as the match points? | SELECT "Lost" FROM table_65630 WHERE "Match points" = '84' | wikisql |
CREATE TABLE bank (
branch_id number,
bname text,
no_of_customers number,
city text,
state text
)
CREATE TABLE customer (
cust_id text,
cust_name text,
acc_type text,
acc_bal number,
no_of_loans number,
credit_score number,
branch_id number,
state text
)
CREATE TABL... | Find the branch name of the bank that has the most number of customers. | SELECT bname FROM bank ORDER BY no_of_customers DESC LIMIT 1 | spider |
CREATE TABLE PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE SuggestedEditVotes (
... | Search for gold badge holders in Python tag. | SELECT u.Id AS "user_link", b.Name FROM Users AS u INNER JOIN Badges AS b ON b.UserId = u.Id WHERE b.Class = 1 AND b.Name = 'python' GROUP BY u.Id, b.Name | sede |
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time... | since 3 years ago patient 005-86645 had been in an er? | SELECT COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '005-86645' AND patient.hospitaladmitsource = 'emergency department' AND DATETIME(patient.unitadmittime) >= DATETIME(CURRENT_TIME(), '-3 year') | eicu |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
... | give me the number of patients whose year of birth is less than 1879 and lab test name is hematocrit, calculated? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "1879" AND lab.label = "Hematocrit, Calculated" | mimicsql_data |
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
dual_airline varchar,
service_name text
)
CREATE TABLE compartment_class (
compartment varchar,
class_type varchar
)
CREATE TABLE airport (
airport_code varchar,
airport_name text,
... | okay i would like to know the type of aircraft used on a flight from CLEVELAND to DALLAS please | SELECT DISTINCT aircraft.basic_type FROM aircraft, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, equipment_sequence, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'CLEVELAND' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_... | atis |
CREATE TABLE table_41847 (
"Year" text,
"League" text,
"Reg. Season" text,
"Playoffs" text,
"Lost" real
) | What is the League with a Year that is 1990/91? | SELECT "League" FROM table_41847 WHERE "Year" = '1990/91' | wikisql |
CREATE TABLE table_45510 (
"Position" real,
"Pilot" text,
"Glider" text,
"Speed" text,
"Distance" text
) | How far did the pilot go when averaging 124.1km/h? | SELECT "Distance" FROM table_45510 WHERE "Speed" = '124.1km/h' | wikisql |
CREATE TABLE table_15861776_1 (
directed_by VARCHAR,
tv_broadcast VARCHAR
) | Who directed the TV broadcast s03e19? | SELECT directed_by FROM table_15861776_1 WHERE tv_broadcast = "S03E19" | sql_create_context |
CREATE TABLE table_64390 (
"School" text,
"Location" text,
"Mascot" text,
"Enrollment" real,
"IHSAA Class" text,
"County" text,
"Year Joined" real,
"Previous Conference" text
) | Which IHSAA Class has a Location of linton? | SELECT "IHSAA Class" FROM table_64390 WHERE "Location" = 'linton' | wikisql |
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose_val_rx text,
dose_unit_rx text,
route text
)
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
... | patient 3929 was prescribed sterile water in this month? | SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3929) AND prescriptions.drug = 'sterile water' AND DATETIME(prescriptions.startdate, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') | mimic_iii |
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,
... | 患者水雯华就诊过的医院有哪几家,时间是从01年12月24日到08年4月20日 | SELECT COUNT(t_kc21.MED_SER_ORG_NO) FROM t_kc21 WHERE t_kc21.PERSON_NM = '水雯华' AND t_kc21.IN_HOSP_DATE BETWEEN '2001-12-24' AND '2008-04-20' | css |
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
... | Vote count by vote type. | SELECT vt.Name, COUNT(*) FROM Votes AS v INNER JOIN VoteTypes AS vt ON v.VoteTypeId = vt.Id GROUP BY vt.Name ORDER BY vt.Name | sede |
CREATE TABLE document_structures (
document_structure_code text,
parent_document_structure_code text,
document_structure_description text
)
CREATE TABLE documents (
document_code text,
document_structure_code text,
document_type_code text,
access_count number,
document_name text
)
CREA... | List all the document names which contains 'CV'. | SELECT document_name FROM documents WHERE document_name LIKE "%CV%" | spider |
CREATE TABLE table_22830 (
"DMA" real,
"Market" text,
"Station" text,
"Frequency" text,
"Branding" text,
"Format" text
) | What is the dma of branding is big oldies 107.3 with the station warv-fm? | SELECT "DMA" FROM table_22830 WHERE "Branding" = 'Big Oldies 107.3' AND "Station" = 'WARV-FM' | wikisql |
CREATE TABLE t_kc24 (
ACCOUNT_DASH_DATE time,
ACCOUNT_DASH_FLG number,
CASH_PAY number,
CIVIL_SUBSIDY number,
CKC102 number,
CLINIC_ID text,
CLINIC_SLT_DATE time,
COMP_ID text,
COM_ACC_PAY number,
COM_PAY number,
DATA_ID text,
ENT_ACC_PAY number,
ENT_PAY number,
F... | 一一年十月十七日到一八年十一月四日,在2596003医院有多少科室涉及医疗费总额不超过1825.05元 | SELECT COUNT(*) FROM (SELECT t_kc21.MED_ORG_DEPT_CD FROM t_kc21 JOIN t_kc24 JOIN t_kc21_t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc24.MED_CLINIC_ID AND t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID WHERE t_kc21.MED_SER_ORG_NO = '2596003' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2011-10-17' AND '2018-11-04' GROUP B... | css |
CREATE TABLE table_name_64 (
height_m___ft VARCHAR,
street_address VARCHAR
) | What is the height m/ft where 207 w. hastings st. is the address? | SELECT height_m___ft FROM table_name_64 WHERE street_address = "207 w. hastings st." | sql_create_context |
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | Gold/Silver/Bronze badges over time (2010). | WITH GoldBadges AS (SELECT DATEADD(m, MONTH(Date), '2010-12-01') AS CurDate, COUNT(Id) AS BadgeTotal FROM Badges WHERE (YEAR(Date) = 2011) AND (Class = 1) GROUP BY YEAR(Date), MONTH(Date)), SilverBadges AS (SELECT DATEADD(m, MONTH(Date), '2010-12-01') AS CurDate, COUNT(Id) AS BadgeTotal FROM Badges WHERE (YEAR(Date) = ... | sede |
CREATE TABLE table_204_75 (
id number,
"year" number,
"place" text,
"gold" text,
"silver" text,
"bronze" text
) | how many gold did u.s.a win | SELECT COUNT("gold") FROM table_204_75 WHERE "gold" = 'usa' | squall |
CREATE TABLE table_5724 (
"Year" real,
"Class" text,
"Team" text,
"Machine" text,
"Points" real,
"Wins" real
) | What were the least Wins in 1988? | SELECT MIN("Wins") FROM table_5724 WHERE "Year" = '1988' | wikisql |
CREATE TABLE party_host (
party_id number,
host_id number,
is_main_in_charge others
)
CREATE TABLE party (
party_id number,
party_theme text,
location text,
first_year text,
last_year text,
number_of_hosts number
)
CREATE TABLE host (
host_id number,
name text,
national... | How many hosts does each nationality have? List the nationality and the count. | SELECT nationality, COUNT(*) FROM host GROUP BY nationality | spider |
CREATE TABLE table_49407 (
"State" text,
"Type" text,
"Name" text,
"Title" text,
"Royal house" text
) | What is the state where the title is listed as count? | SELECT "State" FROM table_49407 WHERE "Title" = 'count' | 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 ... | give me the number of patients whose days of hospital stay is greater than 2 and lab test fluid is urine? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "2" AND lab.fluid = "Urine" | mimicsql_data |
CREATE TABLE table_77483 (
"Actor in London, 2002" text,
"Actor in New York, 2006" text,
"Actor in Moscow, 2007" text,
"Voyage" text,
"Shipwreck" text
) | Who was the actor in London in 2002 with the shipwreck of Leonty Ibayev? | SELECT "Actor in London, 2002" FROM table_77483 WHERE "Shipwreck" = 'leonty ibayev' | wikisql |
CREATE TABLE program (
program_id int,
name varchar,
college varchar,
introduction varchar
)
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABLE student_record (
student_id int,
course_id int,
semester i... | Are we going to have a lab for Computational Fluid Dynamics of Nuclear Applications this year ? | SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE (course.description LIKE '%lab%' OR course.name LIKE '%lab%') AND (course.description LIKE '%Computational Fluid Dynamics of Nuclear Applications%' OR course.name LIKE '%Computational Fluid Dynamics of Nuclear Applications%') AND course.course_id = course... | advising |
CREATE TABLE table_27170987_5 (
fa_cup_goals INTEGER
) | What is the lowest number of fa cup goals by a player? | SELECT MIN(fa_cup_goals) FROM table_27170987_5 | sql_create_context |
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE fare (
fare_id int,
from_airport varchar,
to_airport varchar,
fare_basis_code text,
fare_airline text,
restr... | show me the flights from NEWARK to LOS ANGELES | 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 = 'NEWARK' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'LOS ANG... | atis |
CREATE TABLE table_25518547_3 (
mls_team VARCHAR,
player VARCHAR
) | What MLS team drafted samuel appiah? | SELECT mls_team FROM table_25518547_3 WHERE player = "Samuel Appiah" | sql_create_context |
CREATE TABLE table_78341 (
"Candidate" text,
"Money Raised, 2Q" text,
"Loans Received, 2Q" text,
"Money Spent, 2Q" text,
"Total Receipts" text,
"Cash On Hand" text
) | Name the money spent for 2Q having candidate of john mccain | SELECT "Money Spent, 2Q" FROM table_78341 WHERE "Candidate" = 'john mccain' | wikisql |
CREATE TABLE table_name_89 (
draw INTEGER,
artist VARCHAR,
points VARCHAR
) | What is the draw for the artist Ketil Stokkan which has less than 44 points? | SELECT MIN(draw) FROM table_name_89 WHERE artist = "ketil stokkan" AND points < 44 | sql_create_context |
CREATE TABLE table_name_76 (
artist VARCHAR,
theme VARCHAR
) | Who was the artist for the year of the snake? | SELECT artist FROM table_name_76 WHERE theme = "year of the snake" | sql_create_context |
CREATE TABLE table_1241987_1 (
year INTEGER,
regular_season VARCHAR
) | What is the latest year that 6th, Heartland is regular season? | SELECT MAX(year) FROM table_1241987_1 WHERE regular_season = "6th, Heartland" | sql_create_context |
CREATE TABLE table_name_18 (
leading_scorer VARCHAR,
record VARCHAR
) | What is the name of the leading scorer when the record was 9 6? | SELECT leading_scorer FROM table_name_18 WHERE record = "9–6" | sql_create_context |
CREATE TABLE table_20701 (
"Year" real,
"Lansing (LAN)" text,
"Detroit (DTW)" text,
"Grand Rapids (GRR)" text,
"Flint (FNT)" text,
"Kalamazoo (AZO)" text,
"Saginaw (MBS)" text
) | During the year when Lansing's fare is $433.59, what is the fare to Kalamazoo? | SELECT "Kalamazoo (AZO)" FROM table_20701 WHERE "Lansing (LAN)" = '$433.59' | wikisql |
CREATE TABLE area (
course_id int,
area varchar
)
CREATE TABLE program (
program_id int,
name varchar,
college varchar,
introduction varchar
)
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE course_offering (
offering_id int,
course_id int,
... | Are there any non-general elective requirements that NATIVEAM 498 would fulfill for me ? | SELECT DISTINCT program_course.category FROM course, program_course WHERE course.department = 'NATIVEAM' AND course.number = 498 AND program_course.course_id = course.course_id | advising |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescription... | give me the number of patients whose insurance is private and lab test name is red blood cells? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Private" AND lab.label = "Red Blood Cells" | mimicsql_data |
CREATE TABLE Prescribes (
Physician INTEGER,
Patient INTEGER,
Medication INTEGER,
Date DATETIME,
Appointment INTEGER,
Dose VARCHAR(30)
)
CREATE TABLE Physician (
EmployeeID INTEGER,
Name VARCHAR(30),
Position VARCHAR(30),
SSN INTEGER
)
CREATE TABLE Department (
DepartmentID... | A bar chart for listing the number of the name of physicians who took some appointment. | SELECT Name, COUNT(Name) FROM Appointment AS T1 JOIN Physician AS T2 ON T1.Physician = T2.EmployeeID GROUP BY Name | nvbench |
CREATE TABLE table_242785_1 (
date_founded__founder VARCHAR,
notes VARCHAR
) | when notes are prima italica:raised for aborted caucasus war, when was that founded? | SELECT date_founded__founder FROM table_242785_1 WHERE notes = "prima Italica:raised for aborted Caucasus war" | 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... | 算算3013661医疗机构的病人对医疗项目自付比例的平均数,时间是从2015-03-11到2017-06-29期间 | SELECT AVG(t_kc22.SELF_PAY_PRO) FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.MED_SER_ORG_NO = '3013661' AND t_kc22.STA_DATE BETWEEN '2015-03-11' AND '2017-06-29' UNION SELECT AVG(t_kc22.SELF_PAY_PRO) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE fg... | css |
CREATE TABLE area (
course_id int,
area varchar
)
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
country varchar,
... | BIOLCHEM 416 is compulsory in which programs ? | SELECT DISTINCT program.name FROM course INNER JOIN program_course ON program_course.course_id = course.course_id INNER JOIN program ON program.program_id = program_course.program_id WHERE course.department = 'BIOLCHEM' AND course.number = 416 | advising |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wa... | what was the monthly minimum amount of output amt-hemovac drain given to patient 006-172277 since 07/04/2105? | SELECT MIN(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-172277')) AND intakeoutput.celllabel = 'outp... | eicu |
CREATE TABLE table_37397 (
"Years" text,
"Competition" text,
"Vehicle Name" text,
"Original Vehicle" text,
"Architecture" text
) | What original vehicle has uwhvt homepage architecture? | SELECT "Original Vehicle" FROM table_37397 WHERE "Architecture" = 'uwhvt homepage' | wikisql |
CREATE TABLE course (
course_id varchar(8),
title varchar(50),
dept_name varchar(20),
credits numeric(2,0)
)
CREATE TABLE instructor (
ID varchar(5),
name varchar(20),
dept_name varchar(20),
salary numeric(8,2)
)
CREATE TABLE time_slot (
time_slot_id varchar(4),
day varchar(1),... | List the number of instructors for each course in year 2008 with a bar chart, order by the y-axis in desc. | SELECT title, COUNT(title) FROM course AS T1 JOIN teaches AS T2 ON T1.course_id = T2.course_id JOIN instructor AS T3 ON T2.ID = T3.ID WHERE year = 2008 GROUP BY title ORDER BY COUNT(title) DESC | nvbench |
CREATE TABLE t_kc22 (
AMOUNT number,
CHA_ITEM_LEV number,
DATA_ID text,
DIRE_TYPE number,
DOSE_FORM text,
DOSE_UNIT text,
EACH_DOSAGE text,
EXP_OCC_DATE time,
FLX_MED_ORG_ID text,
FXBZ number,
HOSP_DOC_CD text,
HOSP_DOC_NM text,
MED_CLINIC_ID text,
MED_DIRE_CD tex... | 患者76364706被开出过金额不低于3367.94元的药品在哪几次医疗记录中?列出有什么医疗就诊编号? | SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_ID = '76364706' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT >= 3367.94) | css |
CREATE TABLE table_name_23 (
race_name VARCHAR,
winning_driver VARCHAR,
circuit VARCHAR
) | What is the name of race that has a winning driver of Stirling moss and a Circuit of oulton park? | SELECT race_name FROM table_name_23 WHERE winning_driver = "stirling moss" AND circuit = "oulton park" | sql_create_context |
CREATE TABLE table_26098 (
"Province" text,
"Contestant" text,
"Age" real,
"Height (in)" text,
"Height (mt)" text,
"Hometown" text
) | How tall are contestants whose home province is La Rioja? | SELECT "Height (in)" FROM table_26098 WHERE "Province" = 'La Rioja' | wikisql |
CREATE TABLE table_name_82 (
election VARCHAR
) | What is 2nd Party, when Election is '1865'? | SELECT 2 AS nd_party FROM table_name_82 WHERE election = "1865" | sql_create_context |
CREATE TABLE table_27631002_1 (
season VARCHAR,
position VARCHAR
) | How many season are shown for the 2nd position? | SELECT COUNT(season) FROM table_27631002_1 WHERE position = "2nd" | sql_create_context |
CREATE TABLE products (
product_name VARCHAR,
product_category_code VARCHAR,
product_price VARCHAR
) | Find the name and category of the most expensive product. | SELECT product_name, product_category_code FROM products ORDER BY product_price DESC LIMIT 1 | sql_create_context |
CREATE TABLE table_75895 (
"Television service" text,
"Country" text,
"Language" text,
"Content" text,
"HDTV" text,
"Package/Option" text
) | What is the HDTV when the Package/Option is sky famiglia, and a Television service of boomerang +1? | SELECT "HDTV" FROM table_75895 WHERE "Package/Option" = 'sky famiglia' AND "Television service" = 'boomerang +1' | wikisql |
CREATE TABLE qtb (
CLINIC_ID text,
COMP_ID text,
DATA_ID text,
DIFF_PLACE_FLG number,
FERTILITY_STS number,
FLX_MED_ORG_ID text,
HOSP_LEV number,
HOSP_STS number,
IDENTITY_CARD text,
INPT_AREA_BED text,
INSURED_IDENTITY number,
INSURED_STS text,
INSU_TYPE text,
IN... | 有多少次10元以内小金额结算是参保人任飞烟在04年12月27日到20年7月15日内支付的? | SELECT COUNT(*) FROM qtb JOIN t_kc24 ON qtb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE qtb.PERSON_NM = '任飞烟' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2004-12-27' AND '2020-07-15' AND t_kc24.MED_AMOUT <= 10 UNION SELECT COUNT(*) FROM gyb JOIN t_kc24 ON gyb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE gyb.PERSON_NM = '任飞烟' AND ... | css |
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)... | Which professors are not teaching classes with labs ? | SELECT DISTINCT instructor.name FROM instructor, course, course_offering, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course_offering.offering_id = offering_instructor.offering_id AND instructor.instructor_id = offering_instructor.instructor_id AND NOT instr... | advising |
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... | A bar chart shows the distribution of All_Games and Team_ID , could you display by the x-axis in desc? | SELECT All_Games, Team_ID FROM basketball_match ORDER BY All_Games DESC | nvbench |
CREATE TABLE table_25659 (
"Season" text,
"Episodes" real,
"Series premiere" text,
"Series finale" text,
"Winning couple" text,
"Winning profit ( AUD )" text,
"Host(s)" text,
"Judges" text
) | How many series premieres did the season 'All-stars' have? | SELECT COUNT("Series premiere") FROM table_25659 WHERE "Season" = 'All-Stars' | wikisql |
CREATE TABLE Accounts (
Account_ID INTEGER,
Statement_ID INTEGER,
Account_Details VARCHAR(255)
)
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15),
Budget_Type_Description VARCHAR(255)
)
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER,
Budget_Type_Code CHAR(15),
Docu... | Show the number of documents for different budget type code in a pie chart. | SELECT T1.Budget_Type_Code, COUNT(T1.Budget_Type_Code) FROM Documents_with_Expenses AS T1 JOIN Ref_Budget_Codes AS T2 ON T1.Budget_Type_Code = T2.Budget_Type_Code GROUP BY T1.Budget_Type_Code | nvbench |
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
... | since 2 years ago, what were the top four most frequently prescribed drugs for patients with age 40s? | SELECT t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 40 AND 49) AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-2 year') GR... | eicu |
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE Comments (
Id number,
PostId number,
... | Community Edits Count Rank by User. | WITH RankedUsers AS (SELECT RANK() OVER (ORDER BY COUNT(DISTINCT ph.PostId) DESC) AS Rank, ph.UserId, COUNT(DISTINCT ph.PostId) AS EditCount FROM PostHistory AS ph JOIN Posts AS p ON ph.PostId = p.Id AND ph.UserId != p.OwnerUserId WHERE PostHistoryTypeId IN (4, 5) GROUP BY ph.UserId) SELECT Rank, UserId AS "user_link",... | sede |
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId n... | Total view counts of all closed questions. | SELECT SUM(CAST(ViewCount AS INT)) FROM Posts WHERE PostTypeId = 1 AND (Posts.CreationDate BETWEEN '2013-01-01' AND '2017-12-31') | sede |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | give me the number of patients whose primary disease is s/p fall and lab test fluid is cerebrospinal fluid (csf)? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "S/P FALL" AND lab.fluid = "Cerebrospinal Fluid (CSF)" | mimicsql_data |
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE chartevents (
row_id number,
subject_i... | among patients who were prescribed dakins 1/2 strength, what were the four most commonly prescribed drugs at the same time, in this year? | 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 = 'dakins 1/2 strength' AND DATETIME(prescriptions.startdate, 'start... | mimic_iii |
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... | What are the class requirements for my Other ? | SELECT DISTINCT course.department, course.name, course.number FROM course, program_course WHERE program_course.category LIKE '%Other%' AND program_course.course_id = course.course_id | advising |
CREATE TABLE table_29260 (
"Overall rank" real,
"Country" text,
"Overall life expectancy" real,
"Male life expectancy" real,
"Male rank" real,
"Female life expectancy" real,
"Female rank" real
) | Name the most male life expectancy for pakistan | SELECT MAX("Male life expectancy") FROM table_29260 WHERE "Country" = 'Pakistan' | wikisql |
CREATE TABLE table_43589 (
"Round" real,
"Pick" text,
"Player" text,
"Position" text,
"Nationality" text,
"School/Club Team" text
) | What is Position, when Pick is 7? | SELECT "Position" FROM table_43589 WHERE "Pick" = '7' | wikisql |
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... | how many patients whose marital status is married and item id is 50820? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "MARRIED" AND lab.itemid = "50820" | mimicsql_data |
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,... | how many patients of black/cape verdean ethnicity stayed in hospital for more than 9 days? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND demographic.days_stay > "9" | mimicsql_data |
CREATE TABLE table_67724 (
"Peak" text,
"Elevation (m)" real,
"Prominence (m)" real,
"Isolation (km)" real,
"Municipality" text,
"County" text
) | What is the highest Isolation (km) when the elevation was smaller than 1320, and a Municipality of hinn ya? | SELECT MAX("Isolation (km)") FROM table_67724 WHERE "Elevation (m)" < '1320' AND "Municipality" = 'hinnøya' | wikisql |
CREATE TABLE table_name_94 (
round VARCHAR,
position VARCHAR,
player VARCHAR
) | What is the total number of Round, when Position is 'D', and when Player is 'Andrew Campbell'? | SELECT COUNT(round) FROM table_name_94 WHERE position = "d" AND player = "andrew campbell" | sql_create_context |
CREATE TABLE table_13618358_1 (
district VARCHAR,
income_poverty_f VARCHAR
) | How many districts had an depravity level of 27.7 | SELECT COUNT(district) FROM table_13618358_1 WHERE income_poverty_f = "27.7" | sql_create_context |
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
)
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE diagn... | what is the variation of patient 29540's heart rate measured at 2101-04-21 16:00:00 compared to the value measured at 2101-04-21 15:00:00? | SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 29540)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'h... | mimic_iii |
CREATE TABLE table_46591 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text
) | What is the Record for April 22? | SELECT "Record" FROM table_46591 WHERE "Date" = 'april 22' | 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,
... | 在34412645856的医疗就诊中,患者出院时诊断的是哪种疾病,把疾病的编号也找出来 | SELECT gwyjzb.OUT_DIAG_DIS_CD, gwyjzb.OUT_DIAG_DIS_NM FROM gwyjzb WHERE gwyjzb.MED_CLINIC_ID = '34412645856' UNION SELECT fgwyjzb.OUT_DIAG_DIS_CD, fgwyjzb.OUT_DIAG_DIS_NM FROM fgwyjzb WHERE fgwyjzb.MED_CLINIC_ID = '34412645856' | css |
CREATE TABLE table_name_2 (
mixed_doubles VARCHAR,
year INTEGER
) | Which mixed doubles happened later than 2011? | SELECT mixed_doubles FROM table_name_2 WHERE year > 2011 | sql_create_context |
CREATE TABLE table_204_399 (
id number,
"outcome" text,
"no." number,
"year" number,
"championship" text,
"opponent in the final" text,
"score" text
) | how long was his professional career ? | SELECT MAX("year") - MIN("year") FROM table_204_399 | squall |
CREATE TABLE table_name_57 (
result VARCHAR,
nominee_s_ VARCHAR
) | What is the result when the nominee(s) of janine sherman? | SELECT result FROM table_name_57 WHERE nominee_s_ = "janine sherman" | sql_create_context |
CREATE TABLE table_name_8 (
stadium VARCHAR,
final_score VARCHAR
) | What stadium has a final score of 26 21? | SELECT stadium FROM table_name_8 WHERE final_score = "26–21" | sql_create_context |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.