context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswe...
Top users in Khorasan province in Iran.
SELECT u.Id AS "user_link", COUNT(*) AS UpVotes FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS p ON p.ParentId = pt.PostId INNER JOIN Votes AS v ON v.PostId = p.Id AND v.VoteTypeId = 2 INNER JOIN Users AS u ON u.Id = p.OwnerUserId WHERE p.CommunityOwnedDate IS NULL AND LOWER(t.TagName) ...
sede
CREATE TABLE table_name_16 ( outcome VARCHAR, surface VARCHAR )
What was the Outcome of the match played on Hard (i) Surface?
SELECT outcome FROM table_name_16 WHERE surface = "hard (i)"
sql_create_context
CREATE TABLE table_203_58 ( id number, "airline" text, "airline (in russian)" text, "licence #" number, "icao" text, "iata" text, "domestic code" text, "callsign" text, "photo" text )
which airline has the highest license #
SELECT "airline" FROM table_203_58 ORDER BY "licence #" DESC LIMIT 1
squall
CREATE TABLE table_name_57 ( score VARCHAR, home VARCHAR )
What score has Toronto Eagles as the home?
SELECT score FROM table_name_57 WHERE home = "toronto eagles"
sql_create_context
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), ...
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about salary over the last_name by a bar chart, I want to display in descending by the X please.
SELECT LAST_NAME, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY LAST_NAME DESC
nvbench
CREATE TABLE table_30325 ( "Year Location" text, "Mens Singles" text, "Womens Singles" text, "Mens Doubles" text, "Womens Doubles" text )
Name the mens doubles for dimitrij ovtcharov
SELECT "Mens Doubles" FROM table_30325 WHERE "Mens Singles" = 'Dimitrij Ovtcharov'
wikisql
CREATE TABLE table_11647327_2 ( marginal_ordinary_income_tax_rate VARCHAR, single VARCHAR )
What is the amount of marginal ordinary income tax rate for single in which the range is $8,351 $33,950?
SELECT COUNT(marginal_ordinary_income_tax_rate) FROM table_11647327_2 WHERE single = "$8,351– $33,950"
sql_create_context
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number...
how much is the change of arterial bp [diastolic] of patient 28443 last measured on the current intensive care unit visit compared to the value second to last measured on the current intensive care unit visit?
SELECT (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 = 28443) AND icustays.outtime IS NULL) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_i...
mimic_iii
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGui...
Deleted users by their posts.
SELECT OwnerDisplayName, MAX(CreationDate), COUNT(*) AS Count FROM Posts WHERE OwnerUserId IS NULL GROUP BY OwnerDisplayName ORDER BY Count DESC, OwnerDisplayName LIMIT 100
sede
CREATE TABLE people ( People_ID int, Name text, Country text, Is_Male text, Age int ) CREATE TABLE church ( Church_ID int, Name text, Organized_by text, Open_Date int, Continuation_of text ) CREATE TABLE wedding ( Church_ID int, Male_ID int, Female_ID int, Year ...
A line chart shows how many churches open each year?
SELECT Open_Date, COUNT(Open_Date) FROM church GROUP BY Open_Date
nvbench
CREATE TABLE table_train_182 ( "id" int, "allergy_to_sulfa" bool, "creatinine_clearance_cl" float, "liver_disease" bool, "allergy_to_glyburide" bool, "allergy_to_metformin" bool, "NOUSE" float )
allergy to sulfa;
SELECT * FROM table_train_182 WHERE allergy_to_sulfa = 1
criteria2sql
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 procedures ( ...
what is drug type of drug code simv10?
SELECT prescriptions.drug_type FROM prescriptions WHERE prescriptions.formulary_drug_cd = "SIMV10"
mimicsql_data
CREATE TABLE table_21237 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
Name the total number of high rebounds for february 10
SELECT COUNT("High rebounds") FROM table_21237 WHERE "Date" = 'February 10'
wikisql
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wa...
what was the name of the lab test that in 11/2104 patient 004-54892 received for the first time?
SELECT lab.labname FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-54892')) AND STRFTIME('%y-%m', lab.labresulttime) = '2104-11' ORDER BY lab.labresultt...
eicu
CREATE TABLE table_name_54 ( frequency_mhz INTEGER, erp_w VARCHAR )
What is the average frequency in MHz for stations with an ERP W of 170?
SELECT AVG(frequency_mhz) FROM table_name_54 WHERE erp_w = 170
sql_create_context
CREATE TABLE table_name_87 ( award_ceremony VARCHAR, nominee VARCHAR, category VARCHAR )
Which Award Ceremony has a Nominee of sarah travis, and a Category of the best orchestrations?
SELECT award_ceremony FROM table_name_87 WHERE nominee = "sarah travis" AND category = "best orchestrations"
sql_create_context
CREATE TABLE table_203_117 ( id number, "region/country" text, "1882-\n1918" number, "1919-\n1948" number, "1948-\n1951" number, "1952-\n1960" number, "1961-\n1971" number, "1972-\n1979" number, "1980-\n1989" number, "1990-\n2001" number, "2002-\n2010" number, "2011-\n201...
what is the largest number of births recorded ?
SELECT MAX("total") FROM table_203_117
squall
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
what is the average cost in a hospital involving a laboratory test for gentamicin - random?
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT lab.patientunitstayid FROM lab WHERE lab.labname = 'gentamicin - random')) GROUP BY cost.patienthealthsystemstayid) AS t...
eicu
CREATE TABLE table_name_32 ( gold INTEGER, rank VARCHAR, silver VARCHAR )
what is the average gold when rank is total and silver is more than 20?
SELECT AVG(gold) FROM table_name_32 WHERE rank = "total" AND silver > 20
sql_create_context
CREATE TABLE table_71397 ( "Branding" text, "Callsign" text, "Frequency" text, "Power (kW)" text, "Station Type" text, "Location" text )
Where is the place that has a Callsign of DWRJ-FM?
SELECT "Location" FROM table_71397 WHERE "Callsign" = 'dwrj-fm'
wikisql
CREATE TABLE table_name_24 ( rank INTEGER, silver VARCHAR, bronze VARCHAR )
What is the Rank of the Nation with 0 Silver and more than 1 Bronze?
SELECT MAX(rank) FROM table_name_24 WHERE silver < 1 AND bronze > 1
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number,...
以前患者07290816有过什么异常情况吗?
SELECT * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON 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.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz_info.RYBH = '...
css
CREATE TABLE table_name_85 ( goals_against VARCHAR, drawn VARCHAR, lost VARCHAR, goals_for VARCHAR )
How many goals scored against the opposing team occurred with more than 7 losses, less than 27 goals scored for the team and drawn more than 1?
SELECT COUNT(goals_against) FROM table_name_85 WHERE lost > 7 AND goals_for < 27 AND drawn > 1
sql_create_context
CREATE TABLE table_203_618 ( id number, "pick" number, "player" text, "team" text, "position" text, "school" text )
where did mark mulder go to school
SELECT "school" FROM table_203_618 WHERE "player" = 'mark mulder'
squall
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 icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, fi...
how many patients died in the same hospital encounter after having been diagnosed the previous year with grand mal status?
SELECT COUNT(DISTINCT t2.subject_id) FROM (SELECT t1.subject_id, t1.charttime, t1.hadm_id FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FRO...
mimic_iii
CREATE TABLE table_63549 ( "Position" real, "Name" text, "Played" real, "Drawn" real, "Lost" real, "Points" real )
Which Lost has Drawn larger than 1, and a Played larger than 14?
SELECT MIN("Lost") FROM table_63549 WHERE "Drawn" > '1' AND "Played" > '14'
wikisql
CREATE TABLE table_250230_2 ( brakes VARCHAR, gearbox VARCHAR )
What brakes for the 4-speed automatic gearbox?
SELECT brakes FROM table_250230_2 WHERE gearbox = "4-speed automatic"
sql_create_context
CREATE TABLE table_30950 ( "Rd." real, "Grand Prix" text, "Pole Position" text, "Fastest Lap" text, "Winning Driver" text, "Constructor" text, "Report" text )
Who had the fastest lap in round 15?
SELECT "Fastest Lap" FROM table_30950 WHERE "Rd." = '15'
wikisql
CREATE TABLE table_64580 ( "Pick" real, "Player" text, "Team" text, "Position" text, "School" text )
What school has the Kansas City Royals for a team?
SELECT "School" FROM table_64580 WHERE "Team" = 'kansas city royals'
wikisql
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...
名为奚芳蕤的患者过去有过什么异常情况么?
SELECT * FROM person_info JOIN hz_info JOIN txmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jy...
css
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...
看看患者水葛菲从2016.4.26到2019.12.28这期间,曾就诊过多少位医生
SELECT COUNT(txmzjzjlb.ZZYSGH) FROM person_info JOIN hz_info JOIN txmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX WHERE person_info.XM = '水葛菲' AND txmzjzjlb.JZKSRQ BETWEEN '2016-04-26' AND '2019-12-28' UNION SELECT COUNT(ft...
css
CREATE TABLE table_name_12 ( date VARCHAR, attendance VARCHAR )
Which game had an attendance of 56,271?
SELECT date FROM table_name_12 WHERE attendance = "56,271"
sql_create_context
CREATE TABLE table_6547 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-10" real, "Top-25" real, "Events" real, "Cuts made" real )
How many Wins have a Top-10 smaller than 6, and Cuts made larger than 7, and a Top-5 of 0?
SELECT COUNT("Wins") FROM table_6547 WHERE "Top-10" < '6' AND "Cuts made" > '7' AND "Top-5" = '0'
wikisql
CREATE TABLE table_name_61 ( team VARCHAR, game VARCHAR, date VARCHAR )
Who was the Team that was played against on February 24 and a game after game 55?
SELECT team FROM table_name_61 WHERE game > 55 AND date = "february 24"
sql_create_context
CREATE TABLE albums ( aid number, title text, year number, label text, type text ) CREATE TABLE vocals ( songid number, bandmate number, type text ) CREATE TABLE tracklists ( albumid number, position number, songid number ) CREATE TABLE band ( id number, firstname ...
How many songs appear in studio albums?
SELECT COUNT(DISTINCT T3.title) FROM albums AS T1 JOIN tracklists AS T2 ON T1.aid = T2.albumid JOIN songs AS T3 ON T2.songid = T3.songid WHERE t1.type = "Studio"
spider
CREATE TABLE table_73378 ( "Rank" real, "Athlete" text, "Nation" text, "Olympics" text, "Gold" real, "Silver" real, "Bronze" real, "Total(min. 2 medals)" real )
What is the least amount of total medals won?
SELECT MIN("Total(min. 2 medals)") FROM table_73378
wikisql
CREATE TABLE table_22860990_3 ( opp_points INTEGER, record VARCHAR )
How many points did the opponents with a 6-2 record against the Spartans score?
SELECT MIN(opp_points) FROM table_22860990_3 WHERE record = "6-2"
sql_create_context
CREATE TABLE table_name_9 ( tonnage VARCHAR, ship VARCHAR, builder VARCHAR, original_operator VARCHAR )
What is the Tonnage that has builder AG Vulcan, and the original operator NDL, and the ship, Prinzess Irene?
SELECT tonnage FROM table_name_9 WHERE builder = "ag vulcan" AND original_operator = "ndl" AND ship = "prinzess irene"
sql_create_context
CREATE TABLE table_27151 ( "Rnd." real, "Circuit" text, "LMP1 Winning Team" text, "LMP2 Winning Team" text, "FLM Winning Team" text, "GT1 Winning Team" text, "GT2 Winning Team" text, "Results" text )
What was the maximum round where Marc Lieb Richard Lietz was on the GT2 Winning Team?
SELECT MAX("Rnd.") FROM table_27151 WHERE "GT2 Winning Team" = 'Marc Lieb Richard Lietz'
wikisql
CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name ...
what is the least expensive BUSINESS class flight between ATLANTA and DALLAS
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, fare AS FARE_0, fare AS FARE_1, fare_basis, flight, flight_fare AS FLIGHT_FARE_0, flight_fare AS FLIGHT_FARE_1 WHERE ((CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY...
atis
CREATE TABLE torrents ( groupname text, totalsnatched number, artist text, groupyear number, releasetype text, groupid number, id number ) CREATE TABLE tags ( index number, id number, tag text )
Which tag is used for which release title?
SELECT T1.tag, T2.groupname FROM torrents AS T2 JOIN tags AS T1 ON T1.id = T2.id
whatcdhiphop
CREATE TABLE table_name_4 ( year INTEGER, silver VARCHAR )
How many years has Japan won silver?
SELECT SUM(year) FROM table_name_4 WHERE silver = "japan"
sql_create_context
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE C...
Users with highest average viewcount of their questions.
SELECT RANK() OVER (ORDER BY AVG(CAST(p.ViewCount AS FLOAT)) DESC) AS "rank", p.OwnerUserId AS "user_link", p.OwnerDisplayName, AVG(CAST(p.ViewCount AS FLOAT)) AS "average_viewcount", SUM(p.ViewCount) AS "total_views", SUM(CASE WHEN p.CommunityOwnedDate IS NULL THEN p.ViewCount ELSE 0 END) AS "noncw_views", COUNT(p.Id)...
sede
CREATE TABLE table_name_6 ( seats INTEGER, general_election VARCHAR, share_of_votes VARCHAR, share_of_seats VARCHAR )
Which Seatshave a Share of votes of 18%, and a Share of seats of 3%, and a General election smaller than 1992?
SELECT MIN(seats) FROM table_name_6 WHERE share_of_votes = "18%" AND share_of_seats = "3%" AND general_election < 1992
sql_create_context
CREATE TABLE table_name_99 ( total VARCHAR, year_s__won VARCHAR )
What is the total for the year (s) won in 1977?
SELECT total FROM table_name_99 WHERE year_s__won = "1977"
sql_create_context
CREATE TABLE table_name_69 ( block INTEGER, height VARCHAR, spike VARCHAR )
What is the lowest number of blocks for players with height of 206 and more than 356 spikes?
SELECT MIN(block) FROM table_name_69 WHERE height = 206 AND spike > 356
sql_create_context
CREATE TABLE tasks ( task_id number, project_id number, task_details text, eg agree objectives text ) CREATE TABLE research_staff ( staff_id number, employer_organisation_id number, staff_details text ) CREATE TABLE grants ( grant_id number, organisation_id number, grant_amount...
Which organisation hired the most number of research staff? List the organisation id, type and detail.
SELECT T1.organisation_id, T1.organisation_type, T1.organisation_details FROM organisations AS T1 JOIN research_staff AS T2 ON T1.organisation_id = T2.employer_organisation_id GROUP BY T1.organisation_id ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE table_12338595_1 ( preliminaries VARCHAR, interview VARCHAR )
What is the preliminary score associated with the interview score of 8.488?
SELECT COUNT(preliminaries) FROM table_12338595_1 WHERE interview = "8.488"
sql_create_context
CREATE TABLE film_market_estimation ( estimation_id number, low_estimate number, high_estimate number, film_id number, type text, market_id number, year number ) CREATE TABLE film ( film_id number, title text, studio text, director text, gross_in_dollar number ) CREATE ...
Count the number of markets that have a number of cities lower than 300.
SELECT COUNT(*) FROM market WHERE number_cities < 300
spider
CREATE TABLE table_name_38 ( rank VARCHAR, gatchaman VARCHAR )
What is the rank of the gatchaman Jinpei?
SELECT rank FROM table_name_38 WHERE gatchaman = "jinpei"
sql_create_context
CREATE TABLE table_66009 ( "Ship" text, "Year" real, "Dates" text, "Line" text, "From" text, "Distance" text, "Days, hours, minutes" text, "Speed" text )
What is the ship in the Cunard line from Liverpool 19 29 July?
SELECT "Ship" FROM table_66009 WHERE "Line" = 'cunard' AND "From" = 'liverpool' AND "Dates" = '19 – 29 july'
wikisql
CREATE TABLE table_name_37 ( player VARCHAR, position VARCHAR, afl_team VARCHAR )
Which player is an offensive tackle for the New York Jets?
SELECT player FROM table_name_37 WHERE position = "offensive tackle" AND afl_team = "new york jets"
sql_create_context
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
从12.9.10开始,截止到14.3.20,开出的药品里,652754的药品总共有多少数量及金额
SELECT SUM(QTY), SUM(AMOUNT) FROM t_kc22 WHERE SOC_SRT_DIRE_CD = '652754' AND STA_DATE BETWEEN '2012-09-10' AND '2014-03-20'
css
CREATE TABLE table_6363 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
Which Rank is the lowest one that has a Nation of switzerland, and a Bronze smaller than 0?
SELECT MIN("Rank") FROM table_6363 WHERE "Nation" = 'switzerland' AND "Bronze" < '0'
wikisql
CREATE TABLE table_name_37 ( feathered__fxx_ VARCHAR, duration VARCHAR )
When the duration was 11 min, 34 sec, what was the feathered (Fxx)?
SELECT feathered__fxx_ FROM table_name_37 WHERE duration = "11 min, 34 sec"
sql_create_context
CREATE TABLE table_name_19 ( roll VARCHAR, name VARCHAR, decile VARCHAR )
Name the total number of roll for st joseph's school when decile is less than 5
SELECT COUNT(roll) FROM table_name_19 WHERE name = "st joseph's school" AND decile < 5
sql_create_context
CREATE TABLE table_name_10 ( money_requested__£_ VARCHAR, company_or_product_name VARCHAR )
How much Money is requested by BassToneSlap?
SELECT money_requested__£_ FROM table_name_10 WHERE company_or_product_name = "basstoneslap"
sql_create_context
CREATE TABLE table_name_52 ( college VARCHAR, round VARCHAR, pick__number VARCHAR )
A Pick # larger than 339 and the College that has a Round of 14 is what?
SELECT college FROM table_name_52 WHERE round = 14 AND pick__number > 339
sql_create_context
CREATE TABLE table_36682 ( "Name" text, "Number" text, "Namesake" text, "Albedo feature name" text, "Area" text, "Current map" text )
What is the Albedo name for Neruda?
SELECT "Albedo feature name" FROM table_36682 WHERE "Name" = 'neruda'
wikisql
CREATE TABLE table_name_65 ( religion VARCHAR, para VARCHAR )
What religion has a para of 56.5%?
SELECT religion FROM table_name_65 WHERE para = "56.5%"
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 mzjzjlb ( HXPLC number, HZXM ...
名字叫做王子安的患者在医院6839787期间门诊所诊断出名称不包含肾结石的门诊诊察记录一共是哪几条?
SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjz...
css
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange ...
High scoring non-CW posts per month.
SELECT LAST_DATE_OF_MONTH(CreationDate), COUNT(Id) AS Posts, SUM(CASE WHEN PostTypeId = 1 THEN 1 ELSE 0 END) AS Questions, SUM(CASE WHEN PostTypeId = 2 THEN 1 ELSE 0 END) AS Answers FROM Posts WHERE (Score >= '##min?50##') AND (CommunityOwnedDate IS NULL) GROUP BY LAST_DATE_OF_MONTH(CreationDate) ORDER BY LAST_DATE_OF_...
sede
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, ...
Longest custom edit rejection reasons.
SELECT COUNT(*) AS num, LENGTH(Comment) AS length, Comment FROM ReviewTaskResults GROUP BY Comment ORDER BY LENGTH(Comment) DESC LIMIT 200
sede
CREATE TABLE Fault_Log_Parts ( fault_log_entry_id INTEGER, part_fault_id INTEGER, fault_status VARCHAR(10) ) CREATE TABLE Engineer_Visits ( engineer_visit_id INTEGER, contact_staff_id INTEGER, engineer_id INTEGER, fault_log_entry_id INTEGER, fault_status VARCHAR(10), visit_start_dat...
How many assets can each parts be used in? List the part name and the number with a bar chart, sort from high to low by the Y.
SELECT part_name, COUNT(*) FROM Parts AS T1 JOIN Asset_Parts AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_name_93 ( builder VARCHAR, completed INTEGER )
Which builder completed after 1889?
SELECT builder FROM table_name_93 WHERE completed > 1889
sql_create_context
CREATE TABLE table_name_9 ( team__number1 VARCHAR )
Who played against TSV bayer 04 leverkusen when they were team #1?
SELECT 2 AS nd_leg FROM table_name_9 WHERE team__number1 = "tsv bayer 04 leverkusen"
sql_create_context
CREATE TABLE table_name_69 ( winning_score VARCHAR, margin_of_victory VARCHAR, runner_s__up VARCHAR )
What was the winning score when the margin of victory was 2 strokes and the runner-up was Pat Bradley?
SELECT winning_score FROM table_name_69 WHERE margin_of_victory = "2 strokes" AND runner_s__up = "pat bradley"
sql_create_context
CREATE TABLE table_24037660_2 ( gtc_winning_team VARCHAR, lmp_winning_team VARCHAR )
What was the gtc winning team when lmp winning team was #8 drayson racing?
SELECT gtc_winning_team FROM table_24037660_2 WHERE lmp_winning_team = "#8 Drayson Racing"
sql_create_context
CREATE TABLE table_name_76 ( state VARCHAR, region VARCHAR, city VARCHAR )
What state is Knoxville and the mideast region located in?
SELECT state FROM table_name_76 WHERE region = "mideast" AND city = "knoxville"
sql_create_context
CREATE TABLE table_29621 ( "Game" real, "January" real, "Opponent" text, "Score" text, "Location/Attendance" text, "Record" text, "Points" real )
What are the most points scored in a game where the score was 1-2?
SELECT MAX("Points") FROM table_29621 WHERE "Score" = '1-2'
wikisql
CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE program ( program_id int, name varchar, college varchar...
In regards to SW 556 , how many times has it been offered ?
SELECT COUNT(DISTINCT course_offering.offering_id) FROM course, course_offering WHERE course.course_id = course_offering.course_id AND course.department = 'SW' AND course.number = 556
advising
CREATE TABLE table_name_91 ( republican__democratic VARCHAR, state_ranked_in_partisan_order VARCHAR )
What is the ratio of Republicans to Democrats in South Carolina?
SELECT republican__democratic FROM table_name_91 WHERE state_ranked_in_partisan_order = "south carolina"
sql_create_context
CREATE TABLE table_17288825_5 ( score VARCHAR, team VARCHAR )
What is the San Antonio's team score?
SELECT score FROM table_17288825_5 WHERE team = "San Antonio"
sql_create_context
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
患者22165131在10年10月5日至2014年7月21日之内一共看了多少病?
SELECT COUNT(DISTINCT IN_DIAG_DIS_CD) FROM t_kc21 WHERE PERSON_ID = '22165131' AND IN_HOSP_DATE BETWEEN '2010-10-05' AND '2014-07-21'
css
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetake...
how many patients had received a esophagogastroduodenoscopy - with peg insertion procedure two or more times in a year before?
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, COUNT(*) AS c1 FROM patient WHERE patient.patientunitstayid = (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'esophagogastroduodenoscopy - with peg insertion' AND DATETIME(treatment.treatmenttime, 'start of year') = ...
eicu
CREATE TABLE table_62678 ( "Constituency number" text, "Name" text, "Reserved for ( SC / ST /None)" text, "District" text, "Number of electorates (2009)" real )
What is the reserved for (ST/ST/None) when it was Uklana?
SELECT "Reserved for ( SC / ST /None)" FROM table_62678 WHERE "Name" = 'uklana'
wikisql
CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), DEPT_EXTENSION varchar(4) ) CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ...
How many students taking a course who received an A or C? Group by students' last name with a bar chart.
SELECT STU_LNAME, COUNT(STU_LNAME) FROM STUDENT AS T1 JOIN ENROLL AS T2 ON T1.STU_NUM = T2.STU_NUM WHERE T2.ENROLL_GRADE = 'C' OR T2.ENROLL_GRADE = 'A' GROUP BY STU_LNAME
nvbench
CREATE TABLE table_203_61 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
which african country had more total medal wins then nigeria ?
SELECT "nation" FROM table_203_61 WHERE "total" > (SELECT "total" FROM table_203_61 WHERE "nation" = 'nigeria')
squall
CREATE TABLE table_17972193_1 ( attendance INTEGER, game_site VARCHAR )
How many were in attendance when the game was held in Arrowhead Stadium?
SELECT MIN(attendance) FROM table_17972193_1 WHERE game_site = "Arrowhead Stadium"
sql_create_context
CREATE TABLE table_31239 ( "Programme" text, "Date(s) of original removal" text, "Original channel(s)" text, "Date of return" text, "New channel(s)" text )
What is the date of return for the program for the program 'Big Brother'?
SELECT "Date of return" FROM table_31239 WHERE "Programme" = 'Big Brother'
wikisql
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, ...
参与门诊就诊82258211835的首诊医生以及其他所有接诊医生有哪些?把他们的工号列出来
SELECT mzjzjlb.ZZYSGH, mzjzjlb.QTJZYSGH FROM mzjzjlb WHERE mzjzjlb.JZLSH = '82258211835'
css
CREATE TABLE table_name_51 ( format VARCHAR, catalog VARCHAR, date VARCHAR )
Which Format has a Catalog of 61298, and a Date of september 1984?
SELECT format FROM table_name_51 WHERE catalog = 61298 AND date = "september 1984"
sql_create_context
CREATE TABLE table_16092 ( "School Year" text, "Class A" text, "Class AA" text, "Class AAA" text, "Class AAAA" text, "Class AAAAA" text )
Who was Class AAA during the same year that Class A was (tie) Apple Springs/Texline?
SELECT "Class AAA" FROM table_16092 WHERE "Class A" = '(tie) Apple Springs/Texline'
wikisql
CREATE TABLE people ( People_ID int, District text, Name text, Party text, Age int ) CREATE TABLE debate_people ( Debate_ID int, Affirmative int, Negative int, If_Affirmative_Win bool ) CREATE TABLE debate ( Debate_ID int, Date text, Venue text, Num_of_Audience int ...
A bar chart showing how many debates are held for each venue, and show by the X in desc.
SELECT Venue, COUNT(Venue) FROM debate GROUP BY Venue ORDER BY Venue DESC
nvbench
CREATE TABLE table_9736 ( "Season" text, "Winner" text, "Prize" text, "Runner-Up" text, "3rd place" text )
What is Prize, when Runner-Up is 'Simon Ehne', and when Winner is 'David Tighe'?
SELECT "Prize" FROM table_9736 WHERE "Runner-Up" = 'simon ehne' AND "Winner" = 'david tighe'
wikisql
CREATE TABLE table_20942925_1 ( title VARCHAR, production_code VARCHAR )
How many titles for the production code of NABF07?
SELECT COUNT(title) FROM table_20942925_1 WHERE production_code = "NABF07"
sql_create_context
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
what is the number of patients whose age is less than 77 and diagnoses icd9 code is 5570?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "77" AND diagnoses.icd9_code = "5570"
mimicsql_data
CREATE TABLE table_21721351_18 ( nationality VARCHAR, college_junior_club_team VARCHAR )
Which nationality is kitchener rangers (ohl) college/junior/club team?
SELECT nationality FROM table_21721351_18 WHERE college_junior_club_team = "Kitchener Rangers (OHL)"
sql_create_context
CREATE TABLE table_name_99 ( heat INTEGER, lane VARCHAR, time VARCHAR )
What's the heat in the lane less than 3 with a time of 14:48.39?
SELECT AVG(heat) FROM table_name_99 WHERE lane < 3 AND time = "14:48.39"
sql_create_context
CREATE TABLE table_60744 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" real )
What years did Tom Lehman win?
SELECT "Year(s) won" FROM table_60744 WHERE "Player" = 'tom lehman'
wikisql
CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE...
Downvoted posts belonging to user.
SELECT p.Id AS "post_link", SUM(CASE WHEN v.VoteTypeId = 3 THEN 1 ELSE 0 END) AS Down, p.Score FROM Posts AS p INNER JOIN Votes AS v ON p.Id = v.PostId WHERE p.OwnerUserId = '##UserId##' GROUP BY p.Id, p.Score HAVING SUM(CASE WHEN v.VoteTypeId = 3 THEN 1 ELSE 0 END) > 0
sede
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number,...
when did patient 021-25408 in this year for the last time leave the hospital?
SELECT patient.hospitaldischargetime FROM patient WHERE patient.uniquepid = '021-25408' AND DATETIME(patient.hospitaldischargetime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY patient.hospitaldischargetime DESC LIMIT 1
eicu
CREATE TABLE Addresses ( address_id INTEGER, line_1_number_building VARCHAR(80), city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50) ) CREATE TABLE Customer_Address_History ( customer_id INTEGER, address_id INTEGER, date_from DATETIME, ...
Show the number of customer address history for each city in a bar chart, and could you order from low to high by the Y?
SELECT T3.city, COUNT(T3.city) FROM Customer_Address_History AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id JOIN Addresses AS T3 ON T1.address_id = T3.address_id GROUP BY T3.city ORDER BY COUNT(T3.city)
nvbench
CREATE TABLE table_dev_4 ( "id" int, "hypothyroidism" bool, "serum_bicarbonate" int, "c_peptide_level" float, "autoimmune_disease" bool, "hemoglobin_a1c_hba1c" float, "positive_serum" bool, "inhaled_steroids" bool, "diabetic_ketoacidosis" bool, "creatinine_clearance_cl" float, ...
creatinine clearance should be > 60 ml / min )
SELECT * FROM table_dev_4 WHERE creatinine_clearance_cl > 60
criteria2sql
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) 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...
For all employees who have the letters D or S in their first name, visualize the relationship between salary and department_id .
SELECT SALARY, DEPARTMENT_ID FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
nvbench
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id numb...
indicate the monthly average arterial bp mean of patient 19175 since 1113 days ago.
SELECT AVG(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 = 19175)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arte...
mimic_iii
CREATE TABLE table_22771048_4 ( city_neighborhood VARCHAR, station VARCHAR )
How many neighborhoods have a station proposed at a Hospital?
SELECT COUNT(city_neighborhood) FROM table_22771048_4 WHERE station = "Hospital"
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...
What is the total number of patients who stayed at the hospital for more than 9 days and died?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "1" AND demographic.days_stay > "9"
mimicsql_data
CREATE TABLE table_1357052_6 ( distribution VARCHAR, grsecurity VARCHAR, compile_time_buffer_checks VARCHAR )
what's the dbeingtribution with grsecurity being optional and compile time buffer checks being yes
SELECT distribution FROM table_1357052_6 WHERE grsecurity = "Optional" AND compile_time_buffer_checks = "Yes"
sql_create_context
CREATE TABLE table_name_69 ( height_ft__m_ VARCHAR, name VARCHAR )
What is the height of the Tenth Presbyterian Church?
SELECT height_ft__m_ FROM table_name_69 WHERE name = "tenth presbyterian church"
sql_create_context