context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE table_27723228_3 (
team VARCHAR,
game VARCHAR
) | What team did the Hornets play in game 4? | SELECT team FROM table_27723228_3 WHERE game = 4 | 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 number of patients younger than 24 years who have drug code ipra2h? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "24" AND prescriptions.formulary_drug_cd = "IPRA2H" | mimicsql_data |
CREATE TABLE table_71971 (
"Call sign" text,
"Frequency" text,
"City of license" text,
"Facility ID" real,
"ERP / Power W" real,
"Height m ( ft )" text,
"Class" text
) | Name the total number of ERP/Power W for frequency of 89.3 fm and facility ID less than 40430 | SELECT COUNT("ERP / Power W") FROM table_71971 WHERE "Frequency" = '89.3 fm' AND "Facility ID" < '40430' | wikisql |
CREATE TABLE table_13493 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" real
) | what is the highest week when the date is october 6, 1975 and attendance is higher than 79,384? | SELECT MAX("Week") FROM table_13493 WHERE "Date" = 'october 6, 1975' AND "Attendance" > '79,384' | wikisql |
CREATE TABLE table_204_90 (
id number,
"rank" number,
"name" text,
"nationality" text,
"time" text
) | what is the number of racers ethiopia had finish in the top 5 ? | SELECT COUNT("name") FROM table_204_90 WHERE "nationality" = 'ethiopia' AND id <= 5 | squall |
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 DEPARTMENT (
DEPT_CODE varchar(10),
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NU... | Return a bar chart on how many hours do the students spend studying in each department?, list from low to high by the x axis. | SELECT DEPT_CODE, SUM(STU_HRS) FROM STUDENT GROUP BY DEPT_CODE ORDER BY DEPT_CODE | nvbench |
CREATE TABLE faculty (
facid number,
lname text,
fname text,
rank text,
sex text,
phone number,
room text,
building text
)
CREATE TABLE member_of (
facid number,
dno number,
appt_type text
)
CREATE TABLE department (
dno number,
division text,
dname text,
ro... | Count the number of courses. | SELECT COUNT(*) FROM course | spider |
CREATE TABLE table_9917 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | Who is the player with a score of 69-70-76=215? | SELECT "Player" FROM table_9917 WHERE "Score" = '69-70-76=215' | wikisql |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE medication (
medicationid number,
... | had patient 011-55642 been diagnosed with any disease during the current hospital encounter? | SELECT COUNT(*) > 0 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '011-55642' AND patient.hospitaldischargetime IS NULL)) | eicu |
CREATE TABLE table_name_88 (
opponent_in_final VARCHAR,
date VARCHAR
) | Who is the opponent in the final of the tournament on May 22, 2006? | SELECT opponent_in_final FROM table_name_88 WHERE date = "may 22, 2006" | sql_create_context |
CREATE TABLE table_name_99 (
record VARCHAR,
time VARCHAR
) | For the match that lasted 3:53 minutes, what was the final record? | SELECT record FROM table_name_99 WHERE time = "3:53" | sql_create_context |
CREATE TABLE tourist_attraction_features (
tourist_attraction_id number,
feature_id number
)
CREATE TABLE hotels (
hotel_id number,
star_rating_code text,
pets_allowed_yn text,
price_range number,
other_hotel_details text
)
CREATE TABLE royal_family (
royal_family_id number,
royal_... | Show the average price range of hotels that have 5 star ratings and allow pets. | SELECT AVG(price_range) FROM hotels WHERE star_rating_code = "5" AND pets_allowed_yn = 1 | spider |
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
)... | tell me the price of merrem. | SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'merrem') | eicu |
CREATE TABLE purchases (
purchase_transaction_id number,
purchase_details text
)
CREATE TABLE transactions_lots (
transaction_id number,
lot_id number
)
CREATE TABLE investors (
investor_id number,
investor_details text
)
CREATE TABLE sales (
sales_transaction_id number,
sales_details... | Show the id and details for the investors who have the top 3 number of transactions. | SELECT T2.investor_id, T1.investor_details FROM investors AS T1 JOIN transactions AS T2 ON T1.investor_id = T2.investor_id GROUP BY T2.investor_id ORDER BY COUNT(*) DESC LIMIT 3 | spider |
CREATE TABLE table_59325 (
"Year" real,
"Tournament" text,
"Venue" text,
"Result" text,
"Extra" text
) | What tournament took place before 1972 with an extra of 200 m? | SELECT "Tournament" FROM table_59325 WHERE "Extra" = '200 m' AND "Year" < '1972' | wikisql |
CREATE TABLE table_73342 (
"Team" text,
"Stadium" text,
"Match played" text,
"Highest" real,
"Lowest" real,
"Average" real
) | How many match played have the highest as 32250? | SELECT "Match played" FROM table_73342 WHERE "Highest" = '32250' | 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... | give me the number of patients whose gender is m and procedure long title is arteriography of cerebral arteries? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.gender = "M" AND procedures.long_title = "Arteriography of cerebral arteries" | mimicsql_data |
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 diagnoses (
... | what is the number of patients whose age is less than 62 and drug type is main? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "62" AND prescriptions.drug_type = "MAIN" | mimicsql_data |
CREATE TABLE table_name_39 (
partner VARCHAR,
opponents_in_final VARCHAR
) | What is the name of the partner who played in the final against Lucas Arnold Ker Mart n Garc a? | SELECT partner FROM table_name_39 WHERE opponents_in_final = "lucas arnold ker martín garcía" | sql_create_context |
CREATE TABLE table_80415 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Game site" text,
"Record" text,
"Attendance" text
) | For the game that was played on week 2, what is the record? | SELECT "Record" FROM table_80415 WHERE "Week" = '2' | wikisql |
CREATE TABLE table_52938 (
"Peak" text,
"Height (m)" real,
"Prom. (m)" real,
"Class" text,
"Parent" text
) | Tell me the lowest prom for class of hewitt and peak of cushat law and height more than 615 | SELECT MIN("Prom. (m)") FROM table_52938 WHERE "Class" = 'hewitt' AND "Peak" = 'cushat law' AND "Height (m)" > '615' | wikisql |
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minutes_distant int
)
CREATE TABLE airport (
airport_code varchar,
airport_name text,
airport_location text,
state_code varchar,
country_name varchar,
time_zone_code... | which airlines serve PITTSBURGH | SELECT DISTINCT airline.airline_code FROM airline, airport_service, city, flight WHERE city.city_code = airport_service.city_code AND city.city_name = 'PITTSBURGH' AND flight.airline_code = airline.airline_code AND flight.from_airport = airport_service.airport_code | atis |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,... | show me the length of stay of patient 002-54808 from the last stay in the icu. | SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-54808') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1 | eicu |
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
) | What are the names of products with price at most 200, and count them by a bar chart, display by the Name in ascending. | SELECT Name, COUNT(Name) FROM Products WHERE Price <= 200 GROUP BY Name ORDER BY Name | nvbench |
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE PostsWithDeleted (
Id number,
PostTypeId number,
... | Top User Of a Peticular Tag. | WITH USER_BY_TAG AS (SELECT ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) AS Rank, u.DisplayName, TagName, COUNT(*) AS UpVotes FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS p ON p.ParentId = pt.PostId INNER JOIN Votes AS v ON v.PostId = p.Id AND VoteTypeId = 2 INNER JOIN Users AS u ON u.I... | sede |
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... | 编号为84990400的患者在2001年12月18日到2018年12月10日内自费金额高于5315.8元的药品量统共有多少? | SELECT COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_ID = '84990400' AND t_kc22.STA_DATE BETWEEN '2001-12-18' AND '2018-12-10' AND t_kc22.SELF_PAY_AMO > 5315.8 | css |
CREATE TABLE table_name_41 (
platforms VARCHAR,
stations VARCHAR
) | Name the total number of platforms that waddon railway station has | SELECT COUNT(platforms) FROM table_name_41 WHERE stations = "waddon railway station" | sql_create_context |
CREATE TABLE author (
authorid int,
authorname varchar
)
CREATE TABLE writes (
paperid int,
authorid int
)
CREATE TABLE cite (
citingpaperid int,
citedpaperid int
)
CREATE TABLE journal (
journalid int,
journalname varchar
)
CREATE TABLE keyphrase (
keyphraseid int,
keyphrase... | What papers has adam chlipala written ? | SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'adam chlipala' AND writes.authorid = author.authorid | scholar |
CREATE TABLE mzjzjlb (
HXPLC number,
HZXM text,
JLSJ time,
JZJSSJ time,
JZKSBM text,
JZKSMC text,
JZKSRQ time,
JZLSH text,
JZZDBM text,
JZZDSM text,
JZZTDM number,
JZZTMC text,
KH text,
KLX number,
MJZH text,
ML number,
MZZYZDZZBM text,
MZZYZDZZMC ... | 查查这位钱康复的患者身高和体重指标 | SELECT mzjzjlb.SG, mzjzjlb.TZ FROM hz_info JOIN mzjzjlb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE hz_info.person_info_XM = '钱康复' | css |
CREATE TABLE table_21641 (
"Game" real,
"Date" text,
"Opponent" text,
"Score" text,
"Location" text,
"Attendance" real,
"Record" text,
"Points" real
) | How many attended on mathches against atlanta thrashers | SELECT COUNT("Attendance") FROM table_21641 WHERE "Opponent" = 'Atlanta Thrashers' | wikisql |
CREATE TABLE subjects (
subject_id number,
subject_name text
)
CREATE TABLE courses (
course_id number,
author_id number,
subject_id number,
course_name text,
course_description text
)
CREATE TABLE course_authors_and_tutors (
author_id number,
author_tutor_atb text,
login_name ... | What are the student IDs and middle names of the students enrolled in at most two courses? | SELECT T1.student_id, T2.middle_name FROM student_course_enrolment AS T1 JOIN students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) <= 2 | spider |
CREATE TABLE table_203_679 (
id number,
"part" text,
"number" text,
"first public release date (first edition)" number,
"latest public release date (edition)" number,
"latest amendment" text,
"title" text,
"description" text
) | how many parts had a release date in 2003 ? | SELECT COUNT("part") FROM table_203_679 WHERE "first public release date (first edition)" = 2003 | squall |
CREATE TABLE table_44794 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" text
) | What day did they play in week 6? | SELECT "Date" FROM table_44794 WHERE "Week" = '6' | wikisql |
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE patient (
uniquep... | was there any microbiological test result of patient 031-3355 during their first hospital encounter? | SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi... | eicu |
CREATE TABLE table_22897 (
"land formation" text,
"area, km\u00b2" real,
"of which currently forests, km\u00b2" real,
"% forests" text,
"habitat type" text
) | When middle prut valley is the land formation what is the highest of which currently forests, km ? | SELECT MAX("of which currently forests, km\u00b2") FROM table_22897 WHERE "land formation" = 'Middle Prut Valley' | wikisql |
CREATE TABLE table_train_251 (
"id" int,
"gender" string,
"left_ventricular_ejection_fraction_lvef" int,
"allergy_to_rabbit_proteins" bool,
"recurring_alcohol_related_legal_problem" bool,
"hyperlipidemia" bool,
"fasting_ldl_cholesterol" int,
"baseline_hemoglobin_hgb" float,
"NOUSE" f... | left ventricular ejection fraction < 30 % | SELECT * FROM table_train_251 WHERE left_ventricular_ejection_fraction_lvef < 30 | criteria2sql |
CREATE TABLE table_name_99 (
course VARCHAR,
date VARCHAR
) | What was the course on 13 may? | SELECT course FROM table_name_99 WHERE date = "13 may" | sql_create_context |
CREATE TABLE table_70738 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Decision" text,
"Attendance" real,
"Record" text
) | What was the date of the home Detroit game with a decision of Joseph and a record of 27 13 5 2? | SELECT "Date" FROM table_70738 WHERE "Decision" = 'joseph' AND "Home" = 'detroit' AND "Record" = '27–13–5–2' | 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, a bar chart shows the distribution of headquarter and the sum of manufacturer , and group by attribute headquarter, and could you rank from low to high by the x-axis? | SELECT Headquarter, SUM(Manufacturer) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY Headquarter | nvbench |
CREATE TABLE table_name_37 (
height__m_ INTEGER,
class VARCHAR,
prom__m_ VARCHAR
) | Tell me the lowest height for class of hewitt and prom less than 148 | SELECT MIN(height__m_) FROM table_name_37 WHERE class = "hewitt" AND prom__m_ < 148 | sql_create_context |
CREATE TABLE zyjzjlb (
CYBQDM text,
CYBQMC text,
CYCWH text,
CYKSDM text,
CYKSMC text,
CYSJ time,
CYZTDM number,
HZXM text,
JZKSDM text,
JZKSMC text,
JZLSH text,
KH text,
KLX number,
MZBMLX number,
MZJZLSH text,
MZZDBM text,
MZZDMC text,
MZZYZDZZBM... | 在2003年4月11日到2012年1月23日这段时间医院5023348有多少科室在门诊就诊期间开出的检验报告单比19张多的? | SELECT COUNT(*) FROM (SELECT jybgb.KSBM FROM mzjzjlb JOIN jybgb JOIN hz_info_mzjzjlb ON hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_inf... | css |
CREATE TABLE table_204_231 (
id number,
"rank" number,
"nation" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
) | the difference between the number of medals of italy and the number of medals of poland | SELECT (SELECT "total" FROM table_204_231 WHERE "nation" = 'italy') - (SELECT "total" FROM table_204_231 WHERE "nation" = 'poland') | squall |
CREATE TABLE table_27744844_7 (
high_rebounds VARCHAR,
date VARCHAR
) | Who had the most rebounds and how many did they have on January 19? | SELECT high_rebounds FROM table_27744844_7 WHERE date = "January 19" | sql_create_context |
CREATE TABLE table_62581 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" real,
"Money ( $ )" real
) | What is the lowest money ($) that has t8 as the place, with a to par greater than 19? | SELECT MIN("Money ( $ )") FROM table_62581 WHERE "Place" = 't8' AND "To par" > '19' | wikisql |
CREATE TABLE Students_in_Detention (
student_id INTEGER,
detention_id INTEGER,
incident_id INTEGER
)
CREATE TABLE Ref_Incident_Type (
incident_type_code VARCHAR(10),
incident_type_description VARCHAR(80)
)
CREATE TABLE Ref_Address_Types (
address_type_code VARCHAR(15),
address_type_descrip... | Give me the comparison about the amount of date_address_to over the date_address_to , and group by attribute other_details and bin date_address_to by time by a bar chart. | SELECT date_address_to, COUNT(date_address_to) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC | nvbench |
CREATE TABLE table_name_49 (
location VARCHAR,
score VARCHAR
) | where has a Score of match reports? | SELECT location FROM table_name_49 WHERE score = "match reports" | sql_create_context |
CREATE TABLE t_kc21_t_kc22 (
MED_CLINIC_ID text,
MED_EXP_DET_ID number
)
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,
H... | 自两千年十一月十一日起,截止到二零二零年七月三日,看一下医院1849548的1081科室涉及的医疗费总额 | SELECT SUM(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '1849548' AND t_kc21.MED_ORG_DEPT_CD = '1081') AND t_kc24.CLINIC_SLT_DATE BETWEEN '2000-11-11' AND '2020-07-03' | css |
CREATE TABLE table_17470 (
"#" real,
"Episode" text,
"Director" text,
"Writer" text,
"Original airdate" text,
"Viewers" text
) | who is the writer for episode 'episode 7 | SELECT "Writer" FROM table_17470 WHERE "Episode" = 'Episode 7' | wikisql |
CREATE TABLE table_3218 (
"Season" text,
"Winner" text,
"Runner-up" text,
"Final Score" text,
"3rd place" text
) | In season 2007 08 who is the runner-up? | SELECT "Runner-up" FROM table_3218 WHERE "Season" = '2007–08' | wikisql |
CREATE TABLE table_22313 (
"No." real,
"#" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Canadian air date" text,
"U.S. air date" text,
"Production code" real,
"Canadian viewers (million)" text
) | Who directed the episode with a production code of 301? | SELECT "Directed by" FROM table_22313 WHERE "Production code" = '301' | 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 diagnoses (
... | how many patients are diagnosed with tietze's disease and use drug type base? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Tietze's disease" AND prescriptions.drug_type = "BASE" | 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
)
... | Return a bar chart about the distribution of meter_200 and the amount of meter_200 , and group by attribute meter_200, and sort names in asc order. | SELECT meter_200, COUNT(meter_200) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 | nvbench |
CREATE TABLE table_name_48 (
isbn VARCHAR,
year VARCHAR
) | What is the ISBN in 1999? | SELECT isbn FROM table_name_48 WHERE year = 1999 | sql_create_context |
CREATE TABLE table_name_74 (
event VARCHAR,
acts VARCHAR
) | Tell me the event for 6 bands | SELECT event FROM table_name_74 WHERE acts = "6 bands" | sql_create_context |
CREATE TABLE table_name_66 (
entrant VARCHAR,
chassis VARCHAR,
driver VARCHAR
) | Which Entrant had the Bugatti T35B Chassis and the Driver, Heinrich-Joachim Von Morgen? | SELECT entrant FROM table_name_66 WHERE chassis = "bugatti t35b" AND driver = "heinrich-joachim von morgen" | sql_create_context |
CREATE TABLE table_68403 (
"School" text,
"Nickname" text,
"City" text,
"Affiliation" text,
"Conference" text,
"National Championships" real
) | Which school has National Championships smaller than 2, and a Nickname of lions? | SELECT "School" FROM table_68403 WHERE "National Championships" < '2' AND "Nickname" = 'lions' | wikisql |
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 allergy (
allergy... | what is the name of the treatment that patient 027-136480 had been given two times in this month? | SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, COUNT(treatment.treatmenttime) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid ... | eicu |
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,
one_direction_cost int,
round_trip_cost int,
round_trip_re... | what are the DL flights from DALLAS to BOSTON | 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 = 'DALLAS... | atis |
CREATE TABLE table_8205 (
"Date" text,
"Round" text,
"Opponent" text,
"Venue" text,
"Result" text,
"Attendance" text,
"Scorers" text
) | What is the venue when the Round shows after extra time, chelsea won on 4-1 on penalties? | SELECT "Venue" FROM table_8205 WHERE "Round" = 'after extra time, chelsea won on 4-1 on penalties' | wikisql |
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 ... | 门诊就诊15752379757的患者体征在几号记录的? | SELECT JLSJ FROM mzjzjlb WHERE JZLSH = '15752379757' | css |
CREATE TABLE table_19929970_1 (
directed_by VARCHAR,
production_code VARCHAR
) | Who directed the episode with production code 4akj08? | SELECT directed_by FROM table_19929970_1 WHERE production_code = "4AKJ08" | sql_create_context |
CREATE TABLE table_38860 (
"Year" text,
"Theme" text,
"Host city" text,
"Venue" text,
"Hosts" text
) | What is the host city of the Singapore Indoor Stadium venue and a Valentine's Day theme? | SELECT "Host city" FROM table_38860 WHERE "Venue" = 'singapore indoor stadium' AND "Theme" = 'valentine''s day' | wikisql |
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
HIRE_DATE date,
JOB_ID varchar(10),
SALARY decimal(8,2),
COMMISSION_PCT decimal(2,2),
MANAGER_ID decimal(6,0),
DEPARTMENT_ID decimal(... | For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of hire_date and the sum of manager_id bin hire_date by time. | SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) | nvbench |
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10),
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4)
)
CREATE TABLE CLASS (
CLASS_CODE varchar(5),
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
... | Find the number of classes offered for all class rooms that held at least 2 classes Show bar chart, sort by the CLASS_ROOM in asc. | SELECT CLASS_ROOM, COUNT(*) FROM CLASS GROUP BY CLASS_ROOM ORDER BY CLASS_ROOM | nvbench |
CREATE TABLE table_39388 (
"Year" real,
"Championship" text,
"54 holes" text,
"Winning score" text,
"Margin" text,
"Runner(s)-up" text
) | What Year had a Runner(s)-up of flory van donck? | SELECT "Year" FROM table_39388 WHERE "Runner(s)-up" = 'flory van donck' | wikisql |
CREATE TABLE table_name_38 (
label VARCHAR,
format VARCHAR,
date VARCHAR
) | Which label had a CD format and a date of June 25, 2002? | SELECT label FROM table_name_38 WHERE format = "cd" AND date = "june 25, 2002" | sql_create_context |
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id n... | what is the percentile of 51.0 for a urea nitrogen lab test given the same age as patient 61683 in the last hospital visit? | SELECT DISTINCT t1.c1 FROM (SELECT labevents.valuenum, PERCENT_RANK() OVER (ORDER BY labevents.valuenum) AS c1 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'urea nitrogen') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions... | mimic_iii |
CREATE TABLE writes (
aid int,
pid int
)
CREATE TABLE domain_publication (
did int,
pid int
)
CREATE TABLE author (
aid int,
homepage varchar,
name varchar,
oid int
)
CREATE TABLE journal (
homepage varchar,
jid int,
name varchar
)
CREATE TABLE domain_conference (
cid... | return me the papers written by ' H. V. Jagadish ' and ' Divesh Srivastava ' with the most number of citations . | SELECT publication.title FROM author AS AUTHOR_0, author AS AUTHOR_1, publication, writes AS WRITES_0, writes AS WRITES_1 WHERE AUTHOR_0.name = 'Divesh Srivastava' AND AUTHOR_1.name = 'H. V. Jagadish' AND WRITES_0.aid = AUTHOR_0.aid AND WRITES_0.pid = publication.pid AND WRITES_1.aid = AUTHOR_1.aid AND WRITES_1.pid = p... | academic |
CREATE TABLE table_15491 (
"Date" text,
"Venue" text,
"Score" text,
"Result" text,
"Competition" text
) | Name the competition that was on august 25, 2007 | SELECT "Competition" FROM table_15491 WHERE "Date" = 'august 25, 2007' | wikisql |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
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... | count the number of patients whose primary disease is gastrointestinal bleed and drug route is tp? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "GASTROINTESTINAL BLEED" AND prescriptions.route = "TP" | mimicsql_data |
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
discharge_location text,
insurance text,
language text,
marital_status text,
ethnicity text,
age number
)
CREATE ... | what drug was prescribed to patient 96006 within 2 days after having received a atria septa def rep nec procedure since 181 months ago? | SELECT t2.drug FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 96006 AND procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = ... | mimic_iii |
CREATE TABLE table_23192661_3 (
cardinal_points INTEGER,
record VARCHAR
) | Name the cardinal points for 19-4 record | SELECT MIN(cardinal_points) FROM table_23192661_3 WHERE record = "19-4" | sql_create_context |
CREATE TABLE table_name_27 (
winning_score VARCHAR,
margin_of_victory VARCHAR,
runner_s__up VARCHAR
) | What is the winning score where the runner-up is Robert-Jan Derksen and the margin of victory is 1 stroke? | SELECT winning_score FROM table_name_27 WHERE margin_of_victory = "1 stroke" AND runner_s__up = "robert-jan derksen" | sql_create_context |
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fare int
)
CREATE TABLE class_of_service (
booking_class varchar,
rank int,
class_description text
)
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
CREATE T... | can i get from DALLAS to SAN FRANCISCO leaving in the morning and arriving in the morning | 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 (((flight.arrival_time <= 1200 AND flight.arrival_time >= 0) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight... | atis |
CREATE TABLE table_14113 (
"Date" text,
"Ship" text,
"Tons" real,
"Nationality" text,
"Fate and location" text
) | What was the fate and location of the Ringstad? | SELECT "Fate and location" FROM table_14113 WHERE "Ship" = 'ringstad' | wikisql |
CREATE TABLE table_63201 (
"Year" real,
"Song" text,
"Artist" text,
"Genre" text,
"Band Tour Venue" text,
"Exportable?" text
) | What song has the band tour vnue of 6. tool (usa) encore? | SELECT "Song" FROM table_63201 WHERE "Band Tour Venue" = '6. tool (usa) encore' | wikisql |
CREATE TABLE table_9050 (
"Year" real,
"Winner" text,
"Score" text,
"Runner(s)-up" text,
"Winner's share ($)" real,
"Course" text,
"Location" text
) | What was the winner's share before 1963 in Madison, Wisconsin? | SELECT MAX("Winner's share ($)") FROM table_9050 WHERE "Location" = 'madison, wisconsin' AND "Year" < '1963' | 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... | how many patients of white ethnicity are diagnosed with primary disease sigmoid diverticulitis, colovestical fistula/sda? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "WHITE" AND demographic.diagnosis = "SIGMOID DIVERTICULITIS, COLOVESTICAL FISTULA/SDA" | mimicsql_data |
CREATE TABLE table_41293 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | What is the To par, when the Player is Loren Roberts? | SELECT "To par" FROM table_41293 WHERE "Player" = 'loren roberts' | wikisql |
CREATE TABLE table_204_828 (
id number,
"whitworth size (in)" number,
"core diameter (in)" number,
"threads per inch" number,
"pitch (in)" number,
"tapping drill size" text
) | what is the core diameter of the first 1/8 whitworth size -lrb- in -rrb- ? | SELECT "core diameter (in)" FROM table_204_828 WHERE "whitworth size (in)" = '1/8' | squall |
CREATE TABLE table_24574438_1 (
sinhalese INTEGER,
ds_division VARCHAR
) | Name the sinhalese for manthai west | SELECT MAX(sinhalese) FROM table_24574438_1 WHERE ds_division = "Manthai West" | sql_create_context |
CREATE TABLE table_43679 (
"Player" text,
"Nationality" text,
"Jersey Number(s)" text,
"Position" text,
"Years" text,
"From" text
) | What is the nationality of the SG position? | SELECT "Nationality" FROM table_43679 WHERE "Position" = 'sg' | wikisql |
CREATE TABLE wdmzjzjlb (
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... | 看看医院8249861有多少科室在门诊就诊中开出低于28张检验报告单,时间为2006年8月10日到2017年6月18日 | SELECT COUNT(*) FROM (SELECT jybgb.KSBM FROM wdmzjzjlb JOIN jybgb ON wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE wdmzjzjlb.YLJGDM = '8249861' AND jybgb.BGRQ BETWEEN '2006-08-10' AND '2017-06-18' GROUP BY jybgb.KSBM HAVING COUNT(*) <= 28 UNION SELECT jybgb.KSBM FROM bdmzjzjlb ... | css |
CREATE TABLE table_name_96 (
final VARCHAR,
rank VARCHAR
) | What final was ranked 4? | SELECT final FROM table_name_96 WHERE rank = "4" | sql_create_context |
CREATE TABLE people (
Name VARCHAR,
People_ID VARCHAR
)
CREATE TABLE perpetrator (
People_ID VARCHAR,
Country VARCHAR
) | What are the names of perpetrators whose country is not 'China'? | SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Country <> "China" | sql_create_context |
CREATE TABLE table_21524 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
) | How many games was High Points andre iguodala (29)? | SELECT COUNT("Game") FROM table_21524 WHERE "High points" = 'Andre Iguodala (29)' | wikisql |
CREATE TABLE table_name_26 (
co_singer VARCHAR,
composer VARCHAR
) | What co-singer has sukhwinder singh as the composer? | SELECT co_singer FROM table_name_26 WHERE composer = "sukhwinder singh" | sql_create_context |
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
CREATE TABLE instructor (
instructo... | Are 100 -level classes available in either the Spring or Summer terms ? | SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number BETWEEN 100 AND 100 + 100 AND semester.semester IN ('SP', 'SS', 'SU') AND semester.semester_id = cou... | 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 diagnoses (
... | give me the number of patients whose age is less than 45 and lab test fluid is joint fluid? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "45" AND lab.fluid = "Joint Fluid" | mimicsql_data |
CREATE TABLE person_info (
CSD text,
CSRQ time,
GJDM text,
GJMC text,
JGDM text,
JGMC text,
MZDM text,
MZMC text,
RYBH text,
XBDM number,
XBMC text,
XLDM text,
XLMC text,
XM text,
ZYLBDM text,
ZYMC text
)
CREATE TABLE jyjgzbb (
BGDH text,
BGRQ tim... | 病号21701297在2000年5月29日到2009年5月18日内期间所有检验结果指标记录中使用的仪器编号还有名称都叫什么 | SELECT jyjgzbb.YQBH, jyjgzbb.YQMC FROM hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON 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.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH ... | css |
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 number of patients whose days of hospital stay is greater than 6 and drug type is main? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "6" AND prescriptions.drug_type = "MAIN" | mimicsql_data |
CREATE TABLE table_name_74 (
Double VARCHAR,
suited_match VARCHAR
) | With a Suited Match of 13:1, what is the Double Non-Suited Match? | SELECT Double AS non_suited_match FROM table_name_74 WHERE suited_match = "13:1" | sql_create_context |
CREATE TABLE table_name_50 (
Id VARCHAR
) | What is the 2010 when the 2009 shows Q1? | SELECT 2010 FROM table_name_50 WHERE 2009 = "q1" | sql_create_context |
CREATE TABLE table_name_91 (
film VARCHAR,
leading_man VARCHAR,
year VARCHAR
) | What film has a leading man of adolphe menjou in 1939? | SELECT film FROM table_name_91 WHERE leading_man = "adolphe menjou" AND year = 1939 | sql_create_context |
CREATE TABLE city (
City_ID int,
County_ID int,
Name text,
White real,
Black real,
Amerindian real,
Asian real,
Multiracial real,
Hispanic real
)
CREATE TABLE county_public_safety (
County_ID int,
Name text,
Population int,
Police_officers int,
Residents_per_offi... | Display a bar chart for how many counties correspond to each police force?, and I want to rank by the the total number in ascending please. | SELECT Police_force, COUNT(*) FROM county_public_safety GROUP BY Police_force ORDER BY COUNT(*) | nvbench |
CREATE TABLE table_name_90 (
miss_earth_venezuela VARCHAR
) | who is the 1st runner-up when the miss earth Venezuela is mar a daniela torrealba? | SELECT 1 AS st_runner_up FROM table_name_90 WHERE miss_earth_venezuela = "maría daniela torrealba" | sql_create_context |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE intakeoutput (
... | when was the first time patient 029-23889 systemicdiastolic was measured greater than 63.0 on 07/03/2103. | SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-23889')) AND vitalperiodic.systemicdiastolic > ... | eicu |
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,
... | 总计患者年龄20岁及以下的医疗记录的平均医务费总数有多少? | 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 PostNotices (
Id number,
PostId number,
PostNoticeTypeId number,
CreationDate time,
DeletionDate time,
ExpiryDate time,
Body text,
OwnerUserId number,
DeletionUserId number
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
Creati... | How many not owner's edits per question.. | SELECT t.EditCount AS "EditsPerQuestion", COUNT(t.EditCount) AS "Cases" FROM (SELECT COUNT(p.Id) AS EditCount FROM Posts AS p INNER JOIN PostHistory AS ph ON ph.PostId = p.Id WHERE p.PostTypeId = 1 AND p.OwnerUserId != ph.UserId GROUP BY p.Id) AS t GROUP BY t.EditCount ORDER BY t.EditCount DESC | sede |
CREATE TABLE table_25647137_2 (
points VARCHAR,
player VARCHAR
) | How many points did art renner have? | SELECT COUNT(points) FROM table_25647137_2 WHERE player = "Art Renner" | sql_create_context |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.