context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE races ( raceId INTEGER, year INTEGER, round INTEGER, circuitId INTEGER, name TEXT, date TEXT, time TEXT, url TEXT ) CREATE TABLE driverStandings ( driverStandingsId INTEGER, raceId INTEGER, driverId INTEGER, points REAL, position INTEGER, positionTex...
Show the number of races that had any driver whose forename is Lewis in each year with a line chart.
SELECT year, COUNT(year) FROM results AS T1 JOIN races AS T2 ON T1.raceId = T2.raceId JOIN drivers AS T3 ON T1.driverId = T3.driverId WHERE T3.forename = "Lewis" GROUP BY year
nvbench
CREATE TABLE table_name_7 ( name VARCHAR, date_of_birth VARCHAR )
Who is born on 1982-01-29?
SELECT name FROM table_name_7 WHERE date_of_birth = "1982-01-29"
sql_create_context
CREATE TABLE table_654 ( "Department" text, "Acronym" text, "Office" text, "Incumbent" text, "in Office since" text )
who is the the office with incumbent being ramon r. jimenez, jr.
SELECT "Office" FROM table_654 WHERE "Incumbent" = 'Ramon R. Jimenez, Jr.'
wikisql
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 ...
List all countries of markets in descending order of number of cities.
SELECT country FROM market ORDER BY number_cities DESC
spider
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
specify the type of admission and marital status of patient hector blair
SELECT demographic.marital_status, demographic.admission_type FROM demographic WHERE demographic.name = "Hector Blair"
mimicsql_data
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id n...
how much is patient 11826's chloride difference of last measured on the current hospital visit compared to the first value measured on the current hospital visit?
SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 11826 AND admissions.dischtime IS NULL) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'chloride') ORDER BY labevents.charttime...
mimic_iii
CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTyp...
questions where the OP offered a bounty on an answer they didn't accept. https://meta.stackexchange.com/questions/314515/what-is-the-reason-that-i-can-accept-only-one-answer
SELECT DISTINCT q.Id AS "post_link" FROM Posts AS q INNER JOIN Votes AS v ON v.PostId = q.Id INNER JOIN Posts AS a ON a.ParentId = q.Id AND a.Id != q.AcceptedAnswerId INNER JOIN Votes AS va ON va.PostId = a.Id WHERE NOT q.AcceptedAnswerId IS NULL AND v.VoteTypeId = 8 AND v.UserId = q.OwnerUserId AND va.VoteTypeId = 9 A...
sede
CREATE TABLE table_name_21 ( attendance VARCHAR, game_site VARCHAR )
What was the attendance of the Cup Quarterfinals game?
SELECT attendance FROM table_name_21 WHERE game_site = "cup quarterfinals"
sql_create_context
CREATE TABLE table_name_21 ( constructor VARCHAR, race VARCHAR )
Who was the Constructor at the Argentine Grand Prix?
SELECT constructor FROM table_name_21 WHERE race = "argentine grand prix"
sql_create_context
CREATE TABLE table_32435 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the crowd population for Footscray as an away team?
SELECT MAX("Crowd") FROM table_32435 WHERE "Away team" = 'footscray'
wikisql
CREATE TABLE table_name_63 ( series VARCHAR, wins VARCHAR, season VARCHAR )
Can you tell me the Series that has the Wins of 0, and the Season of a 2002?
SELECT series FROM table_name_63 WHERE wins = 0 AND season = "2002"
sql_create_context
CREATE TABLE table_name_22 ( recipient VARCHAR, award VARCHAR )
Who was the recipient of an award of 4,203?
SELECT recipient FROM table_name_22 WHERE award = "£4,203"
sql_create_context
CREATE TABLE table_50456 ( "Country" text, "2002" real, "2003" real, "2004" real, "2005" real, "2006" real, "2007" real, "2008" real, "2009" real, "2010" real, "2011" real )
What is the least 2009 that has 2005 littler than 640, and 2011 of 425, and 2003 littler than 500?
SELECT MIN("2009") FROM table_50456 WHERE "2005" < '640' AND "2011" = '425' AND "2003" < '500'
wikisql
CREATE TABLE table_name_97 ( place INTEGER, artist VARCHAR, draw VARCHAR )
What was the highest place a song by Jacques Raymond reached, with a draw over 14?
SELECT MAX(place) FROM table_name_97 WHERE artist = "jacques raymond" AND draw > 14
sql_create_context
CREATE TABLE train_station ( train_id number, station_id number ) CREATE TABLE station ( station_id number, name text, annual_entry_exit number, annual_interchanges number, total_passengers number, location text, main_services text, number_of_platforms number ) CREATE TABLE tra...
Show all locations and the total number of platforms and passengers for all train stations in each location.
SELECT location, SUM(number_of_platforms), SUM(total_passengers) FROM station GROUP BY location
spider
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, ...
show me the five most common diagnostics since 2101?
SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE STRFTIME('%y', diagnosis.diagnosistime) >= '2101' GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 5
eicu
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...
provide the number of patients whose gender is m and admission location is emergency room admit?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.admission_location = "EMERGENCY ROOM ADMIT"
mimicsql_data
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, ...
what is the number of times that patient 76327 had had foley today?
SELECT COUNT(*) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 76327)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'foley' AND d_items...
mimic_iii
CREATE TABLE teaches ( ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0) ) CREATE TABLE prereq ( course_id varchar(8), prereq_id varchar(8) ) CREATE TABLE takes ( ID varchar(5), course_id varchar(8), sec_id varchar(8), semester v...
Find the number of courses that have more than one prerequisites for each title with a bar chart, could you display Y-axis in descending order?
SELECT title, COUNT(title) FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY title ORDER BY COUNT(title) DESC
nvbench
CREATE TABLE table_11210576_3 ( duration VARCHAR, actor VARCHAR )
What duration is listed for Christian de la Fuente?
SELECT duration FROM table_11210576_3 WHERE actor = "Christian de la Fuente"
sql_create_context
CREATE TABLE table_1008653_9 ( country___exonym__ VARCHAR, country___endonym__ VARCHAR )
Which country (exonym) is the country (endonym) isle of man ellan vannin?
SELECT country___exonym__ FROM table_1008653_9 WHERE country___endonym__ = "Isle of Man Ellan Vannin"
sql_create_context
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 demographic (...
how many patients have an emergency admission type and a platelet count lab test done?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND lab.label = "Platelet Count"
mimicsql_data
CREATE TABLE procedures ( 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, ...
how many patients have diagnosis icd9 code 60000?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.icd9_code = "60000"
mimicsql_data
CREATE TABLE table_61486 ( "Clubs" text, "Seasons at this level" text, "Settlements" text, "Season joined league" text, "Position in 1959\u20131960" text )
What was the position in 1959-1960 for the club that had 14 seasons at this level?
SELECT "Position in 1959\u20131960" FROM table_61486 WHERE "Seasons at this level" = '14 seasons'
wikisql
CREATE TABLE table_name_62 ( nature_of_incident VARCHAR, location VARCHAR, date VARCHAR )
What is the nature of the incident in Kabul on 2004-01-28?
SELECT nature_of_incident FROM table_name_62 WHERE location = "kabul" AND date = "2004-01-28"
sql_create_context
CREATE TABLE table_36996 ( "Surname" text, "First" text, "D.O.B." text, "Uni#" real, "Bats" text, "Throws" text, "Position" text )
What is the uniform number of the player whose last name is Wiltshire?
SELECT MIN("Uni#") FROM table_36996 WHERE "Surname" = 'wiltshire'
wikisql
CREATE TABLE table_15607589_2 ( first_downs VARCHAR, points_against VARCHAR )
Name the first downs for points against being 0
SELECT first_downs FROM table_15607589_2 WHERE points_against = 0
sql_create_context
CREATE TABLE table_13758945_1 ( lost VARCHAR, points_for VARCHAR )
What are the lost where points lost is 353?
SELECT lost FROM table_13758945_1 WHERE points_for = "353"
sql_create_context
CREATE TABLE table_name_69 ( high_points VARCHAR, record VARCHAR )
For the game that had an end record of 2-4, who was the high points scorer?
SELECT high_points FROM table_name_69 WHERE record = "2-4"
sql_create_context
CREATE TABLE table_203_475 ( id number, "stage" number, "date" text, "route" text, "terrain" text, "length" text, "winner" text )
which country had more stage winners than any other country ?
SELECT "winner" FROM table_203_475 GROUP BY "winner" ORDER BY COUNT(*) DESC LIMIT 1
squall
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...
count the number of patients whose marital status is married and diagnoses long title is mechanical complication due to other implant and internal device, not elsewhere classified?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "MARRIED" AND diagnoses.long_title = "Mechanical complication due to other implant and internal device, not elsewhere classified"
mimicsql_data
CREATE TABLE airport_aircraft ( id number, airport_id number, aircraft_id number ) CREATE TABLE aircraft ( aircraft_id number, aircraft text, description text, max_gross_weight text, total_disk_area text, max_disk_loading text ) CREATE TABLE airport ( airport_id number, air...
List the names of aircrafts and that did not win any match.
SELECT aircraft FROM aircraft WHERE NOT aircraft_id IN (SELECT winning_aircraft FROM match)
spider
CREATE TABLE table_name_9 ( package_version VARCHAR, carrier VARCHAR, device VARCHAR, applications VARCHAR )
WHAT IS THE PACKAGE VERSION FOR blackberry storm 9530, APPLICATION 5.0.0.419, AND MTS MOBILITY?
SELECT package_version FROM table_name_9 WHERE device = "blackberry storm 9530" AND applications = "5.0.0.419" AND carrier = "mts mobility"
sql_create_context
CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int ) CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text )
Show different types of ships and the number of ships of each type in a bar chart, and show Type in desc order.
SELECT Type, COUNT(*) FROM ship GROUP BY Type ORDER BY Type DESC
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
provide the number of patients whose gender is f and diagnoses long title is personal history, urinary (tract) infection?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.long_title = "Personal history, urinary (tract) infection"
mimicsql_data
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsysto...
what was the first height of patient 006-153198 in 10/last year.
SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-153198') AND NOT patient.admissionheight IS NULL AND DATETIME(patient.unitadmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '...
eicu
CREATE TABLE table_77044 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Replaced by" text, "Date of appointment" text, "Position in table" text )
What is Position in Table, when Team is 'Morelia'?
SELECT "Position in table" FROM table_77044 WHERE "Team" = 'morelia'
wikisql
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
what is the number of patients who were hospitalized for more than 23 days and were discharged to snf?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "SNF" AND demographic.days_stay > "23"
mimicsql_data
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC...
患者华明煦被门诊诊断为矽肺壹期,查查胃泌素释放肽前体的结果定量及其单位
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW 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 ...
css
CREATE TABLE table_58146 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the total size of the crowd when an away team had a score of 9.9 (63)?
SELECT SUM("Crowd") FROM table_58146 WHERE "Away team score" = '9.9 (63)'
wikisql
CREATE TABLE management ( department_ID int, head_ID int, temporary_acting text ) CREATE TABLE department ( Department_ID int, Name text, Creation text, Ranking int, Budget_in_Billions real, Num_Employees real ) CREATE TABLE head ( head_ID int, name text, born_state tex...
I want to see trend of the average of budget in billions by creation, list from high to low by the X-axis.
SELECT Creation, AVG(Budget_in_Billions) FROM department ORDER BY Creation DESC
nvbench
CREATE TABLE table_203_60 ( id number, "outcome" text, "no." number, "date" text, "championship" text, "surface" text, "opponent in the final" text, "score in the final" text )
how many atp tour titles did thierry tulasne win ?
SELECT COUNT(*) FROM table_203_60 WHERE "outcome" = 'winner'
squall
CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
Average number of votes on all sites. For each site, show the average number of votes per post (questions and answers alike)
SELECT COUNT(*) * 1.0 / (SELECT COUNT(*) FROM Posts WHERE PostTypeId = 1 OR PostTypeId = 2) AS "votes", COUNT(CASE VoteTypeId WHEN 2 THEN 1 END) * 1.0 / (SELECT COUNT(*) FROM Posts WHERE PostTypeId = 1 OR PostTypeId = 2) AS "upvotes", COUNT(CASE VoteTypeId WHEN 3 THEN 1 END) * 1.0 / (SELECT COUNT(*) FROM Posts WHERE Po...
sede
CREATE TABLE bdmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZ...
以往,患者71329181的门诊诊断结果怎么样?
SELECT wdmzjzjlb.JZZDBM, wdmzjzjlb.JZZDSM FROM hz_info JOIN wdmzjzjlb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE hz_info.RYBH = '71329181' UNION SELECT bdmzjzjlb.JZZDBM, bdmzjzjlb.JZZDSM FROM hz_info JOIN bdmzjzjlb ON hz_info.YLJGDM = bdmzjzjlb.YLJGDM AND hz...
css
CREATE TABLE table_name_99 ( team_1 VARCHAR, team_2 VARCHAR )
What team 1 has sloga jugomagnat as team 2?
SELECT team_1 FROM table_name_99 WHERE team_2 = "sloga jugomagnat"
sql_create_context
CREATE TABLE table_name_32 ( result VARCHAR, competition VARCHAR, venue VARCHAR )
What is the result when the competition was the 2006 fifa world cup qualifier, and a Venue of warner park sporting complex, bassaterre?
SELECT result FROM table_name_32 WHERE competition = "2006 fifa world cup qualifier" AND venue = "warner park sporting complex, bassaterre"
sql_create_context
CREATE TABLE table_203_527 ( id number, "tournament" text, "games played" number, "points per game" number, "rebounds per game" number, "assists per game" number )
in which tournament did the team score the most points per game ?
SELECT "tournament" FROM table_203_527 ORDER BY "points per game" DESC LIMIT 1
squall
CREATE TABLE table_13642023_2 ( gto_winning_team VARCHAR, rnd VARCHAR, gtu_winning_team VARCHAR )
Who was the GTO winning team in round 5 when the GTU winning team was #59 Brumos Porsche - Audi?
SELECT gto_winning_team FROM table_13642023_2 WHERE rnd = 5 AND gtu_winning_team = "#59 Brumos Porsche - Audi"
sql_create_context
CREATE TABLE table_50544 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text )
What is the Score when the Away Team is Torquay United?
SELECT "Score" FROM table_50544 WHERE "Away team" = 'torquay united'
wikisql
CREATE TABLE table_12441518_1 ( main_cast_seasons VARCHAR, character VARCHAR )
What seasons does Nick lucas appear?
SELECT main_cast_seasons FROM table_12441518_1 WHERE character = "Nick Lucas"
sql_create_context
CREATE TABLE table_40409 ( "Volume:Issue" text, "Issue Date(s)" text, "Weeks on Top" text, "Song" text, "Artist" text )
How many weeks on top was the song with a volume:issue of 28:26?
SELECT "Weeks on Top" FROM table_40409 WHERE "Volume:Issue" = '28:26'
wikisql
CREATE TABLE journalist ( Id VARCHAR )
How many journalists are there?
SELECT COUNT(*) FROM journalist
sql_create_context
CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE ...
What is the easiest class which fulfill the PreMajor requirement ?
SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%PreMajor%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM progra...
advising
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE cost ( costid number, uniquepid text,...
what was the daily maximum amount of total out given to patient 006-172277 since 09/01/2105?
SELECT MAX(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-172277')) AND intakeoutput.celllabel = 'tota...
eicu
CREATE TABLE news_report ( journalist_id number, event_id number, work_type text ) CREATE TABLE event ( event_id number, date text, venue text, name text, event_attendance number ) CREATE TABLE journalist ( journalist_id number, name text, nationality text, age text, ...
Show the names of journalists and the dates of the events they reported.
SELECT T3.name, T2.date FROM news_report AS T1 JOIN event AS T2 ON T1.event_id = T2.event_id JOIN journalist AS T3 ON T1.journalist_id = T3.journalist_id
spider
CREATE TABLE classroom ( building varchar(15), room_number varchar(7), capacity numeric(4,0) ) CREATE TABLE prereq ( course_id varchar(8), prereq_id varchar(8) ) CREATE TABLE student ( ID varchar(5), name varchar(20), dept_name varchar(20), tot_cred numeric(3,0) ) CREATE TABLE adv...
Show me a bar chart for how many total credits are offered by each department?, sort by the bar in desc.
SELECT dept_name, SUM(credits) FROM course GROUP BY dept_name ORDER BY dept_name DESC
nvbench
CREATE TABLE table_203_836 ( id number, "title" text, "year" number, "platforms" text, "developer" text, "publisher" text, "notes" text )
which title is for ipad but not for iphone or ipod ?
SELECT "title" FROM table_203_836 WHERE "platforms" = 'ipad'
squall
CREATE TABLE table_36926 ( "Name" text, "GP-GS" text, "Effic" real, "Cmp-Att-Int" text, "Avg/G" real )
Which Avg/G has an Effic larger than 129.73, and a Cmp-Att-Int of 333-500-13?
SELECT SUM("Avg/G") FROM table_36926 WHERE "Effic" > '129.73' AND "Cmp-Att-Int" = '333-500-13'
wikisql
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
what is the total quantity of urine out foley that patient 65759 had on last month/13?
SELECT SUM(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 65759)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'uri...
mimic_iii
CREATE TABLE table_name_86 ( name VARCHAR, opened VARCHAR, park VARCHAR )
What is the name of the rollercoaster that opened in 2004 in bobbejaanland?
SELECT name FROM table_name_86 WHERE opened = "2004" AND park = "bobbejaanland"
sql_create_context
CREATE TABLE table_name_67 ( d_45_o VARCHAR, d_44_o VARCHAR )
What is the value of D 45 O when the value of D 44 O is majority?
SELECT d_45_o FROM table_name_67 WHERE d_44_o = "← majority"
sql_create_context
CREATE TABLE ftxmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZD...
病患何嘉悦在02年4月18日到2020年5月25日内所有的检验结果指标记录中检测人是冯婉娜时检验指标流水号是多少?
SELECT jyjgzbb.JYZBLSH 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 jyb...
css
CREATE TABLE table_name_32 ( state VARCHAR, representative VARCHAR )
Which state does Jimmy Quillen represent?
SELECT state FROM table_name_32 WHERE representative = "jimmy quillen"
sql_create_context
CREATE TABLE table_name_7 ( winning_score VARCHAR, runner_s__up VARCHAR )
What is the winning score for the runner-up Ernie Els?
SELECT winning_score FROM table_name_7 WHERE runner_s__up = "ernie els"
sql_create_context
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, ...
Date difference between the question and the accept vote.
WITH Raw AS (SELECT DATEDIFF(day, Posts.CreationDate, CreationDate) AS days FROM Posts, Votes WHERE Votes.PostId = Posts.Id AND Votes.VoteTypeId = 1), Raw2 AS (SELECT days, COUNT(*) AS N FROM Raw GROUP BY days) SELECT days, N, SUM(N) OVER (ORDER BY days ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS RunningTotal ...
sede
CREATE TABLE table_test_12 ( "id" int, "serum_potassium" float, "left_ventricular_ejection_fraction_lvef" int, "systolic_blood_pressure_sbp" int, "haemoglobin" float, "consent" bool, "hemoglobin_a1c_hba1c" float, "heart_disease" bool, "renal_disease" bool, "anaemia" bool, "cr...
anaemia ( haemoglobin < 12 g / dl ) .
SELECT * FROM table_test_12 WHERE anaemia = 1 OR haemoglobin < 12
criteria2sql
CREATE TABLE table_47067 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
Can you tell me the average Total that had the Silver of 0, and the Rank of 6, and the Gold smaller than 0?
SELECT AVG("Total") FROM table_47067 WHERE "Silver" = '0' AND "Rank" = '6' AND "Gold" < '0'
wikisql
CREATE TABLE table_60546 ( "Track" real, "Song Title" text, "Artist" text, "Album" text, "Legends Track?" text )
What is the track that from lcd soundsystem?
SELECT "Track" FROM table_60546 WHERE "Artist" = 'lcd soundsystem'
wikisql
CREATE TABLE table_name_61 ( pick INTEGER, round VARCHAR, player VARCHAR )
What is the pick with Dean Sears and round larger than 6?
SELECT MIN(pick) FROM table_name_61 WHERE round > 6 AND player = "dean sears"
sql_create_context
CREATE TABLE table_204_862 ( id number, "rank" number, "bib" number, "athlete" text, "country" text, "run 1" text, "run 2" text, "total" text, "behind" number )
which is before david moller
SELECT "athlete" FROM table_204_862 WHERE id = (SELECT id FROM table_204_862 WHERE "athlete" = 'david moller') - 1
squall
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
For those records from the products and each product's manufacturer, show me about the distribution of name and price , and group by attribute headquarter in a bar chart, and could you sort in desc by the Y?
SELECT T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name ORDER BY T1.Price DESC
nvbench
CREATE TABLE table_name_57 ( notes VARCHAR, distance VARCHAR )
What were the notes during the distance of Men's Speed Skating?
SELECT notes FROM table_name_57 WHERE distance = "men's speed skating"
sql_create_context
CREATE TABLE table_name_27 ( opponent VARCHAR, loss VARCHAR )
Who was the opponent at the game that had a loss of Harden (9-6)?
SELECT opponent FROM table_name_27 WHERE loss = "harden (9-6)"
sql_create_context
CREATE TABLE Ref_Detention_Type ( detention_type_code VARCHAR(10), detention_type_description VARCHAR(80) ) CREATE TABLE Assessment_Notes ( notes_id INTEGER, student_id INTEGER, teacher_id INTEGER, date_of_notes DATETIME, text_of_notes VARCHAR(255), other_details VARCHAR(255) ) CREATE ...
Return a bar chart about the distribution of date_address_to and the sum of monthly_rental , and group by attribute other_details and bin date_address_to by time.
SELECT date_address_to, SUM(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
nvbench
CREATE TABLE table_name_33 ( pos VARCHAR, player VARCHAR )
What is Pos., when Player is 'Nigel De Jong'?
SELECT pos FROM table_name_33 WHERE player = "nigel de jong"
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...
provide the number of patients whose diagnoses long title is benign neoplasm of skin of other and unspecified parts of face and lab test category is chemistry?
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.long_title = "Benign neoplasm of skin of other and unspecified parts of face" AND lab."CATEGORY" = "Chemistry"
mimicsql_data
CREATE TABLE table_77718 ( "Constituency" text, "Conservative" text, "Labour" text, "Liberal Democrats" text, "Plaid Cymru" text, "Result" text )
In what constituency was the result labour hold and Liberal democrat Elizabeth Newton won?
SELECT "Constituency" FROM table_77718 WHERE "Result" = 'labour hold' AND "Liberal Democrats" = 'elizabeth newton'
wikisql
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...
编码为8130525的医院的平均医疗住院时长超过9天的有几个科室?
SELECT COUNT(*) FROM (SELECT MED_ORG_DEPT_CD FROM t_kc21 WHERE MED_SER_ORG_NO = '8130525' GROUP BY MED_ORG_DEPT_CD HAVING AVG(IN_HOSP_DAYS) > 9) AS T
css
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 ...
In Spring or Summer 2003 what hardware courses will be available ?
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE area.area LIKE '%hardw...
advising
CREATE TABLE table_49649 ( "Rider" text, "Bike" text, "Laps" real, "Time" text, "Grid" real )
What is the total number of laps done by Massimo Roccoli when his grid was smaller than 4?
SELECT COUNT("Laps") FROM table_49649 WHERE "Rider" = 'massimo roccoli' AND "Grid" < '4'
wikisql
CREATE TABLE table_20704243_3 ( season__number VARCHAR, series__number VARCHAR )
What is the season number for Series #23, the Runway Job?
SELECT season__number FROM table_20704243_3 WHERE series__number = 23
sql_create_context
CREATE TABLE table_name_75 ( team VARCHAR, driver VARCHAR, car__number VARCHAR, pos VARCHAR, make VARCHAR )
Which Team has a Pos larger than 3, and a Make of toyota, and a Car # smaller than 59, and a Driver of mike skinner?
SELECT team FROM table_name_75 WHERE pos > 3 AND make = "toyota" AND car__number < 59 AND driver = "mike skinner"
sql_create_context
CREATE TABLE table_name_15 ( status VARCHAR, eliminated VARCHAR )
Tell me the status of eliminated of anton dela paz
SELECT status FROM table_name_15 WHERE eliminated = "anton dela paz"
sql_create_context
CREATE TABLE table_4623 ( "Year" real, "Competition" text, "Venue" text, "Position" text, "Notes" text )
Prior to 2004, what was the name of the competition that took place in Johannesburg, South Africa and had the 400 m hurdles event?
SELECT "Competition" FROM table_4623 WHERE "Notes" = '400 m hurdles' AND "Year" < '2004' AND "Venue" = 'johannesburg, south africa'
wikisql
CREATE TABLE table_27114 ( "Afghan" text, "Albanian" text, "Arabic" text, "Bangladeshi" text, "Bosnian" text, "Chinese" text, "Colombian" text, "Cook Islands" text )
how many arabic in colobians is finnish
SELECT "Arabic" FROM table_27114 WHERE "Colombian" = 'Finnish'
wikisql
CREATE TABLE train ( Railway_ID VARCHAR ) CREATE TABLE railway ( Builder VARCHAR, Railway_ID VARCHAR )
Show the id and builder of the railway that are associated with the most trains.
SELECT T2.Railway_ID, T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID GROUP BY T2.Railway_ID ORDER BY COUNT(*) DESC LIMIT 1
sql_create_context
CREATE TABLE table_204_650 ( id number, "season" number, "level" number, "name" text, "position" text, "nationality" text, "international\ncaps" number )
what was the total number of times that terry butcher was the player of the year ?
SELECT COUNT(*) FROM table_204_650 WHERE "name" = 'terry butcher'
squall
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_DIRE_CD text, MED_DIRE_NM text,...
在医院4694071所有的就诊记载里,依科室不同的编号和入院诊断的疾病编号不同查查民政补助的开销与全部医疗费之比的最大值,然后把结果从大到小排一下
SELECT t_kc21.MED_ORG_DEPT_CD, t_kc21.IN_DIAG_DIS_NM, MAX(t_kc24.CIVIL_SUBSIDY) FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.MED_SER_ORG_NO = '4694071' GROUP BY t_kc21.MED_ORG_DEPT_CD, t_kc21.IN_DIAG_DIS_NM ORDER BY MAX(t_kc24.CIVIL_SUBSIDY / t_kc24.MED_AMOUT) DESC
css
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...
how many patients on dwell route of drug administration have unspecified anxiety state diagnoses?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Anxiety state NOS" AND prescriptions.route = "DWELL"
mimicsql_data
CREATE TABLE table_203_591 ( id number, "high school" text, "join\nyear" text, "from" text, "left" text, "league left to" text )
which school left before bendle ?
SELECT "high school" FROM table_203_591 WHERE id = (SELECT id FROM table_203_591 WHERE "high school" = 'bendle') - 1
squall
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, H...
和我讲讲医疗就诊53117897919中药品402418932-k所属的三大目录类别各是什么?
SELECT t_kc22.DIRE_TYPE FROM t_kc22 JOIN t_kc21_t_kc22 JOIN t_kc21 ON t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID AND t_kc21_t_kc22.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '53117897919' AND t_kc22.SOC_SRT_DIRE_CD = '402418932-k'
css
CREATE TABLE table_204_496 ( id number, "pos" number, "no" number, "driver" text, "team" text, "laps" number, "time/retired" text, "grid" number, "points" number )
which driver has the same number as his/her position ?
SELECT "driver" FROM table_204_496 WHERE "no" = "pos"
squall
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
count the number of patients whose diagnoses short title is iron defic anemia nos and drug type is additive?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Iron defic anemia NOS" AND prescriptions.drug_type = "ADDITIVE"
mimicsql_data
CREATE TABLE table_171236_2 ( area_km_2 VARCHAR, census_ranking VARCHAR )
What is the Area KM 2 of the place that has a Census ranking of 1,016 of 5,008?
SELECT area_km_2 FROM table_171236_2 WHERE census_ranking = "1,016 of 5,008"
sql_create_context
CREATE TABLE table_44033 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text )
Who was the away team when the home team was Ramsgate?
SELECT "Away team" FROM table_44033 WHERE "Home team" = 'ramsgate'
wikisql
CREATE TABLE table_73852 ( "Season" real, "Series" text, "Team" text, "Car No." real, "Races" real, "Poles" real, "Wins" real, "FLaps" real, "Points" text, "Position" text )
Name the most poles for 64 points
SELECT MAX("Poles") FROM table_73852 WHERE "Points" = '64'
wikisql
CREATE TABLE table_name_69 ( rank VARCHAR, player VARCHAR )
What ranking is james franklin?
SELECT rank FROM table_name_69 WHERE player = "james franklin"
sql_create_context
CREATE TABLE table_1341640_39 ( party VARCHAR, incumbent VARCHAR )
How many parties does the incumbent Donald A. Bailey a member of?
SELECT COUNT(party) FROM table_1341640_39 WHERE incumbent = "Donald A. Bailey"
sql_create_context
CREATE TABLE table_name_35 ( independent INTEGER, green VARCHAR, conservative VARCHAR )
Name the average Independent with a Green larger than 7, and a Conservative smaller than 0?
SELECT AVG(independent) FROM table_name_35 WHERE green > 7 AND conservative < 0
sql_create_context
CREATE TABLE table_name_60 ( airport VARCHAR, city VARCHAR )
What airport is in Muscat?
SELECT airport FROM table_name_60 WHERE city = "muscat"
sql_create_context