context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE Document_Locations ( Document_ID INTEGER, Location_Code CHAR(15), Date_in_Location_From DATETIME, Date_in_Locaton_To DATETIME ) CREATE TABLE Roles ( Role_Code CHAR(15), Role_Name VARCHAR(255), Role_Description VARCHAR(255) ) CREATE TABLE Ref_Calendar ( Calendar_Date DATETI...
Show the number of documents in different starting date and bin starting date by year interval with a line chart, sort X in asc order please.
SELECT Date_in_Location_From, COUNT(Date_in_Location_From) FROM Document_Locations ORDER BY Date_in_Location_From
nvbench
CREATE TABLE table_22073 ( "Position" real, "Club" text, "Games played" real, "Wins" real, "Draws" real, "Loses" real, "Goals scored" real, "Goals conceded" real, "Points" real )
How many draws were there when the conceded goals was numbered at 45?
SELECT COUNT("Draws") FROM table_22073 WHERE "Goals conceded" = '45'
wikisql
CREATE TABLE branch ( Branch_ID int, Name text, Open_year text, Address_road text, City text, membership_amount text ) CREATE TABLE member ( Member_ID int, Card_Number text, Name text, Hometown text, Level int ) CREATE TABLE purchase ( Member_ID int, Branch_ID text,...
Bar chart of the number of hometown from each hometown
SELECT Hometown, COUNT(Hometown) FROM member GROUP BY Hometown
nvbench
CREATE TABLE table_203_224 ( id number, "title" text, "year" number, "channel" text, "role" text, "notes" text )
what number of television appearances did kerry ellis make in 2010 ?
SELECT COUNT(*) FROM table_203_224 WHERE "year" = 2010
squall
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For those records from the products and each product's manufacturer, find headquarter and the average of code , and group by attribute headquarter, and visualize them by a bar chart, and list in desc by the Y.
SELECT T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T1.Code DESC
nvbench
CREATE TABLE table_7721 ( "Basin" text, "Outlet" text, "Total Area" text, "In-State Area" text, "% In-State" text )
With an outlet of Colorado River and a % instate of a038 84.8% what is in-state area?
SELECT "In-State Area" FROM table_7721 WHERE "Outlet" = 'colorado river' AND "% In-State" = 'a038 84.8%'
wikisql
CREATE TABLE table_train_4 ( "id" int, "pregnancy_or_lactation" bool, "severe_sepsis" bool, "acute_venous_thromboembolism_vte" bool, "allergy_to_carbapenem" bool, "septic_shock" bool, "age" float, "NOUSE" float )
patients who have documented hypersensitivity to carbapenems.
SELECT * FROM table_train_4 WHERE allergy_to_carbapenem = 1
criteria2sql
CREATE TABLE table_36323 ( "Rank" real, "Time" real, "Athlete" text, "Nation" text, "Date" text, "Location" text )
Time of 10.82 has what location?
SELECT "Location" FROM table_36323 WHERE "Time" = '10.82'
wikisql
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,...
For all employees who have the letters D or S in their first name, a bar chart shows the distribution of job_id and the sum of manager_id , and group by attribute job_id.
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID
nvbench
CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE time_zone ( time_zone_code tex...
looking for a flight from DENVER to SALT LAKE CITY
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 = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SALT LA...
atis
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
把杨学名住在医院0347215期间的记录里出院科室名字和骨关节无关的记载列出来
SELECT * FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE hz_info.person_info_XM = '杨学名' AND hz_info.YLJGDM = '0347215' AND NOT zyjzjlb.CYKSMC LIKE '%骨关节%'
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...
How many patients admitted to emergency had syncope telemetry as their primary disease?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND demographic.diagnosis = "SYNCOPE;TELEMETRY"
mimicsql_data
CREATE TABLE table_204_223 ( id number, "party" text, "previous council" number, "staying councillors" number, "seats up for election" number, "election result" number, "new council" number )
what was the total of previous council ?
SELECT "previous council" FROM table_204_223 WHERE "party" = 'total'
squall
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...
总计一下医疗记录中出院诊断为编号K30.264在编码为6353775的医院的的最低和最高医疗费总额是多少?
SELECT MIN(t_kc24.MED_AMOUT), MAX(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.t_kc21_MED_SER_ORG_NO = '6353775' AND t_kc24.t_kc21_OUT_DIAG_DIS_CD = 'K30.264')
css
CREATE TABLE table_10054296_1 ( member VARCHAR, classification VARCHAR )
What are the members listed with the sorority classification
SELECT member FROM table_10054296_1 WHERE classification = "Sorority"
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 ) ...
give me the number of patients whose diagnoses long title is acute venous embolism and thrombosis of deep vessels of proximal lower extremity and drug type is 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 = "Acute venous embolism and thrombosis of deep vessels of proximal lower extremity" AND presc...
mimicsql_data
CREATE TABLE table_21796261_4 ( final_score VARCHAR, date VARCHAR )
What was the final score of the game played on July 10?
SELECT final_score FROM table_21796261_4 WHERE date = "July 10"
sql_create_context
CREATE TABLE table_46645 ( "Date" text, "Opponent#" text, "Rank #" text, "Site" text, "Result" text, "Attendance" text )
Who was the opponent that played against the Buckeyes on October 17?
SELECT "Opponent#" FROM table_46645 WHERE "Date" = 'october 17'
wikisql
CREATE TABLE table_19897294_10 ( location_s_ VARCHAR, family_families VARCHAR )
In how many locations was the episode with the Bailey family filmed?
SELECT COUNT(location_s_) FROM table_19897294_10 WHERE family_families = "The Bailey Family"
sql_create_context
CREATE TABLE table_name_62 ( erp_w VARCHAR, frequency_mhz VARCHAR )
What ERP W has a 95.1 MHZ frequency?
SELECT erp_w FROM table_name_62 WHERE frequency_mhz = 95.1
sql_create_context
CREATE TABLE table_name_70 ( urban_sub_area VARCHAR, council_area VARCHAR, population VARCHAR )
What is the urban sub-area with an East Dunbartonshire council area and a population of 19,020?
SELECT urban_sub_area FROM table_name_70 WHERE council_area = "east dunbartonshire" AND population = "19,020"
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_DIRE_CD text, MED_DIRE_NM text,...
有哪些就诊编号的医疗记录里显示医院给病员35376610开出的药品均低于3078.5元?
SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_ID = '35376610' AND NOT t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT >= 3078.5)
css
CREATE TABLE table_60266 ( "Album#" text, "English Title" text, "Chinese (Traditional)" text, "Chinese (Simplified)" text, "Release date" text, "Label" text )
What Label was Released on December 7, 2012?
SELECT "Label" FROM table_60266 WHERE "Release date" = 'december 7, 2012'
wikisql
CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE jo...
In the morning , what times are there for the FRENCH 490 course ?
SELECT DISTINCT course_offering.end_time, course_offering.start_time, semester.semester, semester.year FROM course, course_offering, semester WHERE course_offering.start_time < '12:00:00' AND course_offering.start_time >= '08:00:00' AND course.course_id = course_offering.course_id AND course.department = 'FRENCH' AND c...
advising
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For those records from the products and each product's manufacturer, a bar chart shows the distribution of name and the average of code , and group by attribute name, and list Y in descending order please.
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Code DESC
nvbench
CREATE TABLE table_20516 ( "RR Romaja" text, "M\u2013R Romaja" text, "Hangul/Chosongul" text, "Hanja" text, "ISO" text, "Area" text, "Capital" text, "Region" text, "Country" text )
Name the iso for chungcheongnam
SELECT "ISO" FROM table_20516 WHERE "RR Romaja" = 'Chungcheongnam'
wikisql
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) 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), ...
For all employees who have the letters D or S in their first name, return a bar chart about the distribution of job_id and the sum of department_id , and group by attribute job_id, display in ascending by the total number.
SELECT JOB_ID, SUM(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(DEPARTMENT_ID)
nvbench
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 ) ...
give me the number of patients whose discharge location is disch-tran to psych hosp and primary disease is s/p hanging?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND demographic.diagnosis = "S/P HANGING"
mimicsql_data
CREATE TABLE table_name_18 ( country VARCHAR, to_par VARCHAR, money___$__ VARCHAR, score VARCHAR )
Which Country has a To par smaller than 6, and a Money ($) larger than 700, and a Score of 69-73-70-71=283?
SELECT country FROM table_name_18 WHERE to_par < 6 AND money___$__ > 700 AND score = 69 - 73 - 70 - 71 = 283
sql_create_context
CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE field ( fieldid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE pap...
How many papers were at SIGMOD 2000 ?
SELECT DISTINCT COUNT(paper.paperid) FROM paper, venue WHERE paper.year = 2000 AND venue.venueid = paper.venueid AND venue.venuename = 'SIGMOD'
scholar
CREATE TABLE table_22683369_8 ( p VARCHAR, player VARCHAR )
What is bryan hodge's player number
SELECT COUNT(p) FROM table_22683369_8 WHERE player = "Bryan Hodge"
sql_create_context
CREATE TABLE table_57616 ( "Serial Title" text, "Year" text, "Chapters" text, "Director" text, "Cast" text )
I want the year for the three musketeers
SELECT "Year" FROM table_57616 WHERE "Serial Title" = 'the three musketeers'
wikisql
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 lab ( subject_id text, hadm_id text, ...
Get the number of female patients who have bradycardia as their primary disease.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.diagnosis = "BRADYCARDIA"
mimicsql_data
CREATE TABLE table_37886 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
What was the score when the visitor was toronto maple leafs on march 22?
SELECT "Score" FROM table_37886 WHERE "Visitor" = 'toronto maple leafs' AND "Date" = 'march 22'
wikisql
CREATE TABLE table_40003 ( "Date" text, "Title" text, "Director" text, "Producer" text, "Production Cost" text, "Singapore Gross" text )
What is the Singapore Gross with a Title that is 2000?
SELECT "Singapore Gross" FROM table_40003 WHERE "Title" = '2000'
wikisql
CREATE TABLE table_name_70 ( erp_w INTEGER, city_of_license VARCHAR, frequency_mhz VARCHAR )
What is the average value of ERP W in Beardstown, Illinois for a frequency greater than 93.5?
SELECT AVG(erp_w) FROM table_name_70 WHERE city_of_license = "beardstown, illinois" AND frequency_mhz > 93.5
sql_create_context
CREATE TABLE table_15232 ( "Name" text, "Alt name" text, "Launch date" text, "Mass (kg)" real, "Decay date" text, "Perigee (km)" real, "Apogee (km)" real, "Inclination" real )
What is the lowest Perigee with a Launch date of 1970-08-26?
SELECT MIN("Perigee (km)") FROM table_15232 WHERE "Launch date" = '1970-08-26'
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...
What is the number of married black/cape verdean patients?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.ethnicity = "BLACK/CAPE VERDEAN"
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
how many patients whose admission location is clinic referral/premature and primary disease is morbid obesity/sda?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.diagnosis = "MORBID OBESITY/SDA"
mimicsql_data
CREATE TABLE table_204_422 ( id number, "rank" number, "lane" number, "name" text, "nationality" text, "time" text, "notes" text )
who finished directly above ryabova ?
SELECT "name" FROM table_204_422 WHERE "rank" = (SELECT "rank" FROM table_204_422 WHERE "name" = 'nina ryabova') - 1
squall
CREATE TABLE table_75387 ( "Polling Firm" text, "Date" text, "PSD - PC" text, "UDMR" text, "Elena B\u0103sescu" text, "Others" text, "Undecided" text )
What is the elena basescu when the poling firm of gallup?
SELECT "Elena B\u0103sescu" FROM table_75387 WHERE "Polling Firm" = 'gallup'
wikisql
CREATE TABLE table_33115 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What away team scored 6.12 (48)?
SELECT "Away team" FROM table_33115 WHERE "Away team score" = '6.12 (48)'
wikisql
CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_p...
Of the classes offered next Winter , which are ULCS ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id WHERE program_cour...
advising
CREATE TABLE table_name_57 ( overall_place VARCHAR, yacht_name VARCHAR )
Which Overall place has a Yacht name of lg flatron?
SELECT overall_place FROM table_name_57 WHERE yacht_name = "lg flatron"
sql_create_context
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )...
how many days has passed since the first procedure patient 017-45919 has received on the current hospital encounter?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', 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 = '017-45919'...
eicu
CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER ) CREATE TABLE status ( station_i...
For each city, what is the highest latitude for its stations Visualize by bar chart, and order by the y axis from high to low.
SELECT city, MAX(lat) FROM station GROUP BY city ORDER BY MAX(lat) DESC
nvbench
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE Comments ( Id number, PostId number, Score number, ...
What questions have been closed as Idea Generation?.
SELECT Id, Title, Score, ViewCount AS "post_link" FROM Posts ORDER BY CreationDate DESC LIMIT 2000
sede
CREATE TABLE table_57485 ( "Bowling" text, "Player" text, "Opponent" text, "Venue" text, "Season" text )
What is the bowling score of season 1907?
SELECT "Bowling" FROM table_57485 WHERE "Season" = '1907'
wikisql
CREATE TABLE table_24865763_2 ( rnd VARCHAR, lmp2_winning_team VARCHAR )
In what round did Mike Newton Thomas Erdos Ben Collins won the LMP2?
SELECT rnd FROM table_24865763_2 WHERE lmp2_winning_team = "Mike Newton Thomas Erdos Ben Collins"
sql_create_context
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, ...
what was the organism found in patient 8324's first microbiology test of the sputum in 07/last year?
SELECT microbiologyevents.org_name FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8324) AND microbiologyevents.spec_type_desc = 'sputum' AND NOT microbiologyevents.org_name IS NULL AND DATETIME(microbiologyevents.charttime, 'start of ...
mimic_iii
CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment tex...
Comments redirecting people to Code Review.
SELECT PostId, SUM(Score), MAX(Text), MAX(CreationDate) FROM Comments WHERE Text LIKE '%codereview%' GROUP BY PostId
sede
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...
Find ACC_Road and the average of School_ID , and group by attribute ACC_Road, and visualize them by a bar chart, I want to list by the bar from low to high.
SELECT ACC_Road, AVG(School_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY ACC_Road
nvbench
CREATE TABLE procedures_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 diagnoses_i...
calculate patient 95470's stay length of the first stay in the icu.
SELECT STRFTIME('%j', icustays.outtime) - STRFTIME('%j', icustays.intime) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 95470) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1
mimic_iii
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( ...
what was the maximum monthly number of patients who were admitted for dmii oth nt st uncntrld?
SELECT MAX(t1.c1) FROM (SELECT COUNT(DISTINCT diagnoses_icd.hadm_id) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'dmii oth nt st uncntrld') GROUP BY STRFTIME('%y-%m', diagnoses_icd.charttime)) AS t1
mimic_iii
CREATE TABLE table_204_399 ( id number, "outcome" text, "no." number, "year" number, "championship" text, "opponent in the final" text, "score" text )
in what year did stephen henrdy win his first title ?
SELECT "year" FROM table_204_399 WHERE "outcome" = 'winner' ORDER BY "year" LIMIT 1
squall
CREATE TABLE table_46233 ( "Tournament" text, "1990" text, "1991" text, "1992" text, "1993" text, "1994" text, "1995" text, "1996" text )
What is the 1993 value of the 1996 atp masters series?
SELECT "1993" FROM table_46233 WHERE "1996" = 'atp masters series'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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...
在2012年8月24日到2015年7月31日之间医院2003934有多少科室在门诊就诊中开出检验报告单不超过12张?
SELECT COUNT(*) FROM (SELECT jybgb.KSBM FROM mzjzjlb JOIN jybgb JOIN mzjzjlb_jybgb ON mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND mzjzjlb_jybgb.YLJGDM = jybgb.YLJGDM AND mzjzjlb_jybgb.BGDH = jybgb.BGDH AND mzjzjlb_jybgb.YLJGDM = jybgb.YLJGDM AND mzjzjlb_jybgb.BGDH = jybgb.B...
css
CREATE TABLE takes ( ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0), grade varchar(2) ) CREATE TABLE prereq ( course_id varchar(8), prereq_id varchar(8) ) CREATE TABLE student ( ID varchar(5), name varchar(20), dept_name varch...
Find the maximum capacity among rooms in each building with a bar chart, rank by the X-axis from high to low.
SELECT building, MAX(capacity) FROM classroom GROUP BY building ORDER BY building DESC
nvbench
CREATE TABLE table_7661 ( "Rank" real, "Name" text, "Years" text, "Matches" real, "Goals" real )
What is the mean number of goals when the rank's less than 8 and there are 261 matches?
SELECT AVG("Goals") FROM table_7661 WHERE "Rank" < '8' AND "Matches" = '261'
wikisql
CREATE TABLE table_name_52 ( tie_no VARCHAR, away_team VARCHAR )
WHAT'S THE TIE NUMBER WITH AN AWAY TEAM OF WREXHAM?
SELECT tie_no FROM table_name_52 WHERE away_team = "wrexham"
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...
how many patients whose drug name is albuterol-ipratropium?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Albuterol-Ipratropium"
mimicsql_data
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0...
For all employees who have the letters D or S in their first name, give me the comparison about the sum of salary over the hire_date bin hire_date by weekday, and list total number of salary from low to high order.
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY SUM(SALARY)
nvbench
CREATE TABLE table_18883 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
Which players scored the most points when the opposing team was Seattle and how many points did they score?
SELECT "High points" FROM table_18883 WHERE "Team" = 'Seattle'
wikisql
CREATE TABLE table_204_129 ( id number, "place" number, "team" text, "titles" number, "runners-up" number, "winning years" text )
how many teams have the same amount of runners up as maccabi tel aviv ?
SELECT COUNT("team") FROM table_204_129 WHERE "team" <> 'maccabi tel aviv' AND "runners-up" = (SELECT "runners-up" FROM table_204_129 WHERE "team" = 'maccabi tel aviv')
squall
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 hz_info ( KH text, KLX number...
负责11994027078患者门诊就诊的首诊医生还有其他所有接诊医生的工号是啥啊?
SELECT zzmzjzjlb.ZZYSGH, zzmzjzjlb.QTJZYSGH FROM zzmzjzjlb WHERE zzmzjzjlb.JZLSH = '11994027078' UNION SELECT fzzmzjzjlb.ZZYSGH, fzzmzjzjlb.QTJZYSGH FROM fzzmzjzjlb WHERE fzzmzjzjlb.JZLSH = '11994027078'
css
CREATE TABLE table_23641 ( "County" text, "Obama %" text, "Obama #" real, "McCain %" text, "McCain #" real, "Others %" text, "Others #" real )
What percentage of voters chose McCain in the county where 2.1% of voters voted third party?
SELECT "McCain %" FROM table_23641 WHERE "Others %" = '2.1%'
wikisql
CREATE TABLE table_name_47 ( resolution VARCHAR, network VARCHAR )
What is the resolution of the network Carismatv?
SELECT resolution FROM table_name_47 WHERE network = "carismatv"
sql_create_context
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) 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, C...
在医疗就诊45488624657中,开出的哪些药的名称中包含丁酸?其对应的价格呢
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM, t_kc22.AMOUNT FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '45488624657' AND t_kc22.SOC_SRT_DIRE_NM LIKE '%丁酸%'
css
CREATE TABLE table_21759 ( "Year" real, "Network" text, "Play-by-play" text, "Color commentator" text, "Sideline reporters" text, "Pregame host" text, "Pregame analysts" text )
What color commentator(s) were in 2010?
SELECT "Color commentator" FROM table_21759 WHERE "Year" = '2010'
wikisql
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title 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 diagnoses_icd ( row_id ...
until 35 months ago has patient 22295's sao2 been normal?
SELECT COUNT(*) > 0 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 = 22295)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sao2' AND d_items...
mimic_iii
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
编号为06771484381的检验报告单相对应的就诊流水号是多少号?
SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGDH = '06771484381'
css
CREATE TABLE table_name_49 ( team_2 VARCHAR )
What is the 2nd leg for Barcelona Team 2?
SELECT 2 AS nd_leg FROM table_name_49 WHERE team_2 = "barcelona"
sql_create_context
CREATE TABLE table_name_78 ( moving_to VARCHAR, nat VARCHAR )
Who is moving with the nationality of Tri?
SELECT moving_to FROM table_name_78 WHERE nat = "tri"
sql_create_context
CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int ) CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text )
Compare the total number of each fate with a bar chart, and display Y-axis from low to high order.
SELECT Fate, COUNT(Fate) FROM mission GROUP BY Fate ORDER BY COUNT(Fate)
nvbench
CREATE TABLE table_name_38 ( featuring VARCHAR, series_sorted VARCHAR )
who is the featuring when the series sorted is 6eb/b?
SELECT featuring FROM table_name_38 WHERE series_sorted = "6eb/b"
sql_create_context
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year 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, ...
Return a bar chart about the distribution of Nationality and the sum of ID , and group by attribute Nationality, I want to sort from high to low by the y-axis.
SELECT Nationality, SUM(ID) FROM swimmer GROUP BY Nationality ORDER BY SUM(ID) DESC
nvbench
CREATE TABLE table_2414_1 ( celli VARCHAR, section_size VARCHAR )
How many cellos are suggested in the reference with section size for 20 players?
SELECT celli FROM table_2414_1 WHERE section_size = "20 players"
sql_create_context
CREATE TABLE table_26006 ( "Pos" real, "Driver" text, "Starts" real, "Finishes" real, "Wins" real, "Podiums" real, "Stage wins" real, "Power stage wins" real, "Points" real )
What is the lowest position for a driver with 2 points?
SELECT MAX("Pos") FROM table_26006 WHERE "Points" = '2'
wikisql
CREATE TABLE Students ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), family_name VARCHAR(40) ) CREATE TABLE Course_Authors_and_Tutors ( author_id IN...
List the number of completion students in each month and bin date of completion by month interval with a bar chart, sort Y-axis in asc order.
SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment ORDER BY COUNT(date_of_completion)
nvbench
CREATE TABLE table_23508196_5 ( enlisted VARCHAR, type_of_unit VARCHAR )
Nam ethe enlisted for troop carrier group
SELECT enlisted FROM table_23508196_5 WHERE type_of_unit = "Troop carrier group"
sql_create_context
CREATE TABLE table_204_489 ( id number, "rank" number, "name" text, "height" text, "floors" number, "year" number, "notes" text )
what is the name of the last building on this chart ?
SELECT "name" FROM table_204_489 ORDER BY id DESC LIMIT 1
squall
CREATE TABLE table_1985 ( "Name" text, "Home or representative town or province" text, "Age" real, "Season" text, "Total days in PBB House" real, "Duration" text, "Status" text )
When luz mcclinton is the name what is the season?
SELECT "Season" FROM table_1985 WHERE "Name" = 'Luz McClinton'
wikisql
CREATE TABLE table_name_95 ( laid_down VARCHAR, launched VARCHAR )
What is the date that the item was laid down if it was launched on 1899-04-25?
SELECT laid_down FROM table_name_95 WHERE launched = "1899-04-25"
sql_create_context
CREATE TABLE table_name_51 ( semi_final_second_television_commentator VARCHAR, year_s_ VARCHAR, final_television_commentator VARCHAR, spokesperson VARCHAR )
Who is the semi-final second television commentator with graham norton as the final television commentator and scott mills as the spokesperson before 2013?
SELECT semi_final_second_television_commentator FROM table_name_51 WHERE final_television_commentator = "graham norton" AND spokesperson = "scott mills" AND year_s_ < 2013
sql_create_context
CREATE TABLE table_1857216_1 ( top_speed VARCHAR, production VARCHAR, transmission VARCHAR )
What is the top speed of a 5-speed manual transmission produced in 2006-2009?
SELECT top_speed FROM table_1857216_1 WHERE production = "2006-2009" AND transmission = "5-speed manual"
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
give the number of patients whose admission type is elective and procedure icd9 code is 9229.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND procedures.icd9_code = "9229"
mimicsql_data
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, Cr...
Sandbox: Inactive > 2 years && Score < 1.
SELECT SUM(CASE WHEN LastActivityDate < DATEADD(mm, -12, GETDATE()) AND Score < 0 THEN 1 ELSE 0 END) FROM Posts WHERE ParentId = 2140
sede
CREATE TABLE Customers ( customer_first_name VARCHAR, customer_last_name VARCHAR, phone_number VARCHAR, customer_id VARCHAR ) CREATE TABLE Accounts ( customer_id VARCHAR )
Show the unique first names, last names, and phone numbers for all customers with any account.
SELECT DISTINCT T1.customer_first_name, T1.customer_last_name, T1.phone_number FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id
sql_create_context
CREATE TABLE t_kc21_t_kc24 ( MED_CLINIC_ID text, MED_SAFE_PAY_ID number ) CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD...
民政补助金额在医疗就诊05137841004里面能给多少元钱?
SELECT t_kc24.CIVIL_SUBSIDY FROM t_kc24 JOIN t_kc21_t_kc24 JOIN t_kc21 ON t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID AND t_kc21_t_kc24.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '05137841004'
css
CREATE TABLE table_24854 ( "Year" text, "Date" text, "Driver" text, "Team" text, "Manufacturer" text, "Laps" text, "Miles (km)" text, "Race Time" text, "Average Speed (mph)" text, "Report" text )
How many laps have a race time of 3:31:24?
SELECT "Laps" FROM table_24854 WHERE "Race Time" = '3:31:24'
wikisql
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CRE...
Most popular tags since 2012.
SELECT Tags.TagName, COUNT(*) AS tagcount FROM Posts INNER JOIN PostTags ON PostTags.PostId = Posts.Id INNER JOIN Tags ON Tags.Id = PostTags.TagId WHERE TIME_TO_STR(Posts.CreationDate, '%Y') > 2012 GROUP BY Tags.TagName ORDER BY tagcount DESC
sede
CREATE TABLE table_name_63 ( country VARCHAR, score VARCHAR )
What country has the score og 66-70-69-71=276?
SELECT country FROM table_name_63 WHERE score = 66 - 70 - 69 - 71 = 276
sql_create_context
CREATE TABLE operate_company ( id int, name text, Type text, Principal_activities text, Incorporated_in text, Group_Equity_Shareholding real ) CREATE TABLE airport ( id int, City text, Country text, IATA text, ICAO text, name text ) CREATE TABLE flight ( id int, ...
What are the ids and names of the companies that operated more than one flight, I want to list by the X-axis from high to low please.
SELECT T1.name, T1.id FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id ORDER BY T1.name DESC
nvbench
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 whose admission type is emergency and admission year is less than 2167?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.admityear < "2167"
mimicsql_data
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE medication ( medicationid ...
how many arteriovenous shunt for renal dialysis procedures were completed?
SELECT COUNT(*) FROM treatment WHERE treatment.treatmentname = 'arteriovenous shunt for renal dialysis'
eicu
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 ( ...
give me the number of patients whose discharge location is snf and procedure short title is incision of aorta?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "SNF" AND procedures.short_title = "Incision of aorta"
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 prescription...
how many patients whose age is less than 83 and diagnoses short title is chronic pancreatitis?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "83" AND diagnoses.short_title = "Chronic pancreatitis"
mimicsql_data
CREATE TABLE table_9740 ( "Game" text, "Date" text, "Home Team" text, "Result" text, "Road Team" text )
What is the date for game 4?
SELECT "Date" FROM table_9740 WHERE "Game" = 'game 4'
wikisql
CREATE TABLE table_19952 ( "Series Ep." text, "Episode" real, "Netflix" text, "Segment A" text, "Segment B" text, "Segment C" text, "Segment D" text )
How many times was leather introduced before pedal steel guitars in episode 111?
SELECT COUNT("Segment C") FROM table_19952 WHERE "Segment D" = 'Pedal Steel Guitars'
wikisql
CREATE TABLE table_name_18 ( date VARCHAR, singapore_gross VARCHAR )
What date was the Singapore Gross 1999?
SELECT date FROM table_name_18 WHERE singapore_gross = "1999"
sql_create_context