context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
What is the number of patients who had exteriorization of small intestine and died in or before 2111?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2111.0" AND procedures.long_title = "Exteriorization of small intestine"
mimicsql_data
CREATE TABLE table_53204 ( "MLB season" text, "Reds season" real, "League" text, "Division" text, "Finish" text, "Wins" real, "Losses" real, "Win%" real, "GB [c ]" text )
What was the lowest wins in a season less than 1915 with a 7th finish and 0.429 win %?
SELECT MIN("Wins") FROM table_53204 WHERE "Finish" = '7th' AND "Win%" > '0.429' AND "Reds season" < '1915'
wikisql
CREATE TABLE table_train_21 ( "id" int, "pregnancy_or_lactation" bool, "severe_sepsis" bool, "systolic_blood_pressure_sbp" int, "active_infection" bool, "limited_care" bool, "septic_shock" bool, "coagulopathy" bool, "age" float, "lactate" int, "NOUSE" float )
patients < 18 years of age, pregnant patients, and patients with limitations of care.
SELECT * FROM table_train_21 WHERE age < 18 OR pregnancy_or_lactation = 1 OR limited_care = 1
criteria2sql
CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE journal ( journalid int, jo...
who published the most papers at EMNLP or ACL since 2011
SELECT DISTINCT COUNT(DISTINCT paper.paperid), writes.authorid FROM keyphrase, paper, paperkeyphrase, venue, writes WHERE paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND paper.year > 2011 AND venue.venueid = paper.venueid AND venue.venuename IN ('ACL', 'EMNLP') AND writ...
scholar
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE ReviewTaskStates ( Id number, Name te...
Percentage of users above a certain reputation threshold.
SELECT ((SELECT CAST(COUNT(*) AS FLOAT) FROM Users WHERE Reputation >= 15) / (SELECT COUNT(*) FROM Users))
sede
CREATE TABLE Course_Authors_and_Tutors ( author_id INTEGER, author_tutor_ATB VARCHAR(3), login_name VARCHAR(40), password VARCHAR(40), personal_name VARCHAR(80), middle_name VARCHAR(80), family_name VARCHAR(80), gender_mf VARCHAR(1), address_line_1 VARCHAR(80) ) CREATE TABLE Subject...
A bar chart about what are the student IDs and middle names of the students enrolled in at most two courses?, and I want to sort by the bars in descending.
SELECT T2.middle_name, T1.student_id FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id ORDER BY T2.middle_name DESC
nvbench
CREATE TABLE table_43180 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is the score that the player who placed t4 from the united states get?
SELECT "Score" FROM table_43180 WHERE "Country" = 'united states' AND "Place" = 't4'
wikisql
CREATE TABLE table_name_31 ( producer VARCHAR, director VARCHAR )
Who is the producer for the director Richard Clark?
SELECT producer FROM table_name_31 WHERE director = "richard clark"
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
give me the number of patients whose admission type is urgent and drug route is ivpca?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "URGENT" AND prescriptions.route = "IVPCA"
mimicsql_data
CREATE TABLE table_44539 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is Country, when Player is Billy Mayfair?
SELECT "Country" FROM table_44539 WHERE "Player" = 'billy mayfair'
wikisql
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...
give me the number of patients whose primary disease is cerebral aneurysm/sda and admission year is less than 2200?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CEREBRAL ANEURYSM/SDA" AND demographic.admityear < "2200"
mimicsql_data
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number...
when was the last time until 11/2105 patient 52898 was prescribed a drug via the ir route?
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 52898) AND prescriptions.route = 'ir' AND STRFTIME('%y-%m', prescriptions.startdate) <= '2105-11' ORDER BY prescriptions.startdate DESC LIMIT 1
mimic_iii
CREATE TABLE table_69652 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real )
How many years has 2 points?
SELECT SUM("Year") FROM table_69652 WHERE "Points" = '2'
wikisql
CREATE TABLE table_16840 ( "Player" text, "No." real, "Nationality" text, "Position" text, "Years for Jazz" text, "School/Club Team" text )
What is the number for years 1985-88
SELECT MIN("No.") FROM table_16840 WHERE "Years for Jazz" = '1985-88'
wikisql
CREATE TABLE mzjybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH number, 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, ...
检验报告单63924236375的状态如何,这份报告单的标本代码和名称是什么
SELECT zyjybgb.BBDM, zyjybgb.BBMC, zyjybgb.BBZT FROM zyjybgb WHERE zyjybgb.BGDH = '63924236375' UNION SELECT mzjybgb.BBDM, mzjybgb.BBMC, mzjybgb.BBZT FROM mzjybgb WHERE mzjybgb.BGDH = '63924236375'
css
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions...
what is age and date of birth of subject name paul edwards?
SELECT demographic.age, demographic.dob FROM demographic WHERE demographic.name = "Paul Edwards"
mimicsql_data
CREATE TABLE table_1341718_14 ( first_elected INTEGER, party VARCHAR, candidates VARCHAR )
When was the first elected when the party was republican and the candidate were robert h. michel (r) 66.1% rosa lee fox (d) 33.9%?
SELECT MIN(first_elected) FROM table_1341718_14 WHERE party = "Republican" AND candidates = "Robert H. Michel (R) 66.1% Rosa Lee Fox (D) 33.9%"
sql_create_context
CREATE TABLE table_36221 ( "Surname" text, "First" text, "D.O.B." text, "Bats" text, "Throws" text, "Position" text )
Which batter played P and was born 18 April 1984?
SELECT "Bats" FROM table_36221 WHERE "Position" = 'p' AND "D.O.B." = '18 april 1984'
wikisql
CREATE TABLE table_70959 ( "Parties and voter communities" text, "% 2006" real, "seats 2006" real, "% 2001" real, "seats 2001" real )
If 2006 is 13% and 2001 is greater than 12.1%, what is the greatest number of seats for 2001?
SELECT MAX("seats 2001") FROM table_70959 WHERE "% 2006" = '13' AND "% 2001" > '12.1'
wikisql
CREATE TABLE table_name_29 ( tournament VARCHAR, date VARCHAR )
What tournament is on 18 May 1992?
SELECT tournament FROM table_name_29 WHERE date = "18 may 1992"
sql_create_context
CREATE TABLE table_44346 ( "Rank" text, "Time" text, "Athlete" text, "Nation" text, "Date" text, "Race" text )
What is the name of the race in Kenya with a time of 30:27?
SELECT "Race" FROM table_44346 WHERE "Nation" = 'kenya' AND "Time" = '30:27'
wikisql
CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number ...
Are there Analysis of Modernist Music courses of 2 credits that you could show me ?
SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%Analysis of Modernist Music%' OR name LIKE '%Analysis of Modernist Music%') AND credits = 2
advising
CREATE TABLE table_79538 ( "City" text, "Country" text, "IATA" text, "ICAO" text, "Airport" text )
What is the IcAO of Frankfurt?
SELECT "ICAO" FROM table_79538 WHERE "City" = 'frankfurt'
wikisql
CREATE TABLE table_name_92 ( to_par VARCHAR, score VARCHAR )
What is the to par of the player with a 73-70-70-65=278 score?
SELECT to_par FROM table_name_92 WHERE score = 73 - 70 - 70 - 65 = 278
sql_create_context
CREATE TABLE table_29432 ( "Year" real, "Title" text, "Format" text, "Studio" text, "Release Date" text, "Copyright Information" text, "Catalog Number" text )
How many times is the title am/pm callanetics?
SELECT COUNT("Studio") FROM table_29432 WHERE "Title" = 'AM/PM Callanetics'
wikisql
CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDispl...
Create inverted index table data for.
SELECT * FROM Users WHERE LastAccessDate LIKE '%2018%'
sede
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...
Which classes are being taught by Dr. Jaime Rodriguez-matos next semester ?
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Jaime Rodriguez-matos%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instru...
advising
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
名叫袁秀筠的患者检测指标634250从09年10月15日到14年10月24日的情况如何?
(SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb 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 AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGD...
css
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 weather ( date TEX...
Show me start_station_id by start station name in a histogram
SELECT start_station_name, start_station_id FROM trip
nvbench
CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE time_interval ( period text, begin_time int, end_time...
give me the flights from NEW YORK to LAS VEGAS on sunday and the flights from MEMPHIS to LAS VEGAS on sunday
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, date_day, days, flight WHERE (CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'LAS VEGAS' AND date...
atis
CREATE TABLE table_56196 ( "Outcome" text, "Date" real, "Championship" text, "Surface" text, "Opponent" text, "Score" text )
During what Championship was the Opponent Jeff Borowiak?
SELECT "Championship" FROM table_56196 WHERE "Opponent" = 'jeff borowiak'
wikisql
CREATE TABLE table_203_540 ( id number, "symbol" text, "gsi" text, "meaning" text, "unicode" text, "description" text )
which has a unicode of u +22 a1 , the benchmark symbol or the factory symbol ?
SELECT "meaning" FROM table_203_540 WHERE "unicode" = 'u+22a1'
squall
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE Tags ( Id number, TagName text, Count num...
Jon Skeet Non Tag Badge Counts.
SELECT Name, COUNT(*) AS NumTagBadges FROM Badges WHERE Name NOT IN (SELECT TagName FROM Tags) AND UserId = 22656 GROUP BY Name ORDER BY NumTagBadges DESC
sede
CREATE TABLE postseason ( year INTEGER, round TEXT, team_id_winner TEXT, league_id_winner TEXT, team_id_loser TEXT, league_id_loser TEXT, wins INTEGER, losses INTEGER, ties INTEGER ) CREATE TABLE salary ( year INTEGER, team_id TEXT, league_id TEXT, player_id TEXT, ...
Bar graph to show how many yearid from different yearid, list in descending by the Y-axis.
SELECT yearid, COUNT(yearid) FROM hall_of_fame ORDER BY COUNT(yearid) DESC
nvbench
CREATE TABLE rental ( rental_id number, rental_date time, inventory_id number, customer_id number, return_date time, staff_id number, last_update time ) CREATE TABLE country ( country_id number, country text, last_update time ) CREATE TABLE actor ( actor_id number, firs...
Return the title and inventory id of the film that is rented most often.
SELECT T1.title, T2.inventory_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T2.inventory_id ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE table_32436 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
On what date was there both a crowd larger than 16,570 and the away team was Footscray?
SELECT "Date" FROM table_32436 WHERE "Crowd" > '16,570' AND "Away team" = 'footscray'
wikisql
CREATE TABLE table_67533 ( "Country" text, "2012" real, "2011" real, "2010" real, "2009" real, "2008" real, "2007" real, "2006" real, "2005" real, "2004" real, "2003" real, "2002" real, "2001" real, "2000" real, "1999" real, "1998" real, "1997" real, ...
What is the average for 2009 when 2001 is more than 0, 1996 is less than 1 and 2004 is more than 2
SELECT AVG("2009") FROM table_67533 WHERE "2001" > '0' AND "1996" < '1' AND "2004" > '2'
wikisql
CREATE TABLE table_52390 ( "Wicket Partnership" text, "Runs" text, "Batsmen" text, "Opponents" text, "Venue" text, "Season" text )
Who was the opponents of the 5th Wicket Partnership?
SELECT "Opponents" FROM table_52390 WHERE "Wicket Partnership" = '5th'
wikisql
CREATE TABLE table_name_79 ( name VARCHAR, lane VARCHAR )
Which name has a Lane of 7?
SELECT name FROM table_name_79 WHERE lane = 7
sql_create_context
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom te...
what is the first time patient 83894 was admitted through the phys referral/normal deli to the hospital in 2102?
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 83894 AND admissions.admission_location = 'phys referral/normal deli' AND STRFTIME('%y', admissions.admittime) = '2102' ORDER BY admissions.admittime LIMIT 1
mimic_iii
CREATE TABLE table_name_32 ( record VARCHAR, date VARCHAR )
What record has November 15 as the date?
SELECT record FROM table_name_32 WHERE date = "november 15"
sql_create_context
CREATE TABLE table_56853 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
Which first leg had Galatasaray as Team 1?
SELECT "1st leg" FROM table_56853 WHERE "Team 1" = 'galatasaray'
wikisql
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number...
what is the total number of patients who had received a entral infus nutrit sub procedure two times in the last year?
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'entral infus nutrit s...
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, ...
李梦琪患者从2000年6月15日开始到2007年8月6日这一段时间里,所有检验结果指标记录的检测人为章丹红的检验指标流水号是多少?
SELECT jyjgzbb.JYZBLSH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb 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 AND mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_...
css
CREATE TABLE table_65232 ( "Fish" text, "Guernsey Record" text, "Year" text, "Location" text, "British Record" text )
What is the British record for the fish with a Guernsey record of 32-8-0?
SELECT "British Record" FROM table_65232 WHERE "Guernsey Record" = '32-8-0'
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...
不高于23岁的病人的医疗记录的医疗费总额是多少?计算出平均值
SELECT AVG(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_PERSON_AGE <= 23)
css
CREATE TABLE zyjzjlb ( YLJGDM text, JZLSH text, MZJZLSH text, KH text, KLX number, HZXM text, WDBZ number, RYDJSJ time, RYTJDM number, RYTJMC text, JZKSDM text, JZKSMC text, RZBQDM text, RZBQMC text, RYCWH text, CYKSDM text, CYKSMC text, CYBQDM tex...
从一四年八月十日到二一年十一月二十三日的这几年里,共有多少患者在医疗机构4098597的住院时长超过27天
SELECT COUNT(*) FROM zyjzjlb WHERE YLJGDM = '4098597' AND RYDJSJ BETWEEN '2014-08-10' AND '2021-11-23' AND DATEDIFF(CYSJ, RYSJ) > 27
css
CREATE TABLE Skills ( skill_id INTEGER, skill_code VARCHAR(20), skill_description VARCHAR(255) ) CREATE TABLE Parts ( part_id INTEGER, part_name VARCHAR(255), chargeable_yn VARCHAR(1), chargeable_amount VARCHAR(20), other_part_details VARCHAR(255) ) CREATE TABLE Fault_Log ( fault_l...
How many assets does each third party company supply? List the count and the company id. Show the correlation.
SELECT COUNT(*), company_id FROM Third_Party_Companies AS T1 JOIN Assets AS T2 ON T1.company_id = T2.supplier_company_id GROUP BY T1.company_id
nvbench
CREATE TABLE table_23652 ( "LMS 1932/3 No." real, "LMS 1946 No." real, "BR No." real, "Date built" text, "Date motor gear fitted" text, "Withdrawn" text )
When was the motor gear of the LMS 1946 no. 1901 model fitted?
SELECT "Date motor gear fitted" FROM table_23652 WHERE "LMS 1946 No." = '1901'
wikisql
CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT ) CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, e...
What are the dates in which the mean sea level pressure was between 30.3 and 31, and count them by a line chart
SELECT date, COUNT(date) FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31 GROUP BY date
nvbench
CREATE TABLE table_757 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
What is the district with Republican party in place?
SELECT "District" FROM table_757 WHERE "Party" = 'Republican'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE zyjzjlb_jybgb ( YLJGDM_ZYJZJLB text, BGDH number, YLJGDM number ) CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, ...
患者编号为76980404的人在2001年7月25日到2018年6月20日内曾在医院就诊的次数有多少次?
SELECT (SELECT COUNT(*) 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.RYBH = '76980404' AND mzjzjlb.JZKSRQ BETWEEN '2001-07-25' AND '2018-06-20') + (SELECT COUNT(*) FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_...
css
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
Bar chart of school_id from each all games, display total number from low to high order.
SELECT All_Games, School_ID FROM basketball_match ORDER BY School_ID
nvbench
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
give me the number of patients whose diagnoses short title is malfunc oth device/graft and lab test name is urea nitrogen?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Malfunc oth device/graft" AND lab.label = "Urea Nitrogen"
mimicsql_data
CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuest...
Top deleted users, with dates of first and last posts.
SELECT p.OwnerDisplayName, SUM(p.Score) AS "total_score", COUNT(p.Id) AS "number_of_posts", MIN(p.CreationDate) AS "first_post", MAX(p.CreationDate) AS "last_post", DATEDIFF(day, MIN(p.CreationDate), MAX(p.CreationDate)) AS Duration FROM Posts AS p WHERE p.OwnerUserId IS NULL GROUP BY p.OwnerDisplayName ORDER BY MAX(p....
sede
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, val...
what was the last procedure time patient 26995 went through since 5 years ago?
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26995) AND DATETIME(procedures_icd.charttime) >= DATETIME(CURRENT_TIME(), '-5 year') ORDER BY procedures_icd.charttime DESC LIMIT 1
mimic_iii
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...
自二零零八年十一月二十七日开始,截止到二零一九年二月二十一日,患者奚美丽通过医疗机构4566860做了多少次检查
SELECT COUNT(*) FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_NM = '奚美丽' AND t_kc22.STA_DATE BETWEEN '2008-11-27' AND '2019-02-21' AND t_kc21.MED_SER_ORG_NO = '4566860' AND t_kc22.MED_INV_ITEM...
css
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text,...
what was the last height of patient 26817 in 10/this year?
SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26817)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit ht'...
mimic_iii
CREATE TABLE table_204_441 ( id number, "date" text, "opponent" text, "venue" text, "result" text, "attendance" number, "scorers" text )
what number of games did oxford united f.c. play in august 1998 ?
SELECT COUNT(*) FROM table_204_441 WHERE "date" = 8 AND "date" = 1998
squall
CREATE TABLE table_name_78 ( away_team VARCHAR, venue VARCHAR )
Which team played away at Victoria park?
SELECT away_team AS score FROM table_name_78 WHERE venue = "victoria park"
sql_create_context
CREATE TABLE table_name_34 ( official_target_date VARCHAR, currency VARCHAR )
What is the official target date for the Swedish Krona?
SELECT official_target_date FROM table_name_34 WHERE currency = "swedish krona"
sql_create_context
CREATE TABLE table_name_6 ( opponent VARCHAR, date VARCHAR )
What opponent played on 1/13/1974?
SELECT opponent FROM table_name_6 WHERE date = "1/13/1974"
sql_create_context
CREATE TABLE table_29087004_3 ( series__number VARCHAR, written_by VARCHAR )
Which episode/s were written by Evan Gore?
SELECT series__number FROM table_29087004_3 WHERE written_by = "Evan Gore"
sql_create_context
CREATE TABLE table_name_4 ( party VARCHAR, incumbent VARCHAR )
What party is Charles Van Wyck part of?
SELECT party FROM table_name_4 WHERE incumbent = "charles van wyck"
sql_create_context
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), ...
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of hire_date and the average of salary bin hire_date by weekday, and could you sort y axis in descending order?
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(SALARY) DESC
nvbench
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,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...
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 first_name and department_id , and I want to sort from low to high by the total number.
SELECT FIRST_NAME, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY DEPARTMENT_ID
nvbench
CREATE TABLE table_name_11 ( total INTEGER, rank VARCHAR, silver VARCHAR )
Which Total has a Rank of 4, and a Silver larger than 2?
SELECT MIN(total) FROM table_name_11 WHERE rank = "4" AND silver > 2
sql_create_context
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAc...
Questions with just two tags, [homework] and [CHOOSE YOUR OWN ADVENTURE].
SELECT q.Id AS "post_link", q.Score, q.Tags, q.ClosedDate FROM Posts AS q WHERE q.PostTypeId = 1 AND q.Tags LIKE '%<homework>%' AND q.Tags LIKE '%<' + @CoTag + '>%' AND LENGTH(q.Tags) - LENGTH(REPLACE(q.Tags, '><', '')) = 2 AND ((q.ClosedDate IS NULL AND UPPER(@OpenQs) = 'Y') OR (NOT q.ClosedDate IS NULL AND UPPER(@Clo...
sede
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 cost ( costid num...
what was the name of the medicine that patient 030-75705 was prescribed with after having had a mannitol procedure in the previous month within the same day?
SELECT t2.drugname FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-75705') AND treatment.treatme...
eicu
CREATE TABLE table_71832 ( "Date" text, "Tournament" text, "Surface" text, "Opponent in the Final" text, "Score in the Final" text )
When did Mathieu play against Andrey Golubev?
SELECT "Date" FROM table_71832 WHERE "Opponent in the Final" = 'andrey golubev'
wikisql
CREATE TABLE county ( County_Id int, County_name text, Population real, Zip_code text ) CREATE TABLE election ( Election_ID int, Counties_Represented text, District int, Delegate text, Party int, First_Elected real, Committee text ) CREATE TABLE party ( Party_ID int, ...
For each party, return the name of the party and the number of delegates from that party Plot them as bar chart, show by the total number from high to low.
SELECT T2.Party, AVG(COUNT(*)) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T2.Party ORDER BY AVG(COUNT(*)) DESC
nvbench
CREATE TABLE table_65106 ( "Nat." text, "Name" text, "Moving from" text, "Type" text, "Transfer window" text, "Ends" real, "Transfer fee" text )
What was the transfer window with a moving from of fenerbah e?
SELECT "Transfer window" FROM table_65106 WHERE "Moving from" = 'fenerbahçe'
wikisql
CREATE TABLE table_name_13 ( position VARCHAR, number VARCHAR )
Which position does number 23 play?
SELECT position FROM table_name_13 WHERE number = "23"
sql_create_context
CREATE TABLE table_26199130_1 ( rank__week_ VARCHAR, no VARCHAR )
What was the rank (week) for episode number 34?
SELECT rank__week_ FROM table_26199130_1 WHERE no = 34
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
what is the number of patients whose language is span and age is less than 72?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.language = "SPAN" AND demographic.age < "72"
mimicsql_data
CREATE TABLE table_45910 ( "Winner" text, "Country" text, "Winter Olympics" text, "FIS Nordic World Ski Championships" text, "Holmenkollen" text )
Which FIS Nordic World Ski Championships has Winter Olympics of 1960?
SELECT "FIS Nordic World Ski Championships" FROM table_45910 WHERE "Winter Olympics" = '1960'
wikisql
CREATE TABLE Apartment_Facilities ( apt_id INTEGER, facility_code CHAR(15) ) CREATE TABLE Apartment_Bookings ( apt_booking_id INTEGER, apt_id INTEGER, guest_id INTEGER, booking_status_code CHAR(15), booking_start_date DATETIME, booking_end_date DATETIME ) CREATE TABLE View_Unit_Status ...
Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order in a bar chart.
SELECT apt_type_code, COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*)
nvbench
CREATE TABLE table_name_1 ( finish VARCHAR, year_s__won VARCHAR )
Where did the player who won in 1991 finish?
SELECT finish FROM table_name_1 WHERE year_s__won = "1991"
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 admission year is less than 2179 and procedure long title is endovascular (total) embolization or occlusion of head and neck vessels?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2179" AND procedures.long_title = "Endovascular (total) embolization or occlusion of head and neck vessels"
mimicsql_data
CREATE TABLE table_225198_3 ( successor VARCHAR, reason_for_change VARCHAR )
Name the successor for james noble died in previous congress
SELECT successor FROM table_225198_3 WHERE reason_for_change = "James Noble died in previous Congress"
sql_create_context
CREATE TABLE table_70877 ( "Title" text, "Studio" text, "Role" text, "Leading lady" text, "Director" text )
Which title had Muriel Evans as leading lady?
SELECT "Title" FROM table_70877 WHERE "Leading lady" = 'muriel evans'
wikisql
CREATE TABLE table_name_67 ( matches INTEGER, goals VARCHAR, rank VARCHAR, years VARCHAR )
Which Matches have a Rank smaller than 5, a Years of 1995 2003, and a Goals smaller than 104?
SELECT AVG(matches) FROM table_name_67 WHERE rank < 5 AND years = "1995–2003" AND goals < 104
sql_create_context
CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments ...
What are the Spring or Summer courses offered that meet the Core requirement ?
SELECT DISTINCT course.department, course.name, course.number, semester.semester 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...
advising
CREATE TABLE table_33809 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Time" text, "Att." text, "Record" text )
What loss has 16,458 as an Att.?
SELECT "Loss" FROM table_33809 WHERE "Att." = '16,458'
wikisql
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE treatment ( treatmentid number...
did patient 011-14590's systemicmean ever be less than 91.0 since 03/2105?
SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '011-14590')) AND vitalperiodic.systemicmean < 91.0 AND NOT vitalperi...
eicu
CREATE TABLE Web_client_accelerator ( id int, name text, Operating_system text, Client text, Connection text ) CREATE TABLE browser ( id int, name text, market_share real ) CREATE TABLE accelerator_compatible_browser ( accelerator_id int, browser_id int, compatible_since_ye...
Display a bar chart for what are the ids and names of the web accelerators that are compatible with two or more browsers?, and I want to sort y-axis from low to high order.
SELECT name, id FROM Web_client_accelerator AS T1 JOIN accelerator_compatible_browser AS T2 ON T2.accelerator_id = T1.id ORDER BY id
nvbench
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE PostsWithDeleted ( Id number, PostTyp...
Posts counting for Copy Editor badge.
SELECT DISTINCT (p.Id) AS "post_link" FROM Users AS u INNER JOIN PostHistory AS h ON u.Id = h.UserId INNER JOIN Posts AS p ON p.Id = h.PostId WHERE u.AccountId = '##AccountId:int##' AND h.PostHistoryTypeId IN (4, 5) AND (p.OwnerUserId IS NULL OR p.OwnerUserId != u.Id OR p.PostTypeId NOT IN (1, 2))
sede
CREATE TABLE table_27373 ( "Pick #" real, "NFL Team" text, "Player" text, "Position" text, "College" text )
Name the position for delaware
SELECT "Position" FROM table_27373 WHERE "College" = 'Delaware'
wikisql
CREATE TABLE table_21576644_2 ( ladies_1st_xi VARCHAR, mens_2nd_xi VARCHAR )
When 10th, south west district 1 is the mens 2nd xi what is the ladies 1st xi?
SELECT ladies_1st_xi FROM table_21576644_2 WHERE mens_2nd_xi = "10th, South West District 1"
sql_create_context
CREATE TABLE table_name_1 ( country VARCHAR, place VARCHAR, player VARCHAR )
What is Country, when Place is 'T9', and when Player is 'Michael Campbell'?
SELECT country FROM table_name_1 WHERE place = "t9" AND player = "michael campbell"
sql_create_context
CREATE TABLE table_204_128 ( id number, "region" text, "date" text, "label" text, "format" text, "catalog" text )
what was the date of the first vinyl lp release ?
SELECT "date" FROM table_204_128 WHERE "format" = 'vinyl lp' ORDER BY "date" LIMIT 1
squall
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
When will The Academic Paradox be offered again ?
SELECT DISTINCT semester.semester, semester.year FROM semester INNER JOIN course_offering ON semester.semester_id = course_offering.semester INNER JOIN course ON course.course_id = course_offering.course_id WHERE course.name LIKE '%The Academic Paradox%' AND semester.semester_id > (SELECT SEMESTERalias1.semester_id FRO...
advising
CREATE TABLE station ( Station_ID int, Name text, Annual_entry_exit real, Annual_interchanges real, Total_Passengers real, Location text, Main_Services text, Number_of_Platforms int ) CREATE TABLE train_station ( Train_ID int, Station_ID int ) CREATE TABLE train ( Train_ID ...
For each location, give me a scatter chart showing the relationships between the number of total_passengers and the number of platforms.
SELECT SUM(Number_of_Platforms), SUM(Total_Passengers) FROM station GROUP BY Location
nvbench
CREATE TABLE table_68395 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text )
What is the result when the date is August 27, 1980?
SELECT "Result" FROM table_68395 WHERE "Date" = 'august 27, 1980'
wikisql
CREATE TABLE table_name_67 ( grid INTEGER, name VARCHAR )
What is the highest Grid with a Name that is jamie whincup?
SELECT MAX(grid) FROM table_name_67 WHERE name = "jamie whincup"
sql_create_context
CREATE TABLE vocals ( songid VARCHAR ) CREATE TABLE songs ( title VARCHAR, songid VARCHAR )
Find all the songs that do not have a back vocal.
SELECT DISTINCT title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid = t2.songid EXCEPT SELECT t2.title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid = t2.songid WHERE TYPE = "back"
sql_create_context
CREATE TABLE table_12033013_1 ( written_by VARCHAR, production_code VARCHAR )
WHO WROTE THE STORY WITH THE PRODUCTION CODE OF 1ADK-03
SELECT written_by FROM table_12033013_1 WHERE production_code = "1ADK-03"
sql_create_context
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...
how many patients whose gender is f and diagnoses short title is blood in stool?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.short_title = "Blood in stool"
mimicsql_data
CREATE TABLE table_name_58 ( apps INTEGER, goals INTEGER )
What is the highest Apps, when Goals are greater than 5?
SELECT MAX(apps) FROM table_name_58 WHERE goals > 5
sql_create_context
CREATE TABLE table_37725 ( "Favorite professional sport" text, "2005" text, "2008" text, "2011" text, "2012" text )
What is listed for the 2011 that has a 2005 of 4.2%?
SELECT "2011" FROM table_37725 WHERE "2005" = '4.2%'
wikisql