context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
All answers by user, and the corresponding questions.
SELECT a.Id, b.Title, a.Body FROM Posts AS a INNER JOIN Posts AS b ON a.ParentId = b.Id WHERE a.OwnerUserId = '##UserId##' ORDER BY a.Id DESC
sede
CREATE TABLE table_40251 ( "Position" real, "Team" text, "Points" real, "Played" real, "Drawn" real, "Lost" real, "Against" real, "Difference" text )
Which Points is the average one that has Drawn of 3, and a Played smaller than 22?
SELECT AVG("Points") FROM table_40251 WHERE "Drawn" = '3' AND "Played" < '22'
wikisql
CREATE TABLE table_7699 ( "Material" text, "Formula" text, "Refractive index(es) 589.3nm" text, "Hardness ( Mohs' scale )" text, "Density (g/cm 3 )" text, "State of the art" text )
How much is the density with a hardness of ~ 8.3?
SELECT "Density (g/cm 3 )" FROM table_7699 WHERE "Hardness ( Mohs' scale )" = '~ 8.3'
wikisql
CREATE TABLE hz_info_mzjzjlb ( JZLSH number, YLJGDM number, mzjzjlb_id number ) 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 tim...
柳芳林患者以前有都有哪个门诊诊断的结果?
SELECT mzjzjlb.JZZDBM, mzjzjlb.JZZDSM 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_mz...
css
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime t...
what were the top five most frequently prescribed drugs for patients for whom heparin (porcine) 5,000 unit/ml injection : 1 ml vial was prescribed at the same time?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'heparin (porcine) 5,000 unit/ml injection : 1 ml vi...
eicu
CREATE TABLE customers ( customer_id number, customer_type_code text, address_line_1 text, address_line_2 text, town_city text, state text, email_address text, phone_number text ) CREATE TABLE staff ( staff_id number, gender text, first_name text, last_name text, ema...
Find the phone number of all the customers and staff.
SELECT phone_number FROM customers UNION SELECT phone_number FROM staff
spider
CREATE TABLE table_19948664_2 ( year_of_publication VARCHAR, ranking_la__2_ VARCHAR )
What was the publication year ranking l.a. is 1st?
SELECT year_of_publication FROM table_19948664_2 WHERE ranking_la__2_ = "1st"
sql_create_context
CREATE TABLE table_204_282 ( id number, "date" text, "venue" text, "opponent" text, "score" text, "result" text, "competition" text, "#" number )
which opponent has the same score as san marino ?
SELECT "opponent" FROM table_204_282 WHERE "opponent" <> 'san marino' AND "score" = (SELECT "score" FROM table_204_282 WHERE "opponent" = 'san marino')
squall
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE T...
Number/score from answers and from questions for top users (only non-CW).
SELECT p.OwnerUserId AS "user_link", p.OwnerDisplayName, SUM(p.Score) AS "total_score", COUNT(p.Id) AS "total_posts", SUM(CASE WHEN p.PostTypeId = 1 THEN 1 ELSE 0 END) AS "total_questions", SUM(CASE WHEN p.PostTypeId = 2 THEN 1 ELSE 0 END) AS "total_answers", SUM(CASE WHEN p.PostTypeId = 1 THEN p.Score ELSE 0 END) AS "...
sede
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, ...
what is minimum age of patients whose marital status is single and admission year is greater than or equal to 2158?
SELECT MIN(demographic.age) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.admityear >= "2158"
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, ...
count the number of patients whose age is less than 67 and days of hospital stay is greater than 34?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "67" AND demographic.days_stay > "34"
mimicsql_data
CREATE TABLE table_57232 ( "Years" text, "Engine" text, "Power" text, "Torque" text, "Notes" text )
what is the torque when the notes are laredo, limited, overland and the engine is 5.7l hemi v8?
SELECT "Torque" FROM table_57232 WHERE "Notes" = 'laredo, limited, overland' AND "Engine" = '5.7l hemi v8'
wikisql
CREATE TABLE table_name_13 ( athlete VARCHAR, country VARCHAR )
Who is the athlete from greece?
SELECT athlete FROM table_name_13 WHERE country = "greece"
sql_create_context
CREATE TABLE table_name_25 ( Id VARCHAR )
What's the 2011 result when 2010 is 2r and 2013 is w?
SELECT 2011 FROM table_name_25 WHERE 2010 = "2r" AND 2013 = "w"
sql_create_context
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, war...
when was the last time that patient 47460 was prescribed medication during the last hospital encounter via iv route?
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 47460 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND prescriptions.route = 'iv' ORDER BY prescriptions.startdate DESC LIMIT 1
mimic_iii
CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, ...
i'm traveling to DALLAS from PHILADELPHIA
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, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'D...
atis
CREATE TABLE table_name_34 ( religious_affiliation VARCHAR, athletics_nickname VARCHAR )
What was the religious affiliation for the athletics nicknamed lords/ladies?
SELECT religious_affiliation FROM table_name_34 WHERE athletics_nickname = "lords/ladies"
sql_create_context
CREATE TABLE table_18031 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Game site" text, "Record" text, "Attendance" real )
In what week was the record 5-9?
SELECT MAX("Week") FROM table_18031 WHERE "Record" = '5-9'
wikisql
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 whose procedure short title is radical cystectomy?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.short_title = "Radical cystectomy"
mimicsql_data
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, a bar chart shows the distribution of name and code , and group by attribute headquarter, and order in ascending by the Y.
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name ORDER BY T1.Code
nvbench
CREATE TABLE table_48506 ( "Tournament" text, "1993" text, "1994" text, "1995" text, "1996" text, "1997" text, "1998" text, "1999" text, "2000" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "Career WR"...
What is 2007, when 2000 is '0 / 4'?
SELECT "2007" FROM table_48506 WHERE "2000" = '0 / 4'
wikisql
CREATE TABLE table_26415 ( "Rank" real, "WS Points" real, "Name" text, "Country" text, "08-09 I/O best" real, "08-09 GP/JGP best" real, "08-09 GP/JGP 2nd" real, "08-09 OI best" real, "08-09 OI 2nd" real, "07-08 I/O best" real, "07-08 GP/JGP best" real, "07-08 GP/JGP 2nd" ...
What is the smallest 07-08 oi best value?
SELECT MIN("07-08 OI best") FROM table_26415
wikisql
CREATE TABLE table_77761 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
What is the top attendance for weeks past 2 on october 29, 1961?
SELECT MAX("Attendance") FROM table_77761 WHERE "Week" > '2' AND "Date" = 'october 29, 1961'
wikisql
CREATE TABLE restaurant ( id int, name varchar, food_type varchar, city_name varchar, rating "decimal ) CREATE TABLE location ( restaurant_id int, house_number int, street_name varchar, city_name varchar ) CREATE TABLE geographic ( city_name varchar, county varchar, reg...
give me some restaurants good for arabic food in mountain view ?
SELECT location.house_number, restaurant.name FROM location, restaurant WHERE location.city_name = 'mountain view' AND restaurant.food_type = 'arabic' AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5
restaurants
CREATE TABLE table_name_93 ( team_1 VARCHAR, team_2 VARCHAR )
What was the name of the Team 1, where the Team 2 was Stade De Reims (d2)?
SELECT team_1 FROM table_name_93 WHERE team_2 = "stade de reims (d2)"
sql_create_context
CREATE TABLE table_203_713 ( id number, "s.no." number, "name of kingdom" text, "name of king" text, "no. of villages" number, "capital" text, "names of districts" text )
which kingdom has the most villages ?
SELECT "name of kingdom" FROM table_203_713 ORDER BY "no. of villages" DESC LIMIT 1
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...
how many patients whose gender is f and age is less than 41?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.age < "41"
mimicsql_data
CREATE TABLE Customers ( customer_id VARCHAR, first_name VARCHAR, last_name VARCHAR ) CREATE TABLE Lessons ( customer_id VARCHAR, lesson_status_code VARCHAR )
How many lessons taken by customer with first name as Rylan and last name as Goodwin were completed?
SELECT COUNT(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Rylan" AND T2.last_name = "Goodwin" AND T1.lesson_status_code = "Completed"
sql_create_context
CREATE TABLE hz_info_mzjzjlb ( JZLSH number, YLJGDM number, mzjzjlb_id number ) 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 ...
降钙素原这项在被门诊诊断为疾病E21.594的病人身上参考值范围下限与上限是多少?
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM ...
css
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAd...
Comments posted after your comment.
SELECT c.UserId AS "user_link", c.Id AS "comment_link", p.Id AS "post_link" FROM Posts AS p, Comments AS c INNER JOIN Comments AS b ON c.PostId = b.PostId WHERE b.UserId = '##UserId##' AND c.UserId != '##UserId##' AND c.CreationDate > b.CreationDate AND p.Id = c.PostId ORDER BY c.CreationDate DESC
sede
CREATE TABLE table_27816698_2 ( pac_12_sports VARCHAR, institution VARCHAR )
How many pac-12 sports are shown for california polytechnic state university?
SELECT COUNT(pac_12_sports) FROM table_27816698_2 WHERE institution = "California Polytechnic State University"
sql_create_context
CREATE TABLE table_name_4 ( lost INTEGER, position VARCHAR, drawn VARCHAR )
Which Lost has a Position of 4, and a Drawn smaller than 3?
SELECT AVG(lost) FROM table_name_4 WHERE position = 4 AND drawn < 3
sql_create_context
CREATE TABLE table_79326 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
Which away team has a tie number of 3?
SELECT "Away team" FROM table_79326 WHERE "Tie no" = '3'
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 hz_info ( KH text, KLX number...
自2001-04-15起,截止到2006-05-09,医疗机构5651827开出的检验报告单的详细数量有多少
SELECT COUNT(*) FROM zyjybgb WHERE zyjybgb.YLJGDM = '5651827' AND zyjybgb.BGRQ BETWEEN '2001-04-15' AND '2006-05-09' UNION SELECT COUNT(*) FROM mzjybgb WHERE mzjybgb.YLJGDM = '5651827' AND mzjybgb.BGRQ BETWEEN '2001-04-15' AND '2006-05-09'
css
CREATE TABLE table_20884160_1 ( report VARCHAR, race_title VARCHAR )
Was the result of the supercheap auto bathurst 1000 reported?
SELECT report FROM table_20884160_1 WHERE race_title = "Supercheap Auto Bathurst 1000"
sql_create_context
CREATE TABLE table_name_58 ( losses INTEGER, draws INTEGER )
How many Losses have Draws larger than 0?
SELECT MAX(losses) FROM table_name_58 WHERE draws > 0
sql_create_context
CREATE TABLE storm ( name VARCHAR, damage_millions_USD VARCHAR, max_speed VARCHAR )
List name and damage for all storms in a descending order of max speed.
SELECT name, damage_millions_USD FROM storm ORDER BY max_speed DESC
sql_create_context
CREATE TABLE table_15320 ( "Rank" real, "Island" text, "Area (km\u00b2)" real, "Area (sq mi)" real, "Country/Countries/Region" text )
Which rank has a smaller area (sq mi) than 48, and an area (km2) greater than 104, and an island of sula, sogn og fjordane?
SELECT "Rank" FROM table_15320 WHERE "Area (sq mi)" < '48' AND "Area (km\u00b2)" > '104' AND "Island" = 'sula, sogn og fjordane'
wikisql
CREATE TABLE table_4694 ( "Played" real, "Lost" real, "Drawn" real, "Tries" real, "Points" real, "% Won" real )
What is the smallest draws for a player larger than 2 with a 100% wins?
SELECT MIN("Drawn") FROM table_4694 WHERE "Played" > '2' AND "% Won" > '100'
wikisql
CREATE TABLE Detention ( detention_id INTEGER, detention_type_code VARCHAR(10), teacher_id INTEGER, datetime_detention_start DATETIME, datetime_detention_end DATETIME, detention_summary VARCHAR(255), other_details VARCHAR(255) ) CREATE TABLE Students ( student_id INTEGER, address_id...
What are the dates of the assessment notes, and count them by a line chart, and display in descending by the X-axis please.
SELECT date_of_notes, COUNT(date_of_notes) FROM Assessment_Notes ORDER BY date_of_notes DESC
nvbench
CREATE TABLE Ship ( Ship_ID int, Name text, Type text, Built_Year real, Class text, Flag text ) CREATE TABLE captain ( Captain_ID int, Name text, Ship_ID int, age text, Class text, Rank text )
Draw a bar chart for what are the different ship flags, and how many ships have each?, and list the total number in asc order please.
SELECT Flag, COUNT(*) FROM Ship GROUP BY Flag ORDER BY COUNT(*)
nvbench
CREATE TABLE table_63166 ( "Game" text, "Date" text, "Opponent" text, "Score" text, "Location/Attendance" text, "Record" text )
Who was the opponent at the game at Madison Square Garden?
SELECT "Opponent" FROM table_63166 WHERE "Location/Attendance" = 'madison square garden'
wikisql
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate...
how many patients were diagnosed with esophageal reflux in the same hospital encounter in the last year after having been previously diagnosed with pneumo oth grm-neg bact?
SELECT COUNT(DISTINCT t1.subject_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 FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title =...
mimic_iii
CREATE TABLE table_20779 ( "Model number" text, "sSpec number" text, "Frequency" text, "L2 cache" text, "FSB" text, "Mult." text, "Voltage" text, "TDP" text, "Socket" text, "Release date" text, "Part number(s)" text, "Release price ( USD )" text )
What is the model number with a release price of $496?
SELECT "Model number" FROM table_20779 WHERE "Release price ( USD )" = '$496'
wikisql
CREATE TABLE aircraft ( aid number(9,0), name varchar2(30), distance number(6,0) ) CREATE TABLE certificate ( eid number(9,0), aid number(9,0) ) CREATE TABLE employee ( eid number(9,0), name varchar2(30), salary number(10,2) ) CREATE TABLE flight ( flno number(4,0), origin var...
Show all destinations and the number of flights to each destination Plot them as bar chart, I want to list bar in desc order please.
SELECT destination, COUNT(*) FROM flight GROUP BY destination ORDER BY destination DESC
nvbench
CREATE TABLE table_name_73 ( score VARCHAR, home_team VARCHAR )
What was the score for the game where the home team was Wycombe Wanderers?
SELECT score FROM table_name_73 WHERE home_team = "wycombe wanderers"
sql_create_context
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...
查一查医院7449354全部诊疗记录中,有不一样的出院诊断疾病编码的患者和在不同科室的患者平均有多大
SELECT qtb.MED_ORG_DEPT_NM, qtb.OUT_DIAG_DIS_CD, AVG(qtb.PERSON_AGE) FROM qtb WHERE qtb.MED_SER_ORG_NO = '7449354' GROUP BY qtb.MED_ORG_DEPT_NM, qtb.OUT_DIAG_DIS_CD UNION SELECT gyb.MED_ORG_DEPT_NM, gyb.OUT_DIAG_DIS_CD, AVG(gyb.PERSON_AGE) FROM gyb WHERE gyb.MED_SER_ORG_NO = '7449354' GROUP BY gyb.MED_ORG_DEPT_NM, gyb....
css
CREATE TABLE table_72897 ( "Position" real, "Team" text, "Played" real, "Won" real, "Drawn" real, "Lost" real, "Goals For" real, "Goals Against" real, "Goal Average 1" text, "Points 2" real )
How many games did the team who scored 60 goals win?
SELECT MIN("Won") FROM table_72897 WHERE "Goals For" = '60'
wikisql
CREATE TABLE table_name_51 ( rank VARCHAR, floors VARCHAR )
What ranking is the structure with 01.0 87 floors?
SELECT rank FROM table_name_51 WHERE floors = "01.0 87"
sql_create_context
CREATE TABLE table_name_47 ( time VARCHAR, rank VARCHAR )
What is the time of the swimmer in rank 40?
SELECT time FROM table_name_47 WHERE rank = 40
sql_create_context
CREATE TABLE table_41869 ( "Peel" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real )
Which Byes has a Losses smaller than 1?
SELECT MAX("Byes") FROM table_41869 WHERE "Losses" < '1'
wikisql
CREATE TABLE table_name_62 ( silver INTEGER, gold VARCHAR, nation VARCHAR, total VARCHAR, bronze VARCHAR )
Tell me the average silver for total more than 1 with bronze of 2 for france and gold more than 0
SELECT AVG(silver) FROM table_name_62 WHERE total > 1 AND bronze = 2 AND nation = "france" AND gold > 0
sql_create_context
CREATE TABLE table_48077 ( "Total Points" real, "Name" text, "Career Games" text, "Position" text, "Years Played" text, "Scored 1,500 Points" text, "Date and Opponent" text )
Which Name has a Years Played of 2004 2008, and a Date and Opponent of 2/17/07 vs. purdue?
SELECT "Name" FROM table_48077 WHERE "Years Played" = '2004–2008' AND "Date and Opponent" = '2/17/07 vs. purdue'
wikisql
CREATE TABLE table_name_64 ( date VARCHAR, home VARCHAR )
What date did the team play home in Toronto?
SELECT date FROM table_name_64 WHERE home = "toronto"
sql_create_context
CREATE TABLE market ( Market_ID int, District text, Num_of_employees int, Num_of_shops real, Ranking int ) CREATE TABLE phone_market ( Market_ID int, Phone_ID text, Num_of_stock int ) CREATE TABLE phone ( Name text, Phone_ID int, Memory_in_G int, Carrier text, Price...
What is the number of carriers of phones? Give me a bar chart, and show Y-axis from low to high order.
SELECT Carrier, COUNT(Carrier) FROM phone GROUP BY Carrier ORDER BY COUNT(Carrier)
nvbench
CREATE TABLE table_13405 ( "Year" real, "Champion (average in final)" text, "Legs" text, "Runner-up (average in final)" text, "Sponsor" text, "Prize Fund" text, "Champion" text, "Runner-up" text, "Venue" text )
what is the venue when the runner-up is 20,000, the champion (average in final) is phil taylor (109.35)?
SELECT "Venue" FROM table_13405 WHERE "Runner-up" = '£20,000' AND "Champion (average in final)" = 'phil taylor (109.35)'
wikisql
CREATE TABLE table_34913 ( "Country" text, "Skip" text, "Third" text, "Second" text, "Lead" text )
What was Canada's skip?
SELECT "Skip" FROM table_34913 WHERE "Country" = 'canada'
wikisql
CREATE TABLE table_name_6 ( Id VARCHAR )
What was 2002, when 2008 was, 'career statistics'?
SELECT 2002 FROM table_name_6 WHERE 2008 = "career statistics"
sql_create_context
CREATE TABLE table_45638 ( "Leader" text, "Party" text, "Leader's Seat" text, "Number of Seats" real, "Leader since" text )
How many seats does leader Raymond McCartney have?
SELECT SUM("Number of Seats") FROM table_45638 WHERE "Leader" = 'raymond mccartney'
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 bdmzjzjlb ( HXPLC number, HZX...
名字叫郎高义的病患他的身高和体重都是多少?
SELECT wdmzjzjlb.SG, wdmzjzjlb.TZ FROM person_info JOIN hz_info JOIN wdmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE person_info.XM = '郎高义' UNION SELECT bdmzjzjlb.SG, bdmzjzjlb.TZ FROM person_info JOIN hz_info JOIN bd...
css
CREATE TABLE table_28741 ( "School" text, "Nickname" text, "Location" text, "Colors" text, "Join Date" real )
Name when north canton joined
SELECT "Join Date" FROM table_28741 WHERE "Location" = 'North Canton'
wikisql
CREATE TABLE table_name_90 ( bats VARCHAR, surname VARCHAR, first VARCHAR, throws VARCHAR )
Which Bats have a First of josh, and Throws of r, and a Surname of cakebread?
SELECT bats FROM table_name_90 WHERE first = "josh" AND throws = "r" AND surname = "cakebread"
sql_create_context
CREATE TABLE table_204_710 ( id number, "model" text, "origin" text, "type" text, "versions" text, "in service" text, "notes" text )
what country has more aircraft listed than any other ?
SELECT "origin" FROM table_204_710 GROUP BY "origin" ORDER BY COUNT(*) DESC LIMIT 1
squall
CREATE TABLE table_18461635_1 ( team VARCHAR, county VARCHAR )
What is the name of the team from Derbyshire county?
SELECT team FROM table_18461635_1 WHERE county = "Derbyshire"
sql_create_context
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE ReviewRejectionReasons ( Id number, Na...
Downvoted questions with all-downvoted answers.
WITH Raw AS (SELECT Q.Id, MIN(Q.Score) AS QScore, COUNT(*) AS AnswerNo, COUNT(CASE WHEN A.Score < 0 THEN 1 ELSE NULL END) AS NegAnswerNo FROM Posts AS Q, Posts AS A WHERE Q.Score < 0 AND A.ParentId = Q.Id AND Q.AcceptedAnswerId IS NULL AND NOT Q.ClosedDate IS NULL GROUP BY Q.Id) SELECT Id AS "post_link", QScore, Answer...
sede
CREATE TABLE table_42937 ( "State" text, "White (%)" real, "Brown (%)" real, "Black (%)" real, "Asian or Amerindian (%)" real )
What is the sum of Asian or Amerindian (%), when Black (%) is 9,7, and when White (%) is greater than 45,7?
SELECT SUM("Asian or Amerindian (%)") FROM table_42937 WHERE "Black (%)" = '9,7' AND "White (%)" > '45,7'
wikisql
CREATE TABLE table_28953 ( "Rd." text, "Circuit" text, "City / State" text, "Date" text, "Championship" text, "Challenge" text, "Production" text )
What is the date for the mount panorama circuit?
SELECT "Date" FROM table_28953 WHERE "Circuit" = 'Mount Panorama Circuit'
wikisql
CREATE TABLE table_79117 ( "Season" text, "Team" text, "Country" text, "Division" real, "Goals" real )
What is Season, when Goals is less than 6, and when Team is 'Tarbiat Yazd'?
SELECT "Season" FROM table_79117 WHERE "Goals" < '6' AND "Team" = 'tarbiat yazd'
wikisql
CREATE TABLE genre ( g_name text, rating text, most_popular_in text ) CREATE TABLE artist ( artist_name text, country text, gender text, preferred_genre text ) CREATE TABLE files ( f_id number, artist_name text, file_size text, duration text, formats text ) CREATE TABL...
What are the names of all songs in English?
SELECT song_name FROM song WHERE languages = "english"
spider
CREATE TABLE Claims ( Claim_ID INTEGER, Policy_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INTEGER, Amount_Settled INTEGER ) CREATE TABLE Customer_Policies ( Policy_ID INTEGER, Customer_ID INTEGER, Policy_Type_Code CHAR(15), Start_Date DATE, End...
A bar chart for returning the number of the claim start date for the claims whose claimed amount is no more than the average, and rank from high to low by the y axis.
SELECT Date_Claim_Made, COUNT(Date_Claim_Made) FROM Claims WHERE Amount_Settled <= (SELECT AVG(Amount_Settled) FROM Claims) ORDER BY COUNT(Date_Claim_Made) DESC
nvbench
CREATE TABLE table_75508 ( "Season" text, "Competition" text, "Round" text, "Club" text, "Home result" text, "Away result" text )
Away result of 1 1, and a Round of 1r, and a Season of 1967-68 involves what club?
SELECT "Club" FROM table_75508 WHERE "Away result" = '1–1' AND "Round" = '1r' AND "Season" = '1967-68'
wikisql
CREATE TABLE table_58427 ( "Season" real, "Level" text, "Division" text, "Administration" text, "Position" text )
What is the average of seasons for 10th place finishes?
SELECT AVG("Season") FROM table_58427 WHERE "Position" = '10th'
wikisql
CREATE TABLE table_52492 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the venue when the away team scored 17.21 (123)?
SELECT "Venue" FROM table_52492 WHERE "Away team score" = '17.21 (123)'
wikisql
CREATE TABLE table_name_75 ( lane INTEGER, name VARCHAR, rank VARCHAR )
What is the least lane number that Natalie Coughlin was in when she was ranked greater than 1?
SELECT MIN(lane) FROM table_name_75 WHERE name = "natalie coughlin" AND rank > 1
sql_create_context
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...
stack exchange big with accepted answers.
SELECT COUNT(1) FROM (SELECT Id, AcceptedAnswerId FROM Posts WHERE AcceptedAnswerId > 0 AND ViewCount > 1000) AS Posts JOIN Posts AS Answers ON Posts.AcceptedAnswerId = Answers.Id
sede
CREATE TABLE table_28903 ( "District" text, "Incumbent" text, "Party" text, "First elected" text, "Result" text, "Candidates" text )
how many times were the candidates thomas h. hubbard (dr) 51.5% simeon ford (f) 48.4%?
SELECT COUNT("Party") FROM table_28903 WHERE "Candidates" = 'Thomas H. Hubbard (DR) 51.5% Simeon Ford (F) 48.4%'
wikisql
CREATE TABLE table_20990 ( "Year" real, "Starts" real, "Wins" real, "Top 5" real, "Top 10" real, "Poles" real, "Avg. Start" text, "Avg. Finish" text, "Winnings" text, "Position" text, "Team(s)" text )
Name the total number of winnings for 1995
SELECT COUNT("Winnings") FROM table_20990 WHERE "Year" = '1995'
wikisql
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_DIRE_CD text, MED_DIRE_NM text,...
查一下病患葛映波的医疗记录,分别列出医疗费总额高于6981.35元的入院诊断疾病名和编码
SELECT t_kc21.OUT_DIAG_DIS_CD, t_kc21.OUT_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_NM = '葛映波' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT >= 6981.35)
css
CREATE TABLE table_14869 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
Who is the player with a 76-67-71=214 score?
SELECT "Player" FROM table_14869 WHERE "Score" = '76-67-71=214'
wikisql
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JO...
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of phone_number and manager_id , and rank Y-axis in descending order please.
SELECT PHONE_NUMBER, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY MANAGER_ID DESC
nvbench
CREATE TABLE table_name_13 ( high_rebounds VARCHAR, series VARCHAR )
What is the High rebounds with a Series with 4 2?
SELECT high_rebounds FROM table_name_13 WHERE series = "4–2"
sql_create_context
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserD...
Top users from Yekaterinburg, Russia.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%ekaterinburg%' OR UPPER(Location) LIKE '%EKATERINBURG%' OR Location LIKE '%ekaterinburg%' AND Reputation >= 1000 ORDER BY Reputation DESC
sede
CREATE TABLE financial_transactions ( transaction_id number, previous_transaction_id number, account_id number, card_id number, transaction_type text, transaction_date time, transaction_amount number, transaction_comment text, other_transaction_details text ) CREATE TABLE customers_...
Show the number of customer cards.
SELECT COUNT(*) FROM customers_cards
spider
CREATE TABLE table_name_42 ( grid INTEGER, time_retired VARCHAR, laps VARCHAR )
Which grid has a time/retired of +3.9 secs in less than 96 laps?
SELECT AVG(grid) FROM table_name_42 WHERE time_retired = "+3.9 secs" AND laps < 96
sql_create_context
CREATE TABLE table_63769 ( "Coaster Name" text, "Park" text, "Location" text, "Track" text, "Builder" text, "Year Opened" text )
Which year opened is located in west mifflin, pennsylvania?
SELECT "Year Opened" FROM table_63769 WHERE "Location" = 'west mifflin, pennsylvania'
wikisql
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,...
名叫俞欣怡的病人在01年1月29日到2014年9月27日期间被开出的所有检验报告单的科室编码以及名称分别叫什么?
SELECT jybgb.KSBM, jybgb.KSMC FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN mzjzjlb_jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJL...
css
CREATE TABLE table_name_94 ( hanyu_pinyin VARCHAR, area__km²_ VARCHAR )
What is the Hanyu Pinyin with an area of 400?
SELECT hanyu_pinyin FROM table_name_94 WHERE area__km²_ = "400"
sql_create_context
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, ...
for patients who were prescribed with sodium chloride 0.9 % syringe : 10 ml syringe until 2 years ago, what are the top three most frequent medications that followed afterwards in the same hospital visit?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime, patient.patienthealthsystemstayid FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'sodium chloride ...
eicu
CREATE TABLE table_66580 ( "Seq." text, "Name" text, "Background" real, "Party Leadership" real, "Communication Ability" real, "Relations with Congress" real, "Court Appointments" real, "Handling of Economy" real, "Luck" real, "Ability to Compromise" real, "Willing to take Ri...
What's the most overall when the executive appointments were 28 and the background was smaller than 37?
SELECT MAX("Overall") FROM table_66580 WHERE "Executive Appointments" = '28' AND "Background" < '37'
wikisql
CREATE TABLE table_name_45 ( Id VARCHAR )
What is the 1987 value of the 1994 atp masters series?
SELECT 1987 FROM table_name_45 WHERE 1994 = "atp masters series"
sql_create_context
CREATE TABLE table_4203 ( "Country / region" text, "Channel" text, "Series premiere" text, "Title in country" text, "Source(s)" text, "Airing?" text )
How many sources are there for south africa?
SELECT COUNT("Source(s)") FROM table_4203 WHERE "Country / region" = 'South Africa'
wikisql
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
give me the number of patients whose admission location is clinic referral/premature and procedure icd9 code is 3892?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND procedures.icd9_code = "3892"
mimicsql_data
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 FlagTypes ( Id number, Name text, Description text ) CREATE T...
Tag wikis with old external http:// links.
SELECT DISTINCT Tags.Id, Tags.TagName, 'site://tags/' + Tags.TagName + '/info|Url' AS Url, LENGTH(Posts.Body) FROM Tags LEFT JOIN Posts ON Posts.Id = Tags.WikiPostId OR Posts.Id = Tags.ExcerptPostId WHERE (LOWER(Posts.Body) LIKE '%http://github.%' OR LOWER(Posts.Body) LIKE '%http://wikipedia.%' OR LOWER(Posts.Body) LIK...
sede
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, ...
Calculate the average age of emergency type hospital admission patients who have aortic insufficiency re-do sternotomy aortic valve replacement as their primary disease.
SELECT AVG(demographic.age) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.diagnosis = "AORTIC INSUFFICIENCY\RE-DO STERNOTOMY; AORTIC VALVE REPLACEMENT "
mimicsql_data
CREATE TABLE table_73764 ( "Branding" text, "Callsign" text, "Channel" text, "Power (kW)" text, "Coverage" text )
Which city did kpnz-tv provide coverage for?
SELECT "Coverage" FROM table_73764 WHERE "Callsign" = 'KPNZ-TV'
wikisql
CREATE TABLE table_name_47 ( score VARCHAR, tournament VARCHAR, opponent VARCHAR )
What was the score of the player who played against Wong Choong Hann in the Dutch Open?
SELECT score FROM table_name_47 WHERE tournament = "dutch open" AND opponent = "wong choong hann"
sql_create_context
CREATE TABLE table_78406 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
What is the average number of laps that has a Time/Retired of +1 lap, a Driver of olivier panis, and a Grid larger than 4?
SELECT AVG("Laps") FROM table_78406 WHERE "Time/Retired" = '+1 lap' AND "Driver" = 'olivier panis' AND "Grid" > '4'
wikisql
CREATE TABLE table_55333 ( "Serial" real, "Airborne Unit" text, "Troop carrier Group" text, "# of C-47s" real, "UK Base" text, "Drop Zone" text, "Drop Zone Time" real )
Which UK Base has an airborne unit of Pathfinders?
SELECT "UK Base" FROM table_55333 WHERE "Airborne Unit" = 'pathfinders'
wikisql
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, return a bar chart about the distribution of hire_date and the sum of salary bin hire_date by time.
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
nvbench
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime t...
how many hours has passed since the time patient 021-95970 was admitted to the icu?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '021-95970' AND patient.unitdischargetime IS NULL
eicu