context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_co...
count the number of patients who have undergone a bands lab test until 2 years ago.
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'bands') AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME(), '-2 year'))
mimic_iii
CREATE TABLE table_11253290_2 ( viewers__millions_ VARCHAR, rank__night_ VARCHAR )
How many times was the rank (night) 11?
SELECT COUNT(viewers__millions_) FROM table_11253290_2 WHERE rank__night_ = 11
sql_create_context
CREATE TABLE table_name_49 ( european_competitions VARCHAR, tier VARCHAR, season VARCHAR )
Tier of 2, and a Season of 2004 05 is what European competitions?
SELECT european_competitions FROM table_name_49 WHERE tier = 2 AND season = "2004–05"
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...
provide the number of patients whose primary disease is gastrointestinal bleed and days of hospital stay is greater than 2?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "GASTROINTESTINAL BLEED" AND demographic.days_stay > "2"
mimicsql_data
CREATE TABLE table_name_57 ( location VARCHAR, event VARCHAR, method VARCHAR, round VARCHAR )
Which Location has a Method of submission (rear naked choke), a Round of 1, and an Event of ufc 127?
SELECT location FROM table_name_57 WHERE method = "submission (rear naked choke)" AND round = 1 AND event = "ufc 127"
sql_create_context
CREATE TABLE table_79253 ( "Japanese Title" text, "Romaji Title" text, "TV Station" text, "Theme Song(s)" text, "Episodes" real, "Average Ratings" text )
What is the Theme Song of ?
SELECT "Theme Song(s)" FROM table_79253 WHERE "Japanese Title" = '働きマン'
wikisql
CREATE TABLE table_33794 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
Which home team corresponds to an away team score of 10.12 (72)?
SELECT "Home team" FROM table_33794 WHERE "Away team score" = '10.12 (72)'
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
give me the number of patients with procedure icd9 code 8856 who have brain mass; intracranial hemorrhage primary disease.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "BRAIN MASS;INTRACRANIAL HEMORRHAGE" AND procedures.icd9_code = "8856"
mimicsql_data
CREATE TABLE table_17118657_7 ( date VARCHAR, high_assists VARCHAR )
On what date did Canty (6) receive high assists?
SELECT date FROM table_17118657_7 WHERE high_assists = "Canty (6)"
sql_create_context
CREATE TABLE representative ( Representative_ID int, Name text, State text, Party text, Lifespan text ) CREATE TABLE election ( Election_ID int, Representative_ID int, Date text, Votes real, Vote_Percent real, Seats real, Place real )
What are the different parties of representative? Show the party name and the number of representatives in each party, list by the x axis in ascending.
SELECT Party, COUNT(*) FROM representative GROUP BY Party ORDER BY Party
nvbench
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9cod...
did patient 015-96048 get diagnosed with a disease this year?
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 = '015-96048')) AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETI...
eicu
CREATE TABLE table_name_61 ( record VARCHAR, loss VARCHAR )
What was the record at the game with a loss of Cook (14 7)?
SELECT record FROM table_name_61 WHERE loss = "cook (14–7)"
sql_create_context
CREATE TABLE table_name_66 ( score VARCHAR, loss VARCHAR )
Which score has a Loss of gubicza (0-1)?
SELECT score FROM table_name_66 WHERE loss = "gubicza (0-1)"
sql_create_context
CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admi...
What MDE classes are offered next semester ?
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program, program_course, semester WHERE course.course_id = course_offering.course_id AND program_course.category LIKE '%MDE%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_i...
advising
CREATE TABLE table_61444 ( "S.no." real, "Power Plant" text, "State" text, "Total Capacity (MW)" real, "Completion Schedule" text )
When the completion schedule is 2016 for the state of jammu & kashmir, what is the smallest S.no.?
SELECT MIN("S.no.") FROM table_61444 WHERE "State" = 'jammu & kashmir' AND "Completion Schedule" = '2016'
wikisql
CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text...
How many duplicates of 'What is a NullPointerException and how do I fix it?' are there?.
SELECT COUNT(*) FROM PostLinks WHERE LinkTypeId = 3 AND RelatedPostId = 218384
sede
CREATE TABLE table_7601 ( "Publication" text, "Country" text, "Accolade" text, "Year" real, "Rank" real )
What is the highest Year, when Rank is less than 28, and when Accolade is 'The 100 greatest metal albums of the decade'?
SELECT MAX("Year") FROM table_7601 WHERE "Rank" < '28' AND "Accolade" = 'the 100 greatest metal albums of the decade'
wikisql
CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3) ) CREATE TABLE Player ( pID numeric(5,0), pName varchar(20), yCard varchar(3), HS numeric(5,0) ) CREATE TABLE College ( cName varchar(20), state varchar(2), enr numeric(5,0) )
Give me the comparison about enr over the cName .
SELECT cName, enr FROM College ORDER BY enr
nvbench
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) 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 ( LOCATIO...
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 average of department_id , and group by attribute job_id, I want to rank from high to low by the Y-axis.
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(DEPARTMENT_ID) DESC
nvbench
CREATE TABLE table_18484 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
who is the the incumbent with district being ohio 2
SELECT "Incumbent" FROM table_18484 WHERE "District" = 'Ohio 2'
wikisql
CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) CREATE TABLE gsi ( course_offeri...
Are there any MEDCHEM classes that don 't meet on Friday ?
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 WHERE course_offering.friday = 'N' AND course.department = 'MEDCHEM' AND semester.semester = 'WN' AN...
advising
CREATE TABLE table_78607 ( "Letter" text, "Pronunciation spelled free" text, "Pronunciation spelled checked" text, "Example spelled free" text, "Example spelled checked" text )
What is Pronunciation Spelled Checked, when Example Spelled Checked is 'tin /t n/ ('tin')
SELECT "Pronunciation spelled checked" FROM table_78607 WHERE "Example spelled checked" = 'tin /tɪn/ ("tin")'
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...
what is the number of patients whose admission type is elective and item id is 51259?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab.itemid = "51259"
mimicsql_data
CREATE TABLE table_name_92 ( principal VARCHAR, mascot VARCHAR )
What principal has a school mascot of the patriots?
SELECT principal FROM table_name_92 WHERE mascot = "patriots"
sql_create_context
CREATE TABLE journalist ( journalist_ID int, Name text, Nationality text, Age text, Years_working int ) CREATE TABLE news_report ( journalist_ID int, Event_ID int, Work_Type text ) CREATE TABLE event ( Event_ID int, Date text, Venue text, Name text, Event_Attendance...
Show the different nationalities and the number of journalists of each nationality Visualize by bar chart, could you display by the x axis in desc?
SELECT Nationality, COUNT(*) FROM journalist GROUP BY Nationality ORDER BY Nationality DESC
nvbench
CREATE TABLE table_74454 ( "Tournament" text, "Player" text, "Nationality" text, "Team" text, "Games played" real, "Goals conceded" real, "Coefficient" text )
What is the coefficient for agust n marches n (1)?
SELECT "Coefficient" FROM table_74454 WHERE "Player" = 'Agustín Marchesín (1)'
wikisql
CREATE TABLE club ( club_id number, name text, region text, start_year text ) CREATE TABLE competition ( competition_id number, year number, competition_type text, country text ) CREATE TABLE club_rank ( rank number, club_id number, gold number, silver number, bronz...
What are the names and players of all the clubs?
SELECT T1.name, T2.player_id FROM club AS T1 JOIN player AS T2 ON T1.club_id = T2.club_id
spider
CREATE TABLE table_name_92 ( round VARCHAR, event VARCHAR )
What round did the match go to when the event was Bars - Moscow vs St. Petersburg?
SELECT round FROM table_name_92 WHERE event = "bars - moscow vs st. petersburg"
sql_create_context
CREATE TABLE musical ( musical_id number, name text, year number, award text, category text, nominee text, result text ) CREATE TABLE actor ( actor_id number, name text, musical_id number, character text, duration text, age number )
Show names of actors and names of musicals they are in.
SELECT T1.name, T2.name FROM actor AS T1 JOIN musical AS T2 ON T1.musical_id = T2.musical_id
spider
CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) CREATE TABLE Reviewer ( rID int, name text ) CREATE TABLE Movie ( mID int, title text, year int, director text )
Show the director and their lowest rating among all movies in a bar chart, list by the director from low to high.
SELECT director, MIN(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY director ORDER BY director
nvbench
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE area ( course_id int, area varchar ) CREATE TAB...
What course in Machine Learning is 15 credits ?
SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%Machine Learning%' OR name LIKE '%Machine Learning%') AND credits = 15
advising
CREATE TABLE table_204_994 ( id number, "date" text, "time" text, "opponent#" text, "rank#" text, "site" text, "tv" text, "result" text, "attendance" number )
what is he largest points scored in one game ?
SELECT MAX("result") FROM table_204_994
squall
CREATE TABLE table_11764007_2 ( week_arrived_on_main_island VARCHAR, original_tribe VARCHAR, week_sent_to_third_island VARCHAR )
What week did the member who's original tribe was shark and who was sent to the third island on week 14 arrive on the main island?
SELECT week_arrived_on_main_island FROM table_11764007_2 WHERE original_tribe = "Shark" AND week_sent_to_third_island = "14"
sql_create_context
CREATE TABLE table_203_413 ( id number, "rank" text, "city" text, "population" number, "area\n(km2)" number, "density\n(inhabitants/km2)" number, "altitude\n(mslm)" number )
which city has the least density ?
SELECT "city" FROM table_203_413 ORDER BY "density\n(inhabitants/km2)" LIMIT 1
squall
CREATE TABLE Student_Course_Enrolment ( course_id VARCHAR ) CREATE TABLE Courses ( course_description VARCHAR, course_name VARCHAR, course_id VARCHAR )
What are the descriptions and names of the courses that have student enrollment bigger than 2?
SELECT T1.course_description, T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name HAVING COUNT(*) > 2
sql_create_context
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 departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), ...
For all employees who have the letters D or S in their first name, draw a bar chart about the distribution of job_id and the average of salary , and group by attribute job_id.
SELECT JOB_ID, AVG(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID
nvbench
CREATE TABLE table_15487 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Record" text )
Name the loss for june 22
SELECT "Loss" FROM table_15487 WHERE "Date" = 'june 22'
wikisql
CREATE TABLE gwyjzb ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
自二零零六年十二月二十四日到二零一四年二月十日,医院7826174记录有医治过多少住院的患者
SELECT COUNT(*) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '7826174' AND gwyjzb.IN_HOSP_DATE BETWEEN '2006-12-24' AND '2014-02-10' AND gwyjzb.CLINIC_TYPE = '住院' UNION SELECT COUNT(*) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '7826174' AND fgwyjzb.IN_HOSP_DATE BETWEEN '2006-12-24' AND '2014-02-10' AND fgwyjzb.CLINIC_TY...
css
CREATE TABLE table_203_723 ( id number, "year" number, "song" text, "us hot 100" number, "us msr" number, "us a.c." number, "can" number, "uk singles" number, "album" text )
name firehouse 's first single to get reach the top 10 of the us top 100 ?
SELECT "song" FROM table_203_723 WHERE "album" = 'firehouse' AND "us hot 100" < 10
squall
CREATE TABLE table_62210 ( "Name" text, "Club" text, "Date of departure" text, "Replacement" text, "Date of appointment" text )
What is the club the used aykut kocaman as the replacement?
SELECT "Club" FROM table_62210 WHERE "Replacement" = 'aykut kocaman'
wikisql
CREATE TABLE table_44640 ( "Rank" real, "Name" text, "Years" text, "League" real, "Total" real )
What is average for Benito Lorenzi league when total is smaller than 143?
SELECT AVG("League") FROM table_44640 WHERE "Name" = 'benito lorenzi' AND "Total" < '143'
wikisql
CREATE TABLE table_23963781_1 ( nationality VARCHAR, athletica_career VARCHAR, minutes VARCHAR, position VARCHAR )
What is the nationality associated with 0 minutes, position of MF, and an Athletica career of 2009?
SELECT nationality FROM table_23963781_1 WHERE minutes = 0 AND position = "MF" AND athletica_career = "2009"
sql_create_context
CREATE TABLE hosting_city ( Year int, Match_ID int, Host_City text ) CREATE TABLE match ( Match_ID int, Date text, Venue text, Score text, Result text, Competition text ) CREATE TABLE city ( City_ID int, City text, Hanzi text, Hanyu_Pinyin text, Regional_Populat...
Bar chart x axis competition y axis the total number, and display by the X-axis in ascending.
SELECT Competition, COUNT(*) FROM match GROUP BY Competition ORDER BY Competition
nvbench
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, find last_name and employee_id , and visualize them by a bar chart, show from low to high by the bar.
SELECT LAST_NAME, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY LAST_NAME
nvbench
CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arriv...
what 's the earliest flight from NASHVILLE to TACOMA on AA on tuesday the eighteenth of may
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'TACOMA' AND date_day.day_number = 22 AND date_day.month_number = 3 AND ...
atis
CREATE TABLE csu_fees ( campusfee INTEGER, YEAR VARCHAR )
What is the average fee on a CSU campus in 2005?
SELECT AVG(campusfee) FROM csu_fees WHERE YEAR = 2005
sql_create_context
CREATE TABLE table_33286 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What as the home team that scored 18.15 (123)?
SELECT "Home team" FROM table_33286 WHERE "Home team score" = '18.15 (123)'
wikisql
CREATE TABLE table_name_63 ( tie_no VARCHAR, away_team VARCHAR )
Which Tie number had Middlesbrough as the away team?
SELECT tie_no FROM table_name_63 WHERE away_team = "middlesbrough"
sql_create_context
CREATE TABLE table_name_84 ( actor VARCHAR, duration VARCHAR )
What is the name of the actor with a duration of 61 years?
SELECT actor FROM table_name_84 WHERE duration = "61 years"
sql_create_context
CREATE TABLE table_56783 ( "Driver" text, "Constructor" text, "Laps" text, "Time/Retired" text, "Grid" text )
What is the Time/Retired value of driver Pedro Diniz?
SELECT "Time/Retired" FROM table_56783 WHERE "Driver" = 'pedro diniz'
wikisql
CREATE TABLE table_18483171_1 ( founded VARCHAR, location VARCHAR )
List the total number of institutions founded in Rock Island, Illinois.
SELECT COUNT(founded) FROM table_18483171_1 WHERE location = "Rock Island, Illinois"
sql_create_context
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE food_service ( mea...
give me the meal flights departing early saturday morning from CHICAGO to SEATTLE nonstop
SELECT DISTINCT flight_id FROM flight WHERE (((((flight_days IN (SELECT DAYSalias0.days_code FROM days AS DAYSalias0 WHERE DAYSalias0.day_name IN (SELECT DATE_DAYalias0.day_name FROM date_day AS DATE_DAYalias0 WHERE DATE_DAYalias0.day_number = 26 AND DATE_DAYalias0.month_number = 7 AND DATE_DAYalias0.year = 1991)) AND ...
atis
CREATE TABLE table_name_67 ( title VARCHAR, date VARCHAR )
Which film was released in August 2004?
SELECT title FROM table_name_67 WHERE date = "august 2004"
sql_create_context
CREATE TABLE table_25368177_1 ( abandoned INTEGER )
What's the largest number of abandoned games by any of the teams?
SELECT MAX(abandoned) FROM table_25368177_1
sql_create_context
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body te...
select title from posts where viewcount > 100000.
SELECT Title FROM Posts WHERE ViewCount > 100000
sede
CREATE TABLE table_27034 ( "\u2116" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (million)" text )
What date did the episode with 8.61 million U.S. viewers originally air?
SELECT "Original air date" FROM table_27034 WHERE "U.S. viewers (million)" = '8.61'
wikisql
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, ...
Tag gold badges over time.
SELECT CAST(TIME_TO_STR(Date, '%Y-%m-%d %H:%M:%S') AS TEXT(7)) AS ym, COUNT(*) FROM Badges WHERE Name = '##TagName:string?php##' AND Class = 1 GROUP BY CAST(TIME_TO_STR(Date, '%Y-%m-%d %H:%M:%S') AS TEXT(7)) ORDER BY ym
sede
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD ...
从06年2月1日起,截止到07年12月20日,有多少科室在5659309这个医院涉及的医疗费总额不多于6358.78元
SELECT COUNT(*) FROM (SELECT t_kc21.MED_ORG_DEPT_CD FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.MED_SER_ORG_NO = '5659309' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2006-02-01' AND '2007-12-20' GROUP BY t_kc21.MED_ORG_DEPT_CD HAVING SUM(t_kc24.MED_AMOUT) <= 6358.78) AS T
css
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
what is procedure icd9 code of subject name jerry deberry?
SELECT procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Jerry Deberry"
mimicsql_data
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 year of death is less than or equal to 2174 and lab test name is urobilinogen?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2174.0" AND lab.label = "Urobilinogen"
mimicsql_data
CREATE TABLE table_name_10 ( females VARCHAR, number VARCHAR )
Which language do 706 females speak?
SELECT females FROM table_name_10 WHERE number = "706"
sql_create_context
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE hz_info ( KH text, KLX number...
患者陶国兴之前就诊的医院是哪个
SELECT mzjzjlb.YLJGDM FROM person_info JOIN hz_info JOIN mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE person_info.XM = '陶国兴' UNION SELECT wdmzjzjlb.YLJGDM FROM person_info JOIN hz_info JOIN wdmzjzjlb ON person_info.RYBH = ...
css
CREATE TABLE VoteTypes ( Id number, Name text ) 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 ReviewT...
Questions in last year by users below 15 vs at or above.
SELECT 'Questions by users below 15 rep', COUNT(1) FROM Posts WHERE CreationDate > DATEADD(year, -1, GETDATE()) AND PostTypeId = 1 AND OwnerUserId IN (SELECT Id FROM Users WHERE Reputation < 15) UNION SELECT 'Questions by users at 15 rep or higher', COUNT(1) FROM Posts WHERE CreationDate > DATEADD(year, -1, GETDATE()) ...
sede
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
Which patients have had the macrophage lab test done?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "Macrophage"
mimicsql_data
CREATE TABLE station ( id int, network_name text, services text, local_authority text ) CREATE TABLE train ( id int, train_number int, name text, origin text, destination text, time text, interval text ) CREATE TABLE route ( train_id int, station_id int ) CREATE TA...
A bar graph listing the services and how many services provided by all stations , order in ascending by the Y-axis.
SELECT services, COUNT(services) FROM station GROUP BY services ORDER BY COUNT(services)
nvbench
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 ...
count the number of icu visit of patient 15945 in the current hospital visit.
SELECT COUNT(DISTINCT icustays.icustay_id) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15945 AND admissions.dischtime IS NULL)
mimic_iii
CREATE TABLE table_44612 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Nuggets points" real, "Opponents" real, "Record" text, "Streak" text )
Which Game has a Nugget points of 89?
SELECT MIN("Game") FROM table_44612 WHERE "Nuggets points" = '89'
wikisql
CREATE TABLE table_6838 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
How many bronze numbers had a total of more than 4 when the rank is less than four, germany is involved, and there's less than 5 silver?
SELECT COUNT("Bronze") FROM table_6838 WHERE "Total" > '4' AND "Rank" < '4' AND "Nation" = 'germany' AND "Silver" < '5'
wikisql
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
严鸿波这位患者自10.1.9起,到21.3.26止,在医疗机构1002933看病时共开走了多少西药
SELECT COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '严鸿波' AND t_kc22.STA_DATE BETWEEN '2010-01-09' AND '2021-03-26' AND t_kc22.t_kc21_MED_SER_ORG_NO = '1002933' AND t_kc22.MED_INV_ITEM_TYPE = '西药费'
css
CREATE TABLE table_43366 ( "Ballarat FL" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real )
For the teams that had less than 1 loss, what was the average number of Wins?
SELECT AVG("Wins") FROM table_43366 WHERE "Losses" < '1'
wikisql
CREATE TABLE table_17251764_1 ( shire VARCHAR, area_in_km_2 VARCHAR )
how many shire in the land of area in km 2 is 27.17
SELECT COUNT(shire) FROM table_17251764_1 WHERE area_in_km_2 = "27.17"
sql_create_context
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABL...
what were the four most commonly ordered procedures for patients with nonrheum tricusp val dis who had previously been diagnosed in the same hospital encounter until 2103?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_i...
mimic_iii
CREATE TABLE table_11366 ( "NGC number" real, "Object type" text, "Constellation" text, "Right ascension ( J2000 )" text, "Declination ( J2000 )" text )
Tell me the constellation which has a right ascension of 18h17m41.1s
SELECT "Constellation" FROM table_11366 WHERE "Right ascension ( J2000 )" = '18h17m41.1s'
wikisql
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE Tags ( Id number, TagName text, Count ...
Tags with highest average answer scores (among tags with at least 10 questions).
SELECT t.TagName, COUNT(DISTINCT a.Id) AS NumAnswers, SUM(a.Score) AS TotalScore, AVG(a.Score + 0.0) AS AvgScore FROM Posts AS a JOIN Posts AS q ON a.ParentId = q.Id JOIN PostTags AS pt ON pt.PostId = q.Id JOIN Tags AS t ON t.Id = pt.TagId WHERE a.PostTypeId = 2 GROUP BY t.TagName, t.Id HAVING COUNT(q.Id) >= 1000 ORDER...
sede
CREATE TABLE table_24673888_1 ( power_kw VARCHAR, station_type VARCHAR, callsign VARCHAR )
What is the power in KW that has a station type of relay and a callsign of DXCL-TV?
SELECT power_kw FROM table_24673888_1 WHERE station_type = "Relay" AND callsign = "DXCL-TV"
sql_create_context
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
how many patients had a gastric lavage in 2105?
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 = 'gastric lavage') AND STRFTIME('%y', procedures_icd.c...
mimic_iii
CREATE TABLE table_204_6 ( id number, "category" text, "urban settlements" text, "population" number, "male" text, "female" text, "inhabited localities in jurisdiction" text )
which rural settlement has the most males in their population ?
SELECT "urban settlements" FROM table_204_6 WHERE "category" = 'rural' ORDER BY "male" DESC LIMIT 1
squall
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 medication ( me...
how many days has passed since patient 032-24135 was admitted to the intensive care unit?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '032-24135' AND patient.unitdischargetime IS NULL
eicu
CREATE TABLE table_name_18 ( first_elected INTEGER, district VARCHAR, committee VARCHAR )
What is the average first elected year that has a district of 11 and a committee of environmental matters?
SELECT AVG(first_elected) FROM table_name_18 WHERE district = "11" AND committee = "environmental matters"
sql_create_context
CREATE TABLE table_52388 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
What was the date of the game when Colorado was the visiting team and Chicago was the home team?
SELECT "Date" FROM table_52388 WHERE "Visitor" = 'colorado' AND "Home" = 'chicago'
wikisql
CREATE TABLE school ( School_ID int, Grade text, School text, Location text, Type text ) CREATE TABLE school_bus ( School_ID int, Driver_ID int, Years_Working int, If_full_time bool ) CREATE TABLE driver ( Driver_ID int, Name text, Party text, Home_city text, Ag...
Bar graph to show age from different name, and display from low to high by the y-axis please.
SELECT Name, Age FROM driver ORDER BY Age
nvbench
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...
count the number of patients whose diagnoses short title is mal neo descend colon.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Mal neo descend colon"
mimicsql_data
CREATE TABLE table_name_81 ( pos VARCHAR, school_club_team VARCHAR )
Which position has a School/club team of jacksonville?
SELECT pos FROM table_name_81 WHERE school_club_team = "jacksonville"
sql_create_context
CREATE TABLE mzb ( CLINIC_ID text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, IN...
查一下医疗就诊04488736077的那些人员的姓名、性别、年龄和身份证号
SELECT qtb.PERSON_NM, qtb.PERSON_SEX, qtb.PERSON_AGE, qtb.IDENTITY_CARD FROM qtb WHERE qtb.MED_CLINIC_ID = '67596445659' UNION SELECT gyb.PERSON_NM, gyb.PERSON_SEX, gyb.PERSON_AGE, gyb.IDENTITY_CARD FROM gyb WHERE gyb.MED_CLINIC_ID = '67596445659' UNION SELECT zyb.PERSON_NM, zyb.PERSON_SEX, zyb.PERSON_AGE, zyb.IDENTITY...
css
CREATE TABLE table_name_89 ( attendance VARCHAR, tie_no VARCHAR )
How many were in Attendance during a Tie no of 1?
SELECT attendance FROM table_name_89 WHERE tie_no = 1
sql_create_context
CREATE TABLE table_63086 ( "Country" text, "Date" text, "Label" text, "Format" text, "Catalogue No." text )
What is the country that has the format of cd, the label of sony music and the catalogue no sicp-2055?
SELECT "Country" FROM table_63086 WHERE "Format" = 'cd' AND "Label" = 'sony music' AND "Catalogue No." = 'sicp-2055'
wikisql
CREATE TABLE table_18594107_2 ( wins INTEGER, conceded VARCHAR )
How many wins have conceded as 18?
SELECT MAX(wins) FROM table_18594107_2 WHERE conceded = 18
sql_create_context
CREATE TABLE table_40459 ( "Season" real, "Team" text, "Conference" text, "Head Coach" text, "Record" text )
What was the record of the team with head coach Steve Spurrier?
SELECT "Record" FROM table_40459 WHERE "Head Coach" = 'steve spurrier'
wikisql
CREATE TABLE table_15608800_2 ( railway VARCHAR, class VARCHAR )
Name the railway when class is j15
SELECT railway FROM table_15608800_2 WHERE class = "J15"
sql_create_context
CREATE TABLE table_78580 ( "Model" text, "Engine" text, "Cyl." text, "Power" text, "Torque" text )
Which Engine has a Model of s430?
SELECT "Engine" FROM table_78580 WHERE "Model" = 's430'
wikisql
CREATE TABLE table_25361 ( "R" real, "Player" text, "Scottish Premier League" real, "Scottish Cup" real, "Scottish League Cup" real, "Champions League (qualifying)" real, "Europa League" real, "Total" real )
Name the least europa league
SELECT MIN("Europa League") FROM table_25361
wikisql
CREATE TABLE table_25363904_2 ( season__number INTEGER, title_english VARCHAR )
Name the least season number for two marriage proposals
SELECT MIN(season__number) FROM table_25363904_2 WHERE title_english = "Two marriage proposals"
sql_create_context
CREATE TABLE table_40531 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text )
What was the result of the game with a score of 3-2?
SELECT "Result" FROM table_40531 WHERE "Score" = '3-2'
wikisql
CREATE TABLE table_58113 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
How many people were in attendance when the home team scored 7.11 (53)?
SELECT "Crowd" FROM table_58113 WHERE "Home team score" = '7.11 (53)'
wikisql
CREATE TABLE table_21313327_1 ( title VARCHAR, us_viewers__millions_ VARCHAR )
what was the name of the episode that got 3.3 (millions) of u.s viewers?
SELECT title FROM table_21313327_1 WHERE us_viewers__millions_ = "3.3"
sql_create_context
CREATE TABLE table_name_7 ( round INTEGER, player VARCHAR )
What round was Ryan Thang drafted in?
SELECT MIN(round) FROM table_name_7 WHERE player = "ryan thang"
sql_create_context
CREATE TABLE table_61544 ( "Round" real, "Player" text, "Position" text, "Nationality" text, "College/junior/club team (league)" text )
What is Player, when College/Junior/Club Team (League) is 'Val d'Or Foreurs ( QMJHL )'?
SELECT "Player" FROM table_61544 WHERE "College/junior/club team (league)" = 'val d''or foreurs ( qmjhl )'
wikisql
CREATE TABLE table_8344 ( "Date" text, "Round" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real )
What was the result on 27 august 2003?
SELECT "Result" FROM table_8344 WHERE "Date" = '27 august 2003'
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...
find the number of emergency hospital admission patients who have procedure icd9 code 5188.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND procedures.icd9_code = "5188"
mimicsql_data
CREATE TABLE ship ( ship_id number, name text, type text, built_year number, class text, flag text ) CREATE TABLE captain ( captain_id number, name text, ship_id number, age text, class text, rank text )
What are the names, classes, and ranks of all captains?
SELECT name, class, rank FROM captain
spider