context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_name_20 ( current_code VARCHAR, type VARCHAR, years VARCHAR )
What is the current code for the club trophy, in 1867 only?
SELECT current_code FROM table_name_20 WHERE type = "club trophy" AND years = "1867 only"
sql_create_context
CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) CREATE TABLE View_Unit_Status ( apt_id INTEG...
What are the number of dates of birth of all the guests whose gender is 'Male'?, I want to show x axis in ascending order.
SELECT date_of_birth, COUNT(date_of_birth) FROM Guests WHERE gender_code = "Male" ORDER BY date_of_birth
nvbench
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, ...
count the number of patients whose primary disease is s/p hanging and drug type is main?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "S/P HANGING" AND prescriptions.drug_type = "MAIN"
mimicsql_data
CREATE TABLE table_204_750 ( id number, "team" text, "stadium" text, "capacity" number, "seated" number )
what is the difference in the capacity between penydarren park and hand stadium ?
SELECT ABS((SELECT "capacity" FROM table_204_750 WHERE "stadium" = 'penydarren park') - (SELECT "capacity" FROM table_204_750 WHERE "stadium" = 'hand stadium'))
squall
CREATE TABLE table_71258 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real )
Who is entered earlier than 1975 and has a Lotus 20 chassis?
SELECT "Entrant" FROM table_71258 WHERE "Year" < '1975' AND "Chassis" = 'lotus 20'
wikisql
CREATE TABLE table_22439 ( "Round" text, "Clubs remaining" real, "Clubs involved" real, "Winners from previous round" text, "New entries this round" text, "Leagues entering at this round" text )
If new entries this round is 65, what is the round?
SELECT COUNT("Round") FROM table_22439 WHERE "New entries this round" = '65'
wikisql
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, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
在01年11月10日到04年6月15日的这段时间里,病人31779372住了几次医院
SELECT COUNT(*) FROM zyb WHERE zyb.PERSON_NM = '31779372' AND zyb.IN_HOSP_DAYS BETWEEN '2001-11-10' AND '2004-06-15'
css
CREATE TABLE table_name_83 ( arizona VARCHAR, texas VARCHAR, colorado VARCHAR, nevada VARCHAR )
What's the value for arizona when colorado and nevada are nixon, and texas is humphrey?
SELECT arizona FROM table_name_83 WHERE colorado = "nixon" AND nevada = "nixon" AND texas = "humphrey"
sql_create_context
CREATE TABLE table_74361 ( "Outcome" text, "Date" text, "Tournament" text, "Location" text, "Surface" text, "Opponent in the final" text, "Score in the final" text )
what is the material of the surface in the dehradun , uttarakhand, india location
SELECT "Surface" FROM table_74361 WHERE "Location" = 'Dehradun , Uttarakhand, India'
wikisql
CREATE TABLE table_23529 ( "Pos" real, "Driver" text, "Vehicle" text, "Top 13 Time" text, "Shoot-Out Time" text, "Best Time of Day" text )
what is the lowest position of brendan sole
SELECT MAX("Pos") FROM table_23529 WHERE "Driver" = 'Brendan Sole'
wikisql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, ...
provide the number of patients whose diagnoses short title is b12 defic anemia nec and drug type is main?
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 = "B12 defic anemia NEC" AND prescriptions.drug_type = "MAIN"
mimicsql_data
CREATE TABLE table_35236 ( "Game" real, "January" real, "Opponent" text, "Score" text, "Record" text, "Points" real )
What's the highest game against the New York Rangers with more than 55 points?
SELECT MAX("Game") FROM table_35236 WHERE "Opponent" = 'new york rangers' AND "Points" > '55'
wikisql
CREATE TABLE table_name_46 ( last_performance VARCHAR, status VARCHAR )
What is the date of the Last Performance of Billy Elliot with a Cast Status of past replacement?
SELECT last_performance FROM table_name_46 WHERE status = "past replacement"
sql_create_context
CREATE TABLE Department ( DNO INTEGER, Division VARCHAR(2), DName VARCHAR(25), Room VARCHAR(5), Building VARCHAR(13), DPhone INTEGER ) CREATE TABLE Enrolled_in ( StuID INTEGER, CID VARCHAR(7), Grade VARCHAR(2) ) CREATE TABLE Course ( CID VARCHAR(7), CName VARCHAR(40), C...
A bar chart for what are the number of the last names of female students, ordered by age descending?
SELECT LName, COUNT(LName) FROM Student WHERE Sex = "F" GROUP BY LName ORDER BY Age DESC
nvbench
CREATE TABLE table_1805191_34 ( results VARCHAR, incumbent VARCHAR )
How many times was Mike McIntyre elected?
SELECT COUNT(results) FROM table_1805191_34 WHERE incumbent = "Mike McIntyre"
sql_create_context
CREATE TABLE table_41300 ( "Date" text, "Tournament" text, "Surface" text, "Partnering" text, "Opponent in the final" text, "Score" text )
What is the name of the tournament played 13 November 2000?
SELECT "Tournament" FROM table_41300 WHERE "Date" = '13 november 2000'
wikisql
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE T...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, visualize a bar chart about the distribution of hire_date and the average of salary bin hire_date by weekday, display by the total number from low to high.
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(SALARY)
nvbench
CREATE TABLE table_52169 ( "Region" text, "Year" real, "Name" text, "Format(s)" text, "Label" text )
Name the region before 2008 when name of best 1200
SELECT "Region" FROM table_52169 WHERE "Year" < '2008' AND "Name" = 'best 1200'
wikisql
CREATE TABLE table_203_589 ( id number, "protein" text, "natural host" text, "normal function" text, "prion state" text, "prion phenotype" text, "year identified" number )
how long after the third prion characterization would it take for another to be characterized ?
SELECT (SELECT "year identified" FROM table_203_589 WHERE id = 3 + 1) - (SELECT "year identified" FROM table_203_589 WHERE id = 3)
squall
CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) 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, ...
find flight from MEMPHIS to CINCINNATI on sunday
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'CINCINNATI' AND date_day.day_number = 27 AND date_day.month_number = 8 AN...
atis
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
how many patients whose ethnicity is american indian/alaska native and procedure short title is aortocor bypas-3 cor art?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND procedures.short_title = "Aortocor bypas-3 cor art"
mimicsql_data
CREATE TABLE table_name_3 ( country VARCHAR, rank VARCHAR )
what is the country for rank 6?
SELECT country FROM table_name_3 WHERE rank = 6
sql_create_context
CREATE TABLE table_name_13 ( goals_conceded VARCHAR, played INTEGER )
What are the number of goals conceded that has a played greater than 18?
SELECT COUNT(goals_conceded) FROM table_name_13 WHERE played > 18
sql_create_context
CREATE TABLE table_204_416 ( id number, "chip" text, "flash size" text, "eeprom" number, "sram" number, "frequency\n[mhz]" number, "package" text )
which two chips have the most flash size ?
SELECT "chip" FROM table_204_416 WHERE "flash size" = (SELECT MAX("flash size") FROM table_204_416)
squall
CREATE TABLE table_71847 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" text )
What is the Point of Chassis of Lancia d50 in 1954
SELECT "Points" FROM table_71847 WHERE "Chassis" = 'lancia d50' AND "Year" = '1954'
wikisql
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE outputevents ( row_id number, subject_id number, ...
what was the first medication that patient 28343 was prescribed via po route?
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28343) AND prescriptions.route = 'po' ORDER BY prescriptions.startdate LIMIT 1
mimic_iii
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, ...
provide the number of patients whose gender is m and procedure short title is sm-to-sm bowel anastom?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.gender = "M" AND procedures.short_title = "Sm-to-sm bowel anastom"
mimicsql_data
CREATE TABLE VOTING_RECORD ( Election_Cycle VARCHAR ) CREATE TABLE STUDENT ( Age INTEGER, StuID VARCHAR, city_code VARCHAR )
Find the average age of students who live in the city with code 'NYC' and have secretary votes in the spring election cycle.
SELECT AVG(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.city_code = "NYC" AND T2.Election_Cycle = "Spring"
sql_create_context
CREATE TABLE table_79778 ( "Place" text, "Player" text, "Country" text, "Score" real, "To par" text )
What is the lowest score that Bob Tway get when he placed t5?
SELECT MIN("Score") FROM table_79778 WHERE "Place" = 't5' AND "Player" = 'bob tway'
wikisql
CREATE TABLE teachers ( LastName TEXT, FirstName TEXT, Classroom INTEGER ) CREATE TABLE list ( LastName TEXT, FirstName TEXT, Grade INTEGER, Classroom INTEGER )
Return a scatter on how many students does one classroom have?
SELECT COUNT(*), Classroom FROM list GROUP BY Classroom
nvbench
CREATE TABLE table_name_45 ( time VARCHAR, lane VARCHAR, heat VARCHAR, nationality VARCHAR )
What is Hungary's time with a heat higher than 2 and two lanes?
SELECT time FROM table_name_45 WHERE heat > 2 AND nationality = "hungary" AND lane = 2
sql_create_context
CREATE TABLE document_locations ( document_id number, location_code text, date_in_location_from time, date_in_locaton_to time ) CREATE TABLE roles ( role_code text, role_name text, role_description text ) CREATE TABLE all_documents ( document_id number, date_stored time, docume...
What are the name and description for role code 'MG'?
SELECT role_name, role_description FROM roles WHERE role_code = "MG"
spider
CREATE TABLE head ( head_ID int, name text, born_state text, age real ) 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...
Show the average age of heads of departments born in each state with a bar chart, and could you display y-axis in descending order?
SELECT born_state, AVG(age) FROM head GROUP BY born_state ORDER BY AVG(age) DESC
nvbench
CREATE TABLE table_45396 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" text, "Finish" text )
Total for 1994, 1997 years won?
SELECT SUM("Total") FROM table_45396 WHERE "Year(s) won" = '1994, 1997'
wikisql
CREATE TABLE table_8288 ( "Player" text, "PL Apps" real, "PL G" real, "CL Apps" real, "CL G" real, "FAC / LC Apps" real, "FAC / LC G" real, "Total Apps" real, "Total G" real, "FA YC" real, "UEFA YC" real )
What is the total PL G of player pennant, who has less than 7 CL G, less than 7 CL apps, and a FA YC of 0?
SELECT COUNT("PL G") FROM table_8288 WHERE "CL G" < '7' AND "CL Apps" < '7' AND "FA YC" = '0' AND "Player" = 'pennant'
wikisql
CREATE TABLE table_56183 ( "Player" text, "Car." real, "Yards" real, "Avg." real, "TD's" real, "Long" real )
What is the highest Car with more than 155 yards?
SELECT MAX("Car.") FROM table_56183 WHERE "Yards" > '155'
wikisql
CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), E...
Draw a bar chart for how many sections does each course have?, display in descending by the y-axis.
SELECT CRS_CODE, COUNT(*) FROM CLASS GROUP BY CRS_CODE ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_name_14 ( iata VARCHAR, icao VARCHAR )
Which IATA has a ICAO of slk?
SELECT iata FROM table_name_14 WHERE icao = "slk"
sql_create_context
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...
从2001年6月3日开始2019年7月2日之内新生儿的门诊就诊记录数量在医疗机构2084494中一共有多少?
SELECT COUNT(*) FROM wdmzjzjlb WHERE wdmzjzjlb.YLJGDM = '2084494' AND wdmzjzjlb.JZKSRQ BETWEEN '2001-06-03' AND '2019-07-02' AND wdmzjzjlb.ZSEBZ > 0 UNION SELECT COUNT(*) FROM bdmzjzjlb WHERE bdmzjzjlb.YLJGDM = '2084494' AND bdmzjzjlb.JZKSRQ BETWEEN '2001-06-03' AND '2019-07-02' AND bdmzjzjlb.ZSEBZ > 0
css
CREATE TABLE table_42138 ( "Office" text, "Republican ticket" text, "Democratic ticket" text, "Conservative ticket" text, "Liberal ticket" text, "Socialist Labor ticket" text, "Socialist Workers ticket" text )
What is the liberal ticket that has judith white as the socialist workers?
SELECT "Liberal ticket" FROM table_42138 WHERE "Socialist Workers ticket" = 'judith white'
wikisql
CREATE TABLE table_name_57 ( works_number INTEGER, builder VARCHAR, name VARCHAR )
What is the average work number of Snowdon Ranger with the builder Vulcan Foundry?
SELECT AVG(works_number) FROM table_name_57 WHERE builder = "vulcan foundry" AND name = "snowdon ranger"
sql_create_context
CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) CREATE TABLE View_Unit_Status ( apt_id INTEG...
How many apartment bookings in each day? Show me a line chart grouping by booking end date, and I want to sort by the x axis in asc.
SELECT booking_end_date, COUNT(booking_end_date) FROM Apartment_Bookings GROUP BY booking_end_date ORDER BY booking_end_date
nvbench
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
what is minimum age of patients whose admission type is urgent and year of birth is greater than 2175?
SELECT MIN(demographic.age) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.dob_year > "2175"
mimicsql_data
CREATE TABLE table_name_62 ( loss VARCHAR, date VARCHAR )
What's the loss for September 16?
SELECT loss FROM table_name_62 WHERE date = "september 16"
sql_create_context
CREATE TABLE table_11753080_2 ( weekly_rank VARCHAR, _number VARCHAR )
What is the weekly rank where the number is 4?
SELECT weekly_rank FROM table_11753080_2 WHERE _number = 4
sql_create_context
CREATE TABLE table_72617 ( "Age band" text, "Median income" text, "Mean income" text, "Median income (men)" text, "Mean income (men)" text, "Median income (women)" text, "Mean income (women)" text )
Name the median income for age band being under 20
SELECT "Median income" FROM table_72617 WHERE "Age band" = 'Under 20'
wikisql
CREATE TABLE written_by ( id int, msid int, wid int ) CREATE TABLE keyword ( id int, keyword text ) CREATE TABLE cast ( id int, msid int, aid int, role text ) CREATE TABLE actor ( aid int, gender text, name text, nationality text, birth_city text, birth_yea...
Find all movies featuring ' Benedict Cumberbatch ' and ' Keira Knightley
SELECT movie.title FROM actor AS ACTOR_0, actor AS ACTOR_1, cast AS CAST_0, cast AS CAST_1, movie WHERE ACTOR_0.name = 'Benedict Cumberbatch' AND ACTOR_1.name = 'Keira Knightley' AND CAST_0.aid = ACTOR_0.aid AND CAST_1.aid = ACTOR_1.aid AND movie.mid = CAST_0.msid AND movie.mid = CAST_1.msid
imdb
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
how many patients whose marital status is married and ethnicity is american indian/alaska native?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE"
mimicsql_data
CREATE TABLE table_name_44 ( part_2 VARCHAR, part_4 VARCHAR )
When is Part 2, when Part 4 is on December 9, 2007?
SELECT part_2 FROM table_name_44 WHERE part_4 = "december 9, 2007"
sql_create_context
CREATE TABLE table_name_23 ( partner VARCHAR, year VARCHAR )
What is the Partner during the Asian Games Year?
SELECT partner FROM table_name_23 WHERE year = "asian games"
sql_create_context
CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TE...
List the number of counties of all appellations in a bar chart, and list by the Y-axis in descending.
SELECT County, COUNT(County) FROM appellations GROUP BY County ORDER BY COUNT(County) DESC
nvbench
CREATE TABLE table_name_5 ( away_team VARCHAR )
What was South Melbourne's score when they played as the away team?
SELECT away_team AS score FROM table_name_5 WHERE away_team = "south melbourne"
sql_create_context
CREATE TABLE table_name_11 ( pick__number INTEGER, league_from VARCHAR, player VARCHAR )
What is the average pick # from the Quebec Major Junior Hockey League player Samuel Carrier?
SELECT AVG(pick__number) FROM table_name_11 WHERE league_from = "quebec major junior hockey league" AND player = "samuel carrier"
sql_create_context
CREATE TABLE table_30450 ( "Player" text, "Cap(s)" real, "Goal(s)" real, "International Debut" text, "Club(s)" text )
How many goals did the player from Ipswich town score?
SELECT MIN("Goal(s)") FROM table_30450 WHERE "Club(s)" = 'Ipswich Town'
wikisql
CREATE TABLE table_203_366 ( id number, "pos" number, "class" text, "no" number, "team" text, "drivers" text, "chassis" text, "engine" text, "laps" number )
what was the total number of laps for ecurie savin calberson and dana chevrolet inc. . ?
SELECT SUM("laps") FROM table_203_366 WHERE "team" IN ('ecurie savin-calberson', 'dana chevrolet inc')
squall
CREATE TABLE table_10715317_2 ( title VARCHAR, directed_by VARCHAR, written_by VARCHAR )
What is the title of the episode directed by Peter Markle and written by Jerry Stahl?
SELECT title FROM table_10715317_2 WHERE directed_by = "Peter Markle" AND written_by = "Jerry Stahl"
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...
what is gender and drug name of subject id 2560?
SELECT demographic.gender, prescriptions.drug FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "2560"
mimicsql_data
CREATE TABLE table_77454 ( "Game" text, "Date" text, "Home Team" text, "Result" text, "Road Team" text )
Which Road Team has a Home Team of rochester, and a Game of game 2?
SELECT "Road Team" FROM table_77454 WHERE "Home Team" = 'rochester' AND "Game" = 'game 2'
wikisql
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostFeedback ( Id number, PostId numb...
Questions with version-specific tag lacking the generic tag. Find questions that lack the generic tag while having a version-specific one. Suitable for retaggers :)
SELECT Tags, Title, AcceptedAnswerId, CreationDate, 'http://dba.stackexchange.com/questions/' + CAST(Id AS TEXT) AS URL FROM Posts WHERE Tags LIKE '%' + '##mainTag:string##' + '-%' AND NOT Tags LIKE '%<' + '##mainTag:string##' + '>%' ORDER BY CreationDate DESC
sede
CREATE TABLE table_name_95 ( league INTEGER, fa_cup INTEGER )
What's the highest League Cup with an FA Cup thats larger than 2?
SELECT MAX(league) AS Cup FROM table_name_95 WHERE fa_cup > 2
sql_create_context
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
How many patients' procedure long title is thoracentesis and lab test category is hematology?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Thoracentesis" AND lab."CATEGORY" = "Hematology"
mimicsql_data
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, ...
03652738号患者在02年3月6日到04月10月25日期间其所有检验结果指标记录中的检测方法是啥呢?
SELECT jyjgzbb.JCFF FROM hz_info JOIN zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH...
css
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 ...
How many locations? Draw a bar chart, order by the Y from high to low.
SELECT Location, COUNT(Location) FROM station GROUP BY Location ORDER BY COUNT(Location) DESC
nvbench
CREATE TABLE Payments ( Payment_ID INTEGER, Settlement_ID INTEGER, Payment_Method_Code VARCHAR(255), Date_Payment_Made DATE, Amount_Payment INTEGER ) CREATE TABLE Claims ( Claim_ID INTEGER, Policy_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INTEGER,...
Give me a bar chart that bins the payment date into the Year interval and then shows the total amount of each payment, and then sort the bars in ascending order of date.
SELECT Date_Payment_Made, SUM(Amount_Payment) FROM Payments ORDER BY Date_Payment_Made
nvbench
CREATE TABLE table_63323 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What's the tie number when the away team was Mansfield Town?
SELECT "Tie no" FROM table_63323 WHERE "Away team" = 'mansfield town'
wikisql
CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate real ) CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight re...
Show me about the distribution of Date_of_Birth and Height in a bar chart, could you list by the Y-axis in descending?
SELECT Date_of_Birth, Height FROM people ORDER BY Height DESC
nvbench
CREATE TABLE table_5820 ( "Placing" real, "Team" text, "Players" text, "Seeding" text, "Playoffs W-L" text, "Matches W-L" text )
Players of amanda coetzer and marcos ondruska is what team?
SELECT "Team" FROM table_5820 WHERE "Players" = 'amanda coetzer and marcos ondruska'
wikisql
CREATE TABLE country ( Country_ID int, Name text, Population int, Area int, Languages text ) CREATE TABLE roller_coaster ( Roller_Coaster_ID int, Name text, Park text, Country_ID int, Length real, Height real, Speed text, Opened text, Status text )
Show the names of countries and the average speed of roller coasters from each country with a bar chart, display by the y-axis in asc.
SELECT T1.Name, AVG(T2.Speed) FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID GROUP BY T1.Name ORDER BY AVG(T2.Speed)
nvbench
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), ...
Can you draw the trend of salary over the hire date?, list from high to low by the x-axis.
SELECT HIRE_DATE, SALARY FROM employees ORDER BY HIRE_DATE DESC
nvbench
CREATE TABLE table_name_43 ( venue VARCHAR, opponent VARCHAR )
Name the venue for staines town
SELECT venue FROM table_name_43 WHERE opponent = "staines town"
sql_create_context
CREATE TABLE table_65137 ( "Rank" real, "Player" text, "Team" text, "Runs" text, "Balls" real, "Year" real, "Against" text )
Which player had 50 balls?
SELECT "Player" FROM table_65137 WHERE "Balls" = '50'
wikisql
CREATE TABLE table_name_68 ( points INTEGER, year INTEGER )
What is the average Points for a year before 1955?
SELECT AVG(points) FROM table_name_68 WHERE year < 1955
sql_create_context
CREATE TABLE table_203_565 ( id number, "wrestlers" text, "times" number, "date" text, "location" text, "notes" text )
how many locations were used at least twice ?
SELECT COUNT(*) FROM (SELECT "location" FROM table_203_565 GROUP BY "location" HAVING COUNT(*) >= 2)
squall
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body te...
GroupBy vs Distinct Query Plan.
SELECT AGE FROM Users GROUP BY AGE
sede
CREATE TABLE table_72845 ( "Poll Year" text, "Winner" text, "Second" text, "Third" text, "Fourth" text, "Fifth" text, "Sixth" text, "Seventh" text, "Eighth" text, "Ninth" text, "Tenth" text )
When Interpol is in 6th, who is in 7th?
SELECT COUNT("Seventh") FROM table_72845 WHERE "Sixth" = 'Interpol'
wikisql
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
what is the number of office admitted patients who have abdominal abscess primary disease?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.diagnosis = "ABDOMINAL ABSCESS"
mimicsql_data
CREATE TABLE table_46917 ( "Year" real, "Winner" text, "Jockey" text, "Trainer" text, "Owner" text )
Who was the trainer when Mckaymackenna won?
SELECT "Trainer" FROM table_46917 WHERE "Winner" = 'mckaymackenna'
wikisql
CREATE TABLE table_204_428 ( id number, "season" text, "east superleague" text, "east premier league" text, "east region south division" text, "east region central division" text, "east region north division" text )
when was the last year bo ` ness united made the roll of honor for east superleague ?
SELECT "season" FROM table_204_428 WHERE "east superleague" = "bo'ness united" ORDER BY "season" DESC LIMIT 1
squall
CREATE TABLE table_name_39 ( result VARCHAR, record VARCHAR )
What is the Result of the event with a Record of 1-3?
SELECT result FROM table_name_39 WHERE record = "1-3"
sql_create_context
CREATE TABLE table_204_861 ( id number, "tie no" number, "home team" text, "score" text, "away team" text, "date" text )
what was the goal difference in the game on february 18th ?
SELECT ABS("score" - "score") FROM table_204_861 WHERE "date" = '18 february 1976'
squall
CREATE TABLE table_name_24 ( draws INTEGER, ballarat_fl VARCHAR, against VARCHAR )
What was the highest number of Draws scored by Sebastapol when the value for Against was less than 1802?
SELECT MAX(draws) FROM table_name_24 WHERE ballarat_fl = "sebastapol" AND against < 1802
sql_create_context
CREATE TABLE table_name_31 ( speed INTEGER, year VARCHAR, passengers VARCHAR )
What is the average speed for ships before 1974 with over 1.73 passengers?
SELECT AVG(speed) FROM table_name_31 WHERE year < 1974 AND passengers > 1.73
sql_create_context
CREATE TABLE document_types ( document_type_code text, document_description text ) CREATE TABLE research_staff ( staff_id number, employer_organisation_id number, staff_details text ) CREATE TABLE project_staff ( staff_id number, project_id number, role_code text, date_from time, ...
What is the total amount of grants given by each organisations? Also list the organisation id.
SELECT SUM(grant_amount), organisation_id FROM grants GROUP BY organisation_id
spider
CREATE TABLE table_16361 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (millions)" text )
Which episode had 16.38 million U.S. viewers?
SELECT "Title" FROM table_16361 WHERE "U.S. viewers (millions)" = '16.38'
wikisql
CREATE TABLE table_name_21 ( record VARCHAR, game VARCHAR, score VARCHAR )
What is the celtics record after game 33 when they score of the game was 111-108?
SELECT record FROM table_name_21 WHERE game > 33 AND score = "111-108"
sql_create_context
CREATE TABLE table_204_870 ( id number, "product" text, "main functionality" text, "input format" text, "output format" text, "platform" text, "license and cost" text, "notes" text )
what is the only product utilizing rdf input and output format ?
SELECT "product" FROM table_204_870 WHERE "input format" = 'rdf' AND "output format" = 'rdf'
squall
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, Creati...
Users Whose Top Question is in Tag t.
SELECT maxQScores.OwnerUserId AS "user_link", maxQScores.maxQScore, p1.Id AS "post_link" FROM (SELECT p.OwnerUserId, MAX(p.Score) AS maxQScore FROM Posts AS p WHERE p.PostTypeId = 1 GROUP BY p.OwnerUserId) AS maxQScores INNER JOIN Posts AS p1 ON p1.Score = maxQScores.maxQScore AND p1.PostTypeId = 1 AND p1.OwnerUserId =...
sede
CREATE TABLE table_38584 ( "Designation HD" text, "Constellation" text, "Date sent" text, "Arrival date" text, "Message" text )
What date sent has cancer as the constellation?
SELECT "Date sent" FROM table_38584 WHERE "Constellation" = 'cancer'
wikisql
CREATE TABLE table_225093_4 ( vacator VARCHAR, date_successor_seated VARCHAR )
How many vacators have October 22, 1808 as date successor seated?
SELECT COUNT(vacator) FROM table_225093_4 WHERE date_successor_seated = "October 22, 1808"
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...
Get me the list of patients who died on or before 2126 that had drug code ggac5l.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2126.0" AND prescriptions.formulary_drug_cd = "GGAC5L"
mimicsql_data
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, intime time, outtime time ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_...
had any organism been found during the last urine microbiology test of patient 25312 in 01/this year?
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25312) AND microbiologyevents.spec_type_desc = 'urine' AND NOT microbiologyevents.org_name IS NULL AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETI...
mimic_iii
CREATE TABLE characteristics ( characteristic_id number, characteristic_type_code text, characteristic_data_type text, characteristic_name text, other_characteristic_details text ) CREATE TABLE ref_product_categories ( product_category_code text, product_category_description text, unit_...
Find the unit of measurement and product category code of product named 'chervil'.
SELECT t2.unit_of_measure, t2.product_category_code FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code WHERE t1.product_name = "chervil"
spider
CREATE TABLE table_70677 ( "Year" text, "Start" text, "Qual" text, "Rank" text, "Finish" text, "Laps" real )
What was the finishing place for 1953?
SELECT "Finish" FROM table_70677 WHERE "Year" = '1953'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text...
患者任新霁在00年5月30日到12年7月25日内所有检验结果指标记录中的仪器编号以及名称分别是啥
SELECT jyjgzbb.YQBH, jyjgzbb.YQMC FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN jybgb_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.JZL...
css
CREATE TABLE table_30408 ( "Season" text, "Mens Singles" text, "Womens Singles" text, "Mens Doubles" text, "Womens Doubles" text, "Mixed Doubles" text )
Name the winners of the mens doubles in the season of 1963/64.
SELECT "Mens Doubles" FROM table_30408 WHERE "Season" = '1963/64'
wikisql
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...
在03年3月23日到15年11月12日之间病患55566777的洋地黄情况是怎么样的?
SELECT * FROM hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz_i...
css
CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, ins...
Which MCDB classes don 't meet on Friday ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course_offering.friday = 'N' AND course.department = 'MCDB' AND semester.semester = 'WN' AND s...
advising
CREATE TABLE table_name_38 ( date VARCHAR, away_team VARCHAR )
When was the game when Footscray was the away team?
SELECT date FROM table_name_38 WHERE away_team = "footscray"
sql_create_context
CREATE TABLE table_name_82 ( winning_constructor VARCHAR, circuit VARCHAR )
What Winning constructor has a Circuit of lasarte?
SELECT winning_constructor FROM table_name_82 WHERE circuit = "lasarte"
sql_create_context
CREATE TABLE table_25855 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Series" text )
Name the location attendance for 4 game
SELECT "Location Attendance" FROM table_25855 WHERE "Game" = '4'
wikisql