context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
ic... | what is the top three most frequently prescribed drugs that were prescribed to patients within the same hospital visit after being diagnosed with pneumonia? | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'pneumonia') AS ... | eicu |
CREATE TABLE table_4524 (
"Total tenure rank" real,
"Uninterrupted rank" real,
"Name" text,
"Party affiliation" text,
"Total tenure time" text,
"Uninterrupted time" text
) | What was the total tenure time with a rank of 49? | SELECT "Total tenure time" FROM table_4524 WHERE "Total tenure rank" = '49' | wikisql |
CREATE TABLE EMPLOYEE (
EMP_NUM int,
EMP_LNAME varchar(15),
EMP_FNAME varchar(12),
EMP_INITIAL varchar(1),
EMP_JOBCODE varchar(5),
EMP_HIREDATE datetime,
EMP_DOB datetime
)
CREATE TABLE STUDENT (
STU_NUM int,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),... | Show the number of courses for each course description in a bar chart, I want to sort x axis from low to high order please. | SELECT CRS_DESCRIPTION, COUNT(CRS_DESCRIPTION) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE GROUP BY CRS_DESCRIPTION ORDER BY CRS_DESCRIPTION | nvbench |
CREATE TABLE table_test_28 (
"id" int,
"positive_shock_index" bool,
"anemia" bool,
"serum_potassium" float,
"left_ventricular_ejection_fraction_lvef" int,
"systolic_blood_pressure_sbp" int,
"malignant_hypertension" bool,
"severe_hypertension" bool,
"hemoglobin_a1c_hba1c" float,
"... | cardiogenic shock ( positive shock index or need for catecholamine support or systolic blood pressure < 90 mmhg ) | SELECT * FROM table_test_28 WHERE cardiogenic_shock = 1 OR positive_shock_index = 1 OR catecholamine_support = 1 OR systolic_blood_pressure_sbp < 90 | criteria2sql |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospita... | when is the first time that patient 013-23115 received a nitroglycerin - sublingual since 1 year ago? | SELECT treatment.treatmenttime FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-23115')) AND treatment.treatmentname = 'nitroglycerin - subli... | eicu |
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE PostsWithDeleted (
Id number,
PostTypeId number,
AcceptedAnswerId number,
Parent... | Average Post Score by Day of the Week. | SELECT AVG(1.00 * Score) AS AvgScore, TIME_TO_STR(CreationDate, '%A') AS DayOfWeek FROM Posts GROUP BY TIME_TO_STR(CreationDate, '%A') ORDER BY SUM(Score) DESC | sede |
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 ... | 在08849932571检验结果指标中记录的设备编码和仪器编号以及其名称分别是什么? | SELECT SBBM, YQBH, YQMC FROM jyjgzbb WHERE JYZBLSH = '08849932571' | css |
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
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 c... | for patients that were prescribed with lithium carbonate sr (lithobid), what are the four most commonly ordered drugs at the same time, until 1 year ago? | 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 = 'lithium carbonate sr (lithobid)' AND DATETIME(prescriptions.start... | mimic_iii |
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
)
... | provide the number of patients who were admitted before the year 2123 with a hematology lab test category. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2123" AND lab."CATEGORY" = "Hematology" | mimicsql_data |
CREATE TABLE STUDENT (
Fname VARCHAR,
Lname VARCHAR,
StuID VARCHAR
)
CREATE TABLE MINOR_IN (
StuID VARCHAR,
DNO VARCHAR
) | What are the first names and last names of the students that minor in the department with DNO 140. | SELECT T2.Fname, T2.Lname FROM MINOR_IN AS T1 JOIN STUDENT AS T2 ON T1.StuID = T2.StuID WHERE T1.DNO = 140 | sql_create_context |
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,
... | count the number of patients whose days of hospital stay is greater than 10 and lab test fluid is other body fluid? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "10" AND lab.fluid = "Other Body Fluid" | mimicsql_data |
CREATE TABLE table_8355 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Location" text,
"In goal" text,
"Record" text
) | What record has montreal, qc as the location, with boston bruins as the visitor? | SELECT "Record" FROM table_8355 WHERE "Location" = 'montreal, qc' AND "Visitor" = 'boston bruins' | wikisql |
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 prescription... | what was the marital status of patient 73713 during the current hospital encounter? | SELECT admissions.marital_status FROM admissions WHERE admissions.subject_id = 73713 AND admissions.dischtime IS NULL | mimic_iii |
CREATE TABLE table_name_8 (
away_team VARCHAR,
venue VARCHAR
) | What was the score of the away team at Junction Oval venue? | SELECT away_team AS score FROM table_name_8 WHERE venue = "junction oval" | sql_create_context |
CREATE TABLE table_80186 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | Name the score for fiji | SELECT "Score" FROM table_80186 WHERE "Country" = 'fiji' | wikisql |
CREATE TABLE genre (
g_name varchar2(20),
rating varchar2(10),
most_popular_in varchar2(50)
)
CREATE TABLE song (
song_name varchar2(50),
artist_name varchar2(50),
country varchar2(20),
f_id number(10),
genre_is varchar2(20),
rating number(10),
languages varchar2(20),
releas... | Please give me a bar chart to show the total number of singers who sang the top 3 most highly rated songs from different countries. | SELECT T1.country, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T1.country ORDER BY T2.rating DESC LIMIT 3 | nvbench |
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 outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
... | what is the number of patients who had a delayed clos abd wound procedure in 2103? | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'delayed clos abd wound') AND STRFTIME('%y', procedur... | mimic_iii |
CREATE TABLE Apartments (
apt_id INTEGER,
building_id INTEGER,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5)
)
CREATE TABLE Apartment_Buildings (
building_id INTEGER,
building_short_name CHAR(15),
building_full_nam... | Show the number of apartment bookings in each year and bin booking end date by year with a bar chart, and could you list in desc by the how many booking end date? | SELECT booking_end_date, COUNT(booking_end_date) FROM Apartment_Bookings ORDER BY COUNT(booking_end_date) DESC | nvbench |
CREATE TABLE table_name_35 (
total INTEGER,
rank VARCHAR,
silver VARCHAR
) | what is the total when the rank is total and the silver is less than 10? | SELECT SUM(total) FROM table_name_35 WHERE rank = total AND silver < 10 | sql_create_context |
CREATE TABLE player_award (
player_id text,
award_id text,
year number,
league_id text,
tie text,
notes text
)
CREATE TABLE batting (
player_id text,
year number,
stint number,
team_id text,
league_id text,
g number,
ab number,
r number,
h number,
double ... | In which year did the least people enter hall of fame? | SELECT yearid FROM hall_of_fame GROUP BY yearid ORDER BY COUNT(*) LIMIT 1 | spider |
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 d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE procedures_icd (
... | what's the maximum cost of a hospital that includes a drug called alteplase (catheter clearance) until 1 year ago? | SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'alteplase (catheter clearance)') AND DATETIME(cost.chargetime) <= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY cost.hadm_id) AS t1 | mimic_iii |
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Percent text,
ACC_Home text,
ACC_Road text,
All_Games text,
All_Games_Percent int,
All_Home text,
All_Road text,
All_Neutral text
)
CREATE TABLE university (
Scho... | Visualize a scatter chart about the correlation between Team_ID and ACC_Percent , and group by attribute ACC_Home. | SELECT Team_ID, ACC_Percent FROM basketball_match GROUP BY ACC_Home | nvbench |
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number,
Name text,
Body text,
IsHidden boolean,
Predefined boolean,
PostNoticeDurationId number
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number... | All my answers for a given year. All my answers on the site | SELECT a.Id AS "post_link", CASE WHEN q.AcceptedAnswerId = a.Id THEN 'Accepted' END AS Accepted, CASE WHEN q.OwnerUserId = a.OwnerUserId THEN 'Self' END AS Self, a.Score, a.CreationDate, CASE WHEN NOT q.CommunityOwnedDate IS NULL THEN 'Q' WHEN NOT a.CommunityOwnedDate IS NULL THEN 'A' END AS CW FROM Posts AS q INNER JO... | sede |
CREATE TABLE table_27566 (
"Facility" text,
"Location" text,
"Year Opened" text,
"Major Facility" text,
"Population Gender" text,
"Capacity" real,
"Custody Level(s)" text
) | Is the Washington Corrections Center for Women (WCCW) a major facility? | SELECT "Major Facility" FROM table_27566 WHERE "Facility" = 'Washington Corrections Center for Women (WCCW)' | wikisql |
CREATE TABLE table_26815674_1 (
wins INTEGER
) | What is the lowest overall amount of wins? | SELECT MIN(wins) FROM table_26815674_1 | sql_create_context |
CREATE TABLE table_23696 (
"County" text,
"McCain #" real,
"McCain %" text,
"Obama #" real,
"Obama %" text
) | where did obama get 39.8% | SELECT "County" FROM table_23696 WHERE "Obama %" = '39.8%' | wikisql |
CREATE TABLE table_name_39 (
date VARCHAR,
source VARCHAR
) | When has a Source of rasmussen reports? | SELECT date FROM table_name_39 WHERE source = "rasmussen reports" | sql_create_context |
CREATE TABLE table_name_15 (
origin VARCHAR,
final_destination VARCHAR
) | What is the origin of the one whose final destination is Brandholmen? | SELECT origin FROM table_name_15 WHERE final_destination = "brandholmen" | sql_create_context |
CREATE TABLE CLASS (
CLASS_CODE varchar(5),
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int
)
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10),
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS... | Find the total credits of all classes offered by each department. Show a pie chart. | SELECT DEPT_CODE, SUM(T1.CRS_CREDIT) FROM COURSE AS T1 JOIN CLASS AS T2 ON T1.CRS_CODE = T2.CRS_CODE GROUP BY T1.DEPT_CODE | nvbench |
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... | what is drug type and drug route of drug code isos10? | SELECT prescriptions.drug_type, prescriptions.route FROM prescriptions WHERE prescriptions.formulary_drug_cd = "ISOS10" | mimicsql_data |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
HIRE_DATE date,
JOB_ID varchar(10),
SALARY decimal(8,2),
CO... | For all employees who have the letters D or S in their first name, return a scatter chart about the correlation between commission_pct and manager_id . | SELECT COMMISSION_PCT, MANAGER_ID FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' | nvbench |
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... | 列出医院9767993所有医疗就诊记录的民政补助与医疗费总额的比值有什么最大值,在不同科室编码和入院诊断疾病名称下,并降序排序? | SELECT t_kc24.t_kc21_MED_ORG_DEPT_CD, t_kc24.t_kc21_IN_DIAG_DIS_NM, MAX(t_kc24.CIVIL_SUBSIDY) FROM t_kc24 WHERE t_kc24.t_kc21_MED_SER_ORG_NO = '9767993' GROUP BY t_kc24.t_kc21_MED_ORG_DEPT_CD, t_kc24.t_kc21_IN_DIAG_DIS_NM ORDER BY MAX(t_kc24.CIVIL_SUBSIDY / t_kc24.MED_AMOUT) DESC | css |
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... | 二零零五年五月十三日到二零一六年七月十四日,在3601816医院中涉及医疗费总额不低于1904.15元的科室有多少 | SELECT COUNT(*) FROM (SELECT gwyjzb.MED_ORG_DEPT_CD FROM gwyjzb JOIN t_kc24 ON gwyjzb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE gwyjzb.MED_SER_ORG_NO = '3601816' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2005-05-13' AND '2016-07-14' GROUP BY gwyjzb.MED_ORG_DEPT_CD HAVING SUM(t_kc24.MED_AMOUT) >= 1904.15 UNION SELECT fgwyjzb... | css |
CREATE TABLE table_name_98 (
touchdowns INTEGER,
points VARCHAR,
extra_points VARCHAR,
player VARCHAR
) | Which Touchdowns is the lowest one that has Extra points smaller than 14, and a Player of white, and Points smaller than 5? | SELECT MIN(touchdowns) FROM table_name_98 WHERE extra_points < 14 AND player = "white" AND points < 5 | sql_create_context |
CREATE TABLE table_45583 (
"State" text,
"Type" text,
"Name" text,
"Title" text,
"Royal house" text,
"From" text
) | What year is Zhong from? | SELECT "From" FROM table_45583 WHERE "Name" = 'zhong' | wikisql |
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,
... | how did patient 006-125738 last come into the hospital until 2104? | SELECT patient.hospitaladmitsource FROM patient WHERE patient.uniquepid = '006-125738' AND STRFTIME('%y', patient.hospitaladmittime) <= '2104' ORDER BY patient.hospitaladmittime DESC LIMIT 1 | eicu |
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 lab (
labid numbe... | what was the first urine output time for patient 022-199074 on this month/31? | 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 = '022-199074')) AND intakeoutput.cellpath LIKE '%output... | eicu |
CREATE TABLE table_16175217_1 (
country VARCHAR,
children_per_donor VARCHAR,
donor_payment VARCHAR
) | What is the country where there are 8 children per donor and no data for donor payments? | SELECT country FROM table_16175217_1 WHERE children_per_donor = "8 children" AND donor_payment = "no data" | sql_create_context |
CREATE TABLE table_dev_9 (
"id" int,
"heart_disease" bool,
"hba1c" float,
"coronary_artery_disease_cad" bool,
"triglyceride_tg" float,
"hypertension" bool,
"NOUSE" float
) | triglycerides greater than or equal to 500 mg / dl | SELECT * FROM table_dev_9 WHERE triglyceride_tg >= 500 | criteria2sql |
CREATE TABLE table_22971 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"Production code" real,
"U.S. viewers (millions)" text
) | What's the title of the episode originally aired on September 23, 2008? | SELECT "Title" FROM table_22971 WHERE "Original air date" = 'September 23, 2008' | wikisql |
CREATE TABLE table_14019 (
"Rank" real,
"Athletes" text,
"Country" text,
"Time" text,
"Notes" text
) | What is the Time of the Athlete with a Rank of 6? | SELECT "Time" FROM table_14019 WHERE "Rank" = '6' | wikisql |
CREATE TABLE table_15887683_19 (
ppv VARCHAR,
television_service VARCHAR
) | Was there PPV when the service was SCT? | SELECT ppv FROM table_15887683_19 WHERE television_service = "SCT" | sql_create_context |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)... | what are the methods of consumption of piperacillin-tazobactam 3.375 g mini-bag plus? | SELECT DISTINCT medication.routeadmin FROM medication WHERE medication.drugname = 'piperacillin-tazobactam 3.375 g mini-bag plus' | eicu |
CREATE TABLE table_2186447_1 (
opponents VARCHAR,
score VARCHAR
) | Who was playing when the score was 5 7, 6 7 (4 7)? | SELECT opponents FROM table_2186447_1 WHERE score = "5–7, 6–7 (4–7)" | sql_create_context |
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
... | how many patients diagnosed under icd9 code 25541 were divorced? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "DIVORCED" AND diagnoses.icd9_code = "25541" | mimicsql_data |
CREATE TABLE table_name_86 (
athletes VARCHAR,
run_2 VARCHAR
) | What is Athletes, when Run 2 is 1:24.77? | SELECT athletes FROM table_name_86 WHERE run_2 = "1:24.77" | sql_create_context |
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
) | For those products with a price between 60 and 120, find name and code , and visualize them by a bar chart, list from high to low by the names. | SELECT Name, Code FROM Products WHERE Price BETWEEN 60 AND 120 ORDER BY Name DESC | nvbench |
CREATE TABLE paper (
paperid int,
title varchar,
venueid int,
year int,
numciting int,
numcitedby int,
journalid int
)
CREATE TABLE keyphrase (
keyphraseid int,
keyphrasename varchar
)
CREATE TABLE journal (
journalid int,
journalname varchar
)
CREATE TABLE cite (
citi... | oren etzioni 's papers | SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'oren etzioni' AND writes.authorid = author.authorid | scholar |
CREATE TABLE table_44566 (
"Coach" text,
"Years" text,
"Win-Loss" text,
"Win %" text,
"Conference Titles" text
) | What is Years, when Win-Loss is 11-60? | SELECT "Years" FROM table_44566 WHERE "Win-Loss" = '11-60' | 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... | what was the first value of the potassium lab test for patient 022-78464 on their last hospital visit? | SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-78464' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmit... | eicu |
CREATE TABLE tryout (
cName VARCHAR,
pPos VARCHAR
) | Find the names of schools that have some students playing in goalie and mid positions. | SELECT cName FROM tryout WHERE pPos = 'goalie' INTERSECT SELECT cName FROM tryout WHERE pPos = 'mid' | sql_create_context |
CREATE TABLE table_66361 (
"Position" real,
"Team" text,
"Played" real,
"Wins" real,
"Draws" real,
"Losses" real,
"Scored" real,
"Conceded" real,
"Points" real
) | How much Conceded has Wins smaller than 3, and Points larger than 11? | SELECT COUNT("Conceded") FROM table_66361 WHERE "Wins" < '3' AND "Points" > '11' | wikisql |
CREATE TABLE table_name_39 (
high_points VARCHAR,
date VARCHAR
) | Who had the highest points of the game on March 24? | SELECT high_points FROM table_name_39 WHERE date = "march 24" | 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... | what is the average age of patients whose language is cape and primary disease is coronary artery disease? | SELECT AVG(demographic.age) FROM demographic WHERE demographic.language = "CAPE" AND demographic.diagnosis = "CORONARY ARTERY DISEASE" | mimicsql_data |
CREATE TABLE table_name_94 (
genes VARCHAR,
base_pairs VARCHAR
) | Which gene has 4,895,836 base pairs? | SELECT genes FROM table_name_94 WHERE base_pairs = "4,895,836" | sql_create_context |
CREATE TABLE table_name_34 (
position VARCHAR,
round VARCHAR,
school_club_team VARCHAR
) | Which Position has a Round of 4, and a School/Club Team of concordia? | SELECT position FROM table_name_34 WHERE round = 4 AND school_club_team = "concordia" | sql_create_context |
CREATE TABLE table_11423 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | When was the game at Collingwood? | SELECT "Date" FROM table_11423 WHERE "Away team" = 'collingwood' | wikisql |
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,... | please show me fares from DENVER to SAN FRANCISCO | SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_... | atis |
CREATE TABLE Product_Suppliers (
product_id INTEGER,
supplier_id INTEGER,
date_supplied_from DATETIME,
date_supplied_to DATETIME,
total_amount_purchased VARCHAR(80),
total_value_purchased DECIMAL(19,4)
)
CREATE TABLE Customer_Addresses (
customer_id INTEGER,
address_id INTEGER,
date... | Return the average price for each product type Visualize by bar chart, and list by the Y-axis in asc. | SELECT product_type_code, AVG(product_price) FROM Products GROUP BY product_type_code ORDER BY AVG(product_price) | nvbench |
CREATE TABLE Ship (
Ship_ID int,
Name text,
Type text,
Built_Year real,
Class text,
Flag text
)
CREATE TABLE captain (
Captain_ID int,
Name text,
Ship_ID int,
age text,
Class text,
Rank text
) | Draw a bar chart for how many captains with younger than 50 are in each rank?, show by the Y-axis in asc. | SELECT Rank, COUNT(*) FROM captain WHERE age < 50 GROUP BY Rank ORDER BY COUNT(*) | nvbench |
CREATE TABLE table_36878 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text,
"Attendance" real
) | What is the score for the November 3 game? | SELECT "Score" FROM table_36878 WHERE "Date" = 'november 3' | wikisql |
CREATE TABLE candidates (
candidate_id number,
candidate_details text
)
CREATE TABLE student_course_attendance (
student_id number,
course_id number,
date_of_attendance time
)
CREATE TABLE student_course_registrations (
student_id number,
course_id number,
registration_date time
)
CRE... | How many students are attending English courses? | SELECT COUNT(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "English" | spider |
CREATE TABLE Document_Types (
document_type_code VARCHAR(10),
document_description VARCHAR(255)
)
CREATE TABLE Projects (
project_id INTEGER,
organisation_id INTEGER,
project_details VARCHAR(255)
)
CREATE TABLE Organisations (
organisation_id INTEGER,
organisation_type VARCHAR(10),
org... | Plot date to by the number of date to as a trend line | SELECT date_to, COUNT(date_to) FROM Project_Staff | nvbench |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40)... | For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, a bar chart shows the distribution of hire_date and the average of department_id bin hire_date by time, and could you rank from high to low by the total number? | SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(DEPARTMENT_ID) DESC | nvbench |
CREATE TABLE table_name_40 (
floors INTEGER,
city VARCHAR,
rank VARCHAR
) | What is the average number of floors for buildings in mecca ranked above 12? | SELECT AVG(floors) FROM table_name_40 WHERE city = "mecca" AND rank < 12 | sql_create_context |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id t... | give me the number of patients whose primary disease is colangitis and age is less than 85? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "COLANGITIS" AND demographic.age < "85" | mimicsql_data |
CREATE TABLE table_40153 (
"Branding" text,
"Callsign" text,
"Frequency" text,
"Power (kW)" text,
"Coverage" text
) | What is the frequency for the 10kw station with DXEZ as its callsign? | SELECT "Frequency" FROM table_40153 WHERE "Power (kW)" = '10kw' AND "Callsign" = 'dxez' | wikisql |
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
) | For those records from the products and each product's manufacturer, give me the comparison about the average of code over the name , and group by attribute name by a bar chart, and display from high to low by the names. | SELECT T2.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name DESC | nvbench |
CREATE TABLE table_65226 (
"[ 3 H]CFT" real,
"[ 3 H]Nisoxetine" text,
"[ 3 H]Paroxetine" text,
"N \u00f7 D" real,
"S \u00f7 D" real
) | What is the total S D with a 3298 (1986) [3 H] nizoxetine and an N D greater than 37.01? | SELECT COUNT("S \u00f7 D") FROM table_65226 WHERE "[ 3 H]Nisoxetine" = '3298 (1986)' AND "N \u00f7 D" > '37.01' | wikisql |
CREATE TABLE table_name_23 (
round VARCHAR,
winning_driver VARCHAR
) | Which round did jonathan bomarito win? | SELECT round FROM table_name_23 WHERE winning_driver = "jonathan bomarito" | sql_create_context |
CREATE TABLE table_24673888_1 (
callsign VARCHAR,
station_type VARCHAR,
ch__number VARCHAR
) | What is the callsign that has a station type of relay and a channel number of TV-2? | SELECT callsign FROM table_24673888_1 WHERE station_type = "Relay" AND ch__number = "TV-2" | sql_create_context |
CREATE TABLE table_48688 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | Who was the player with a score of 70-69=139? | SELECT "Player" FROM table_48688 WHERE "Score" = '70-69=139' | wikisql |
CREATE TABLE table_name_64 (
in_service VARCHAR,
versions VARCHAR
) | How many T-260 EU aircrafts are currently in service? | SELECT in_service FROM table_name_64 WHERE versions = "t-260 eu" | sql_create_context |
CREATE TABLE table_9721 (
"Year" real,
"Miss Earth Venezuela" text,
"1st Runner Up" text,
"2nd Runner Up" text,
"3rd Runner Up" text,
"4th Runner Up" text
) | who is the miss earth venezuela when the 2nd runner-up is mar a escalante? | SELECT "Miss Earth Venezuela" FROM table_9721 WHERE "2nd Runner Up" = 'maría escalante' | 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 demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | provide the number of patients whose procedure icd9 code is 8848? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.icd9_code = "8848" | mimicsql_data |
CREATE TABLE table_21091982_3 (
tournament_venue__city_ VARCHAR,
conference VARCHAR
) | Where was the Ivy League conference tournament? | SELECT tournament_venue__city_ FROM table_21091982_3 WHERE conference = "Ivy League" | sql_create_context |
CREATE TABLE table_28281704_1 (
country VARCHAR,
city VARCHAR
) | Name the country for athens | SELECT COUNT(country) FROM table_28281704_1 WHERE city = "Athens" | sql_create_context |
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Percent text,
ACC_Home text,
ACC_Road text,
All_Games text,
All_Games_Percent int,
All_Home text,
All_Road text,
All_Neutral text
)
CREATE TABLE university (
Scho... | Show me team_id by all road in a histogram, and I want to list from high to low by the Team_ID. | SELECT All_Road, Team_ID FROM basketball_match ORDER BY Team_ID DESC | nvbench |
CREATE TABLE days (
days_code varchar,
day_name varchar
)
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TABLE flight_leg (
flight_id int,
... | what is the flight number of the earliest flight between BOSTON and WASHINGTON | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHIN... | atis |
CREATE TABLE Ref_Characteristic_Types (
characteristic_type_code VARCHAR(15),
characteristic_type_description VARCHAR(80)
)
CREATE TABLE Ref_Product_Categories (
product_category_code VARCHAR(15),
product_category_description VARCHAR(80),
unit_of_measure VARCHAR(20)
)
CREATE TABLE Characteristics ... | What are the number of the descriptions of the categories that products with product descriptions that contain the letter t are in?, rank y-axis in ascending order. | SELECT product_category_description, COUNT(product_category_description) FROM Ref_Product_Categories AS T1 JOIN Products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%' GROUP BY product_category_description ORDER BY COUNT(product_category_description) | nvbench |
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE chartevent... | what are the three most frequently ordered specimen tests for patients who have been diagnosed with cholelith w cholecys nec before within 2 months, until 2104? | SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_... | mimic_iii |
CREATE TABLE table_28498999_5 (
to_par VARCHAR,
player VARCHAR
) | How many times is a to par listed when the player is phil mickelson? | SELECT COUNT(to_par) FROM table_28498999_5 WHERE player = "Phil Mickelson" | sql_create_context |
CREATE TABLE organization_contact_individuals (
individual_id number,
organization_id number,
date_contact_from time,
date_contact_to time
)
CREATE TABLE party_addresses (
party_id number,
address_id number,
date_address_from time,
address_type_code text,
date_address_to time
)
CRE... | What are the names of the services that have never been used? | SELECT service_name FROM services EXCEPT SELECT t1.service_name FROM services AS t1 JOIN party_services AS t2 ON t1.service_id = t2.service_id | spider |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age te... | how many 1 ml vial : hydralazine hcl 20 mg/ml ij soln prescriptions was there until 4 years ago? | SELECT COUNT(*) FROM medication WHERE medication.drugname = '1 ml vial : hydralazine hcl 20 mg/ml ij soln' AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-4 year') | eicu |
CREATE TABLE table_51457 (
"Rank" text,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | What is the lowest total from slovenia with a Gold smaller than 0? | SELECT MIN("Total") FROM table_51457 WHERE "Nation" = 'slovenia' AND "Gold" < '0' | wikisql |
CREATE TABLE table_name_92 (
fall_06 INTEGER,
fall_05 VARCHAR,
fall_08 VARCHAR,
fall_07 VARCHAR
) | What number is Fall 06 from the state with 79 or less in Fall 08, 36 or greater in Fall 07 and greater than 74 in Fall 05? | SELECT AVG(fall_06) FROM table_name_92 WHERE fall_08 < 79 AND fall_07 > 36 AND fall_05 > 74 | sql_create_context |
CREATE TABLE table_24474 (
"No. in series" text,
"No. in season" text,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text
) | What is the number in season for the episode written by Chris Mitchell and Erik Wiese? | SELECT "No. in season" FROM table_24474 WHERE "Written by" = 'Chris Mitchell and Erik Wiese' | wikisql |
CREATE TABLE people (
People_ID int,
Sex text,
Name text,
Date_of_Birth text,
Height real,
Weight real
)
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 re... | A bar chart shows the distribution of Sex and the sum of Weight , and group by attribute Sex. | SELECT Sex, SUM(Weight) FROM people GROUP BY Sex | nvbench |
CREATE TABLE table_24041 (
"Episode #" real,
"Episode" real,
"Title" text,
"Director" text,
"Writer" text,
"Original airdate" text,
"U.S. airdate" text
) | What was the USA airdate for 'Jenny From the Block'? | SELECT "U.S. airdate" FROM table_24041 WHERE "Title" = 'Jenny from the Block' | wikisql |
CREATE TABLE table_name_20 (
english_title VARCHAR,
original_title VARCHAR
) | What's the English Title of Fanny Och Alexander? | SELECT english_title FROM table_name_20 WHERE original_title = "fanny och alexander" | sql_create_context |
CREATE TABLE table_2263674_1 (
portfolio VARCHAR,
romanised_name VARCHAR
) | What was Anthony Leung Kam-Chung previous position? | SELECT portfolio FROM table_2263674_1 WHERE romanised_name = "Anthony Leung Kam-chung" | sql_create_context |
CREATE TABLE table_62506 (
"Player" text,
"Country" text,
"Year(s) won" text,
"Total" real,
"To par" real,
"Finish" text
) | What is the country of the player who has a total larger than 300? | SELECT "Country" FROM table_62506 WHERE "Total" > '300' | wikisql |
CREATE TABLE personfriend (
name text,
friend text,
year number
)
CREATE TABLE person (
name text,
age number,
city text,
gender text,
job text
) | What is the average age for a male in each job? | SELECT AVG(age), job FROM person WHERE gender = 'male' GROUP BY job | spider |
CREATE TABLE table_name_25 (
transfer_fee VARCHAR,
moving_from VARCHAR
) | What was the transfer fee when the moving from was celta de Vigo? | SELECT transfer_fee FROM table_name_25 WHERE moving_from = "celta de vigo" | sql_create_context |
CREATE TABLE table_name_67 (
share_of_votes VARCHAR,
dáil VARCHAR
) | What is the 6th dail share of votes? | SELECT share_of_votes FROM table_name_67 WHERE dáil = "6th" | sql_create_context |
CREATE TABLE table_1251878_3 (
aspect_ratio VARCHAR,
width INTEGER
) | What is the size when the frame is bigger than for 4096.0 | SELECT aspect_ratio FROM table_1251878_3 WHERE width > 4096.0 | sql_create_context |
CREATE TABLE table_14242137_4 (
season VARCHAR,
oberliga_bayern VARCHAR,
oberliga_südwest VARCHAR
) | Name the season for spvgg bayreuth and fsv salmrohr | SELECT season FROM table_14242137_4 WHERE oberliga_bayern = "SpVgg Bayreuth" AND oberliga_südwest = "FSV Salmrohr" | sql_create_context |
CREATE TABLE table_name_65 (
away_team VARCHAR,
ground VARCHAR
) | What is Away Team Score, when Ground is Optus Oval, and when Away Team is Fremantle? | SELECT away_team AS score FROM table_name_65 WHERE ground = "optus oval" AND away_team = "fremantle" | sql_create_context |
CREATE TABLE table_name_15 (
score VARCHAR,
location_attendance VARCHAR
) | WhichScore has a Location Attendance of seattle center coliseum 11,497? | SELECT score FROM table_name_15 WHERE location_attendance = "seattle center coliseum 11,497" | sql_create_context |
CREATE TABLE table_11621873_1 (
score VARCHAR,
tournament VARCHAR
) | How many scores were at the Northville Long Island Classic? | SELECT COUNT(score) FROM table_11621873_1 WHERE tournament = "Northville Long Island Classic" | sql_create_context |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.