context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
Return a pie chart about the proportion of All_Games and School_ID.
SELECT All_Games, School_ID FROM basketball_match
nvbench
CREATE TABLE mzjzjlb ( YLJGDM text, JZLSH text, KH text, KLX number, MJZH text, HZXM text, NLS number, NLY number, ZSEBZ number, JZZTDM number, JZZTMC text, JZJSSJ time, TXBZ number, ZZBZ number, WDBZ number, JZKSBM text, JZKSMC text, JZKSRQ time, ...
那个科室开出检验报告单48779954623它的编码是什么?
SELECT KSBM, KSMC FROM jybgb WHERE BGDH = '48779954623'
css
CREATE TABLE table_name_4 ( county VARCHAR, name VARCHAR )
In which county is the swann covered bridge located?
SELECT county FROM table_name_4 WHERE name = "swann covered bridge"
sql_create_context
CREATE TABLE table_54424 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
What is the least number of laps for the driver Jo Siffert?
SELECT MIN("Laps") FROM table_54424 WHERE "Driver" = 'jo siffert'
wikisql
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, ...
among patients diagnosed with fever in other diseases, how many of them were female?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.short_title = "Fever in other diseases"
mimicsql_data
CREATE TABLE table_14594528_6 ( losses VARCHAR, games VARCHAR )
How many losses for the coach that coached 19 games?
SELECT losses FROM table_14594528_6 WHERE games = 19
sql_create_context
CREATE TABLE table_name_83 ( latitude VARCHAR, year_built VARCHAR )
What is the Latitude of the monument built in 1901?
SELECT latitude FROM table_name_83 WHERE year_built = 1901
sql_create_context
CREATE TABLE table_name_75 ( yellow_cards INTEGER, season VARCHAR )
Which Yellow Cards has a Season of 1999/2000?
SELECT AVG(yellow_cards) FROM table_name_75 WHERE season = "1999/2000"
sql_create_context
CREATE TABLE table_2077192_2 ( french VARCHAR, english VARCHAR )
What is the French translation for the English word 'orange'?
SELECT french FROM table_2077192_2 WHERE english = "orange"
sql_create_context
CREATE TABLE table_35542 ( "Round" real, "Pick #" real, "Overall" real, "Name" text, "Position" text, "College" text )
What is the lowest overall for a quarterback with fewer than 7 rounds?
SELECT MIN("Overall") FROM table_35542 WHERE "Position" = 'quarterback' AND "Round" < '7'
wikisql
CREATE TABLE table_name_34 ( country VARCHAR )
What is the lowest number of participants in 2013 when there were more than 5 participants in 2010, less than 4 participants in 2012 and country was germany?
SELECT MIN(2013) FROM table_name_34 WHERE 2010 > 5 AND country = "germany" AND 2012 < 4
sql_create_context
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
FILMVID 490 has been taught by who in the past ?
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN semester...
advising
CREATE TABLE table_70025 ( "Season" text, "Competition" text, "Round" text, "Club" text, "Home" text, "Away" text, "Aggregate" text )
Which round did Dundee United end in?
SELECT "Round" FROM table_70025 WHERE "Club" = 'dundee united'
wikisql
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
在张秀媛的患者的检查过程中有哪些检验报告单对应的检验结果指标是都不正常的?具体的检验报告单号是啥?
SELECT jybgb.BGDH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN 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 = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE person_info.XM = '张秀媛' AND NOT ...
css
CREATE TABLE t_kc21 ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
医院3003256所有医疗记录的个人账户支出与医疗费总额是多大平均比值,在2011-07-03到2013-04-26内?
SELECT AVG(t_kc24.PER_ACC_PAY) FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.MED_SER_ORG_NO = '3003256' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2011-07-03' AND '2013-04-26'
css
CREATE TABLE table_54518 ( "Species" text, "Strain" text, "Type" text, "Base Pairs" real, "Genes" real )
What species has more than 2,030 genes?
SELECT "Species" FROM table_54518 WHERE "Genes" > '2,030'
wikisql
CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE code_des...
show me flights from DENVER to BOSTON on thursday
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 = 'BOSTON' AND date_day.day_number = 24 AND date_day.month_number = 5 AND da...
atis
CREATE TABLE table_67186 ( "Year" real, "Class" text, "Team" text, "Points" real, "Rank" text, "Wins" real )
Name the least wins for 6 points
SELECT MIN("Wins") FROM table_67186 WHERE "Points" = '6'
wikisql
CREATE TABLE table_56711 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
Who is the driver for laps of 45
SELECT "Driver" FROM table_56711 WHERE "Laps" = '45'
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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
what is maximum age of patients whose gender is m and admission type is emergency?
SELECT MAX(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.admission_type = "EMERGENCY"
mimicsql_data
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
what is the difference between the hct of patient 030-8973 second measured on the first hospital visit compared to the first value measured on the first hospital visit?
SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-8973' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospit...
eicu
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE treatment ( ...
what are the four most frequent procedures that patients were given during the same month after receiving medicine consultation in the previous year?
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'medicine consultation' AND DATETIME(trea...
eicu
CREATE TABLE Companies ( Industry VARCHAR, Headquarters VARCHAR )
Show the industries shared by companies whose headquarters are 'USA' and companies whose headquarters are 'China'.
SELECT Industry FROM Companies WHERE Headquarters = "USA" INTERSECT SELECT Industry FROM Companies WHERE Headquarters = "China"
sql_create_context
CREATE TABLE table_61457 ( "Date" text, "Tournament" text, "Surface" text, "Partnering" text, "Opponent in the final" text, "Score" text )
Name the Opponent in the final on july 4, 2005?
SELECT "Opponent in the final" FROM table_61457 WHERE "Date" = 'july 4, 2005'
wikisql
CREATE TABLE table_11664 ( "Year" real, "Tournament" text, "Venue" text, "Result" text, "Extra" text )
What is the latest year in Annecy, France?
SELECT MAX("Year") FROM table_11664 WHERE "Venue" = 'annecy, france'
wikisql
CREATE TABLE table_203_642 ( id number, "name" text, "quadrant" text, "sector" text, "ward" text, "type" text, "2012\npopulation\nrank" number, "population\n(2012)" number, "population\n(2011)" number, "% change" number, "dwellings\n(2012)" number, "area\n(km2)" number, ...
how many industrial neighborhoods exist in calgary ?
SELECT COUNT(*) FROM table_203_642 WHERE "type" = 'industrial'
squall
CREATE TABLE table_11214 ( "Week" text, "Date" text, "Opponent" text, "Result" text, "Kickoff [a ]" text, "Game site" text, "Attendance" text, "Record" text )
What was the score on September 1, 1996?
SELECT "Result" FROM table_11214 WHERE "Date" = 'september 1, 1996'
wikisql
CREATE TABLE table_name_63 ( first_season_in_first_division VARCHAR, first_season_after_most_recent_promotion VARCHAR, name VARCHAR )
When was Alianza's first season in first division with a promotion after 1959?
SELECT first_season_in_first_division FROM table_name_63 WHERE first_season_after_most_recent_promotion = "1959" AND name = "alianza"
sql_create_context
CREATE TABLE table_80084 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real )
Who used Gordini Straight-6 in 1956?
SELECT "Entrant" FROM table_80084 WHERE "Engine" = 'gordini straight-6' AND "Year" = '1956'
wikisql
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 demographic ( subject_id text, hadm_id t...
how many patients were born before the year 2041 and had 3761 as their procedure icd9 code?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2041" AND procedures.icd9_code = "3761"
mimicsql_data
CREATE TABLE table_42688 ( "Spoofed Title" text, "Writer" text, "Artist" text, "Issue" real, "Date" text )
Who was the artist for Spoofed title Genteel Ben in an issue later than 74?
SELECT "Artist" FROM table_42688 WHERE "Issue" > '74' AND "Spoofed Title" = 'genteel ben'
wikisql
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 employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL v...
For all employees who have the letters D or S in their first name, visualize a scatter chart about the correlation between employee_id and salary .
SELECT EMPLOYEE_ID, SALARY FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
nvbench
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
provide the number of patients whose drug code is levo500pm?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "LEVO500PM"
mimicsql_data
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...
Questions by month per tag. Question count for a particular tag
SELECT TIME_TO_STR(p.CreationDate, '%Y') AS Year, TIME_TO_STR(p.CreationDate, '%m') AS Month, COUNT(*) AS questions FROM Posts AS p JOIN PostTags AS pt ON pt.PostId = p.Id JOIN Tags AS t ON t.Id = pt.TagId GROUP BY TIME_TO_STR(p.CreationDate, '%Y'), TIME_TO_STR(p.CreationDate, '%m') ORDER BY TIME_TO_STR(p.CreationDate,...
sede
CREATE TABLE table_71374 ( "Club" text, "Played" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Tries for" text, "Tries against" text, "Try bonus" text, "Losing bonus" text, "Points" text )
Name the played with lost of 5
SELECT "Played" FROM table_71374 WHERE "Lost" = '5'
wikisql
CREATE TABLE table_26544 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real )
What is the production code for episode number 86 in the series?
SELECT MIN("Production code") FROM table_26544 WHERE "No. in series" = '86'
wikisql
CREATE TABLE table_203_751 ( id number, "year" number, "title" text, "peak chart positions\nus\nair" number, "peak chart positions\nus\nmain" number, "peak chart positions\nus\nmod" number, "album" text )
which album had the most chart reaching singles ?
SELECT "album" FROM table_203_751 GROUP BY "album" ORDER BY COUNT(*) DESC LIMIT 1
squall
CREATE TABLE table_name_9 ( notes VARCHAR, date VARCHAR )
What is Notes, when Date is 2007?
SELECT notes FROM table_name_9 WHERE date = "2007"
sql_create_context
CREATE TABLE table_200_22 ( id number, "year" number, "single" text, "peak chart positions\nger" number, "peak chart positions\nire" number, "peak chart positions\nuk" number, "peak chart positions\nus" number, "peak chart positions\nus\nmain" number, "peak chart positions\nus\ndance...
on what album did the single old habits die hard appear ?
SELECT "year" FROM table_200_22 WHERE "single" = '"old habits die hard"'
squall
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE patients (...
tell me the length of the last stay of patient 12938 in the icu.
SELECT STRFTIME('%j', icustays.outtime) - STRFTIME('%j', icustays.intime) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12938) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1
mimic_iii
CREATE TABLE Settlements ( Settlement_ID INTEGER, Claim_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INTEGER, Amount_Settled INTEGER, Customer_Policy_ID INTEGER ) CREATE TABLE Customers ( Customer_ID INTEGER, Customer_Details VARCHAR(255) ) CREATE TABLE...
Please use a bar chart to show the total amount of payment by each payment method code, and rank by the Payment_Method_Code in ascending.
SELECT Payment_Method_Code, SUM(Amount_Payment) FROM Payments GROUP BY Payment_Method_Code ORDER BY Payment_Method_Code
nvbench
CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, ...
Would SAC 480 be easier than SAC 600 ?
SELECT COUNT(*) > 0 FROM course AS COURSE_0, course AS COURSE_1, program_course AS PROGRAM_COURSE_0, program_course AS PROGRAM_COURSE_1 WHERE COURSE_0.department = 'SAC' AND COURSE_0.number = 600 AND COURSE_1.department = 'SAC' AND COURSE_1.number = 480 AND PROGRAM_COURSE_0.course_id = COURSE_0.course_id AND PROGRAM_CO...
advising
CREATE TABLE table_41955 ( "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, "2008" text...
What is 2009, when 2008 is 1R, and when Tournament is French Open?
SELECT "2009" FROM table_41955 WHERE "2008" = '1r' AND "Tournament" = 'french open'
wikisql
CREATE TABLE table_2508633_11 ( college VARCHAR, nfl_team VARCHAR )
How many colleges have the NFL Team Buffalo Bills?
SELECT COUNT(college) FROM table_2508633_11 WHERE nfl_team = "Buffalo Bills"
sql_create_context
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
Return a bar chart about the distribution of ACC_Road and the sum of Team_ID , and group by attribute ACC_Road, list in desc by the Y please.
SELECT ACC_Road, SUM(Team_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY SUM(Team_ID) DESC
nvbench
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
5862783这个医疗机构从零五年八月四日到一零年十一月六日有过多少在转诊门诊的就诊记录
SELECT COUNT(*) FROM fzzmzjzjlb WHERE fzzmzjzjlb.YLJGDM = '5862783' AND fzzmzjzjlb.JZKSRQ BETWEEN '2005-08-04' AND '2010-11-06'
css
CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT ) CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER )
How many people are under 40 for each gender. Plot them as bar chart.
SELECT gender, COUNT(*) FROM Person WHERE age < 40 GROUP BY gender
nvbench
CREATE TABLE table_27533947_1 ( players VARCHAR, grand_average VARCHAR )
If the grand average is 12.76-202, who is the player?
SELECT players FROM table_27533947_1 WHERE grand_average = "12.76-202"
sql_create_context
CREATE TABLE manager_half ( player_id TEXT, year INTEGER, team_id TEXT, league_id TEXT, inseason INTEGER, half INTEGER, g INTEGER, w INTEGER, l INTEGER, rank INTEGER ) CREATE TABLE pitching ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_i...
bin the yearid into the day of the week interval and count them for visualizing a bar chart.
SELECT yearid, COUNT(yearid) FROM hall_of_fame
nvbench
CREATE TABLE table_name_7 ( team VARCHAR )
Who is the 2008 head coach of UCLA?
SELECT 2008 AS _head_coach FROM table_name_7 WHERE team = "ucla"
sql_create_context
CREATE TABLE table_21100348_11 ( player VARCHAR, runs VARCHAR )
What player has 477 runs?
SELECT player FROM table_21100348_11 WHERE runs = 477
sql_create_context
CREATE TABLE table_6460 ( "District" text, "2010 Population (000)" real, "2008 GDP (USD bn) a" real, "2008 GDP per capita (USD) a" real, "Agri culture b" real, "Mining b" real, "Manufac turing b" real, "Services & cons truction b" real, "Exports (USD mn) 2011" text, "Median mo. s...
Agri culture b larger than 12.6, what is the lowest vehicles per 1000?
SELECT MIN("Vehicles (per 1000) d") FROM table_6460 WHERE "Agri culture b" > '12.6'
wikisql
CREATE TABLE table_72853 ( "Game" real, "Date" text, "Opponent" text, "Score/Time" text, "High points" text, "High rebounds" text, "High assists" text, "Arena/Attendance" text, "Record" text )
name the date where score time is w 74-63
SELECT "Date" FROM table_72853 WHERE "Score/Time" = 'W 74-63'
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 (...
let me know the number of patients born before 1882 who had delta abnormal lab test status.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "1882" AND lab.flag = "delta"
mimicsql_data
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId ...
Top SO Users from Malaga.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%malaga%' OR UPPER(Location) LIKE '%MALAGA%' OR Location LIKE '%Malaga%' AND Reputation >= 1000 ORDER BY Reputation DESC
sede
CREATE TABLE table_name_45 ( rank INTEGER, population_density___km_2__ VARCHAR, _percentage_growth__2006_11_ VARCHAR )
What was the highest rank of an area with a population density larger than 5.7 and a 2006 2011 percentage growth of 5.7%?
SELECT MAX(rank) FROM table_name_45 WHERE population_density___km_2__ > 5.7 AND _percentage_growth__2006_11_ = "5.7%"
sql_create_context
CREATE TABLE table_26734 ( "Year" text, "Championship" text, "54 holes" text, "Winning score" text, "Margin" text, "Runner(s)-up" text )
In what tournament was the difference only 1 stroke and 54 holes with a 2 shot deficit?
SELECT "Championship" FROM table_26734 WHERE "Margin" = '1 stroke' AND "54 holes" = '2 shot deficit'
wikisql
CREATE TABLE table_name_27 ( score VARCHAR, date VARCHAR )
What was the score on January 12?
SELECT score FROM table_name_27 WHERE date = "january 12"
sql_create_context
CREATE TABLE table_72984 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Raiders points" real, "Opponents" real, "Raiders first downs" real, "Record" text, "Attendance" real )
Who was the game attended by 60425 people played against?
SELECT "Opponent" FROM table_72984 WHERE "Attendance" = '60425'
wikisql
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For each manufacturer, what are the names and prices of their most expensive product?, and order y axis in descending order.
SELECT T1.Name, MAX(T1.Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY MAX(T1.Price) DESC
nvbench
CREATE TABLE table_60136 ( "Name" text, "Position" text, "Height" text, "Weight" real, "Year" text, "Home Town" text )
What is the Year of the Player weighing 185?
SELECT "Year" FROM table_60136 WHERE "Weight" = '185'
wikisql
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe tex...
top 10 users: Tunisia.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%tunis%' ORDER BY Reputation DESC LIMIT 10
sede
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( ...
how many patients were tested since 3 years ago for sputum, expectorated?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT microlab.patientunitstayid FROM microlab WHERE microlab.culturesite = 'sputum, expectorated' AND DATETIME(microlab.culturetakentime) >= DATETIME(CURRENT_TIME(), '-3 year'))
eicu
CREATE TABLE table_train_78 ( "id" int, "mini_mental_state_examination_mmse" int, "consent" bool, "swallow_oral_medication" bool, "rosen_modified_hachinski_ischemic_score" int, "NOUSE" float )
subject must have a screening mini _ mental state examination score of 16 _ 26 .
SELECT * FROM table_train_78 WHERE mini_mental_state_examination_mmse >= 16 AND mini_mental_state_examination_mmse <= 26
criteria2sql
CREATE TABLE table_dev_6 ( "id" int, "gender" string, "systolic_blood_pressure_sbp" int, "heart_disease" bool, "renal_disease" bool, "hematocrit_hct" float, "creatinine_clearance_cl" float, "diastolic_blood_pressure_dbp" int, "symptomatic_coronary_artery_disease" bool, "hypertens...
uncontrolled hypertension ( resting blood pressure > 140 / 90 )
SELECT * FROM table_dev_6 WHERE hypertension = 1 OR systolic_blood_pressure_sbp > 140 OR diastolic_blood_pressure_dbp > 90
criteria2sql
CREATE TABLE table_9029 ( "Date" text, "Time" text, "ACC Team" text, "Big Ten Team" text, "Location" text, "Television" text, "Attendance" real, "Winner" text, "Challenge Leader" text )
Who is the challenge leader that played on 9:30 pm on Wed., Nov. 28?
SELECT "Challenge Leader" FROM table_9029 WHERE "Time" = '9:30 pm' AND "Date" = 'wed., nov. 28'
wikisql
CREATE TABLE table_34521 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
What was the 1st leg of the match that had an aggregate of 4-3?
SELECT "1st leg" FROM table_34521 WHERE "Agg." = '4-3'
wikisql
CREATE TABLE reservations ( code number, room text, checkin text, checkout text, rate number, lastname text, firstname text, adults number, kids number ) CREATE TABLE rooms ( roomid text, roomname text, beds number, bedtype text, maxoccupancy number, basepric...
Find the name of rooms whose price is higher than the average price.
SELECT roomname FROM rooms WHERE baseprice > (SELECT AVG(baseprice) FROM rooms)
spider
CREATE TABLE Events ( Event_ID INTEGER, Address_ID INTEGER, Channel_ID INTEGER, Event_Type_Code CHAR(15), Finance_ID INTEGER, Location_ID INTEGER ) CREATE TABLE Assets_in_Events ( Asset_ID INTEGER, Event_ID INTEGER ) CREATE TABLE Parties ( Party_ID INTEGER, Party_Details VARCHA...
Bar chart x axis product name y axis how many product name, rank by the the number of product name in ascending.
SELECT Product_Name, COUNT(Product_Name) FROM Products GROUP BY Product_Name ORDER BY COUNT(Product_Name)
nvbench
CREATE TABLE table_name_66 ( road_numbers VARCHAR, class VARCHAR )
what is the road numbers when the class is z-7?
SELECT road_numbers FROM table_name_66 WHERE class = "z-7"
sql_create_context
CREATE TABLE table_40100 ( "Position" real, "Team" text, "Points" real, "Played" real, "Drawn" real, "Lost" real, "Against" real, "Difference" text )
Which Position has an Against larger than 17, and a Team of juventus, and a Drawn smaller than 4?
SELECT MIN("Position") FROM table_40100 WHERE "Against" > '17' AND "Team" = 'juventus' AND "Drawn" < '4'
wikisql
CREATE TABLE table_43699 ( "Rank" real, "Date" text, "Attendance" real, "Opponent" text, "Texas Result" text )
Who was the opponent on September 26, 2009?
SELECT "Opponent" FROM table_43699 WHERE "Date" = 'september 26, 2009'
wikisql
CREATE TABLE table_67717 ( "Place" real, "Team" text, "Played" real, "Draw" real, "Lost" real, "Goals Scored" real, "Goals Conceded" real, "Points" real )
What is the total number of points when draw is 4?
SELECT COUNT("Points") FROM table_67717 WHERE "Draw" = '4'
wikisql
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE microbiologyeve...
since 2 years ago, how many patients with hpt c w/o hepat coma nos were diagnosed in the same month after being diagnosed with quadriplegia, unspecifd?
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime 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 = 'hpt c w/o hepat co...
mimic_iii
CREATE TABLE table_name_63 ( player VARCHAR, country VARCHAR )
What player is from France?
SELECT player FROM table_name_63 WHERE country = "france"
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...
tell me the number of patients with a diagnoses of full incontinence of feces who were admitted before the year 2154.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2154" AND diagnoses.short_title = "Full incontinence-feces"
mimicsql_data
CREATE TABLE table_204_160 ( id number, "rank" number, "name" text, "nationality" text, "time" text, "notes" text )
how many canadian swimmers were there ?
SELECT COUNT("name") FROM table_204_160 WHERE "nationality" = 'canada'
squall
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TAB...
count the number of times that patient 004-64091 when they visited the hospital last time underwent a palliative care consultation procedure.
SELECT COUNT(*) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-64091' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospit...
eicu
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE chart...
has a microbiological test been carried out this year for patient 14621?
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14621) AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
mimic_iii
CREATE TABLE table_name_78 ( year VARCHAR, host_city VARCHAR, hosts VARCHAR )
What year will Bangkok be the host city and Alicia Keys host?
SELECT year FROM table_name_78 WHERE host_city = "bangkok" AND hosts = "alicia keys"
sql_create_context
CREATE TABLE table_203_583 ( id number, "title" text, "release" number, "6th gen" text, "handheld" text, "note" text )
how many more games were released in 2005 than 2003 ?
SELECT (SELECT COUNT("title") FROM table_203_583 WHERE "release" = 2005) - (SELECT COUNT("title") FROM table_203_583 WHERE "release" = 2003)
squall
CREATE TABLE table_17995 ( "Year" real, "Competition" text, "Location" text, "Event" text, "Final-Rank" text, "Final-Score" text, "Qualifying Rank" real, "Qualifying Score" text )
what is the highest qualifying rank where the competition is olympic trials, the final-rank is 4 and qualifying score is 15.100?
SELECT MAX("Qualifying Rank") FROM table_17995 WHERE "Competition" = 'Olympic Trials' AND "Final-Rank" = '4' AND "Qualifying Score" = '15.100'
wikisql
CREATE TABLE table_75806 ( "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real )
What is the highest number listed under against when there were 15 losses and more than 1 win?
SELECT MAX("Against") FROM table_75806 WHERE "Losses" = '15' AND "Wins" > '1'
wikisql
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE c...
how many hours have elapsed since the first time patient 808 stayed in careunit sicu in this hospital encounter?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 808 AND admissions.dischtime IS NULL) AND transfers.careunit = 'sicu' ORDER BY transfers.intime LIMIT 1
mimic_iii
CREATE TABLE table_name_13 ( draw INTEGER, points VARCHAR, goals_conceded VARCHAR )
Name the the highest Draw which has Points of 22 and Goals Conceded smaller than 26?
SELECT MAX(draw) FROM table_name_13 WHERE points = "22" AND goals_conceded < 26
sql_create_context
CREATE TABLE table_204_175 ( id number, "pos" text, "no." number, "driver" text, "team" text, "laps" number, "time/retired" text, "grid" number, "laps led" number, "points" number )
who raced the fastest ?
SELECT "driver" FROM table_204_175 ORDER BY "pos" LIMIT 1
squall
CREATE TABLE table_1724 ( "Player" text, "League" real, "Scottish Cup" real, "League Cup" real, "Challenge Cup" real, "Total" real )
Name the most challenge cup for damon gray
SELECT MAX("Challenge Cup") FROM table_1724 WHERE "Player" = 'Damon Gray'
wikisql
CREATE TABLE district ( District_ID int, District_name text, Headquartered_City text, City_Population real, City_Area real ) CREATE TABLE store ( Store_ID int, Store_Name text, Type text, Area_size real, Number_of_product_category real, Ranking int ) CREATE TABLE store_prod...
Find all types of store and number of them. Show the proportion.
SELECT Type, COUNT(*) FROM store GROUP BY Type
nvbench
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugsto...
was the urinary specific gravity value of patient 022-82169 last measured on the last hospital visit less than that first measured on the last hospital visit?
SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-82169' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi...
eicu
CREATE TABLE table_53991 ( "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text )
Who wrote the episode that has the production code ad1c05?
SELECT "Written by" FROM table_53991 WHERE "Production code" = 'ad1c05'
wikisql
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
provide the number of patients whose discharge location is home health care and procedure short title is hemodialysis?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "HOME HEALTH CARE" AND procedures.short_title = "Hemodialysis"
mimicsql_data
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 (...
what is the number of patients whose primary disease is s/p fall and lab test abnormal status is delta?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "S/P FALL" AND lab.flag = "delta"
mimicsql_data
CREATE TABLE table_203_621 ( id number, "player" text, "games played" number, "minutes played" number, "minutes played per game" number, "rebounds" number, "rebounds per game" number, "assists" number, "assists per game" number, "field goal %" number, "free throw %" number, ...
give the number of players covered by the table .
SELECT COUNT("player") FROM table_203_621
squall
CREATE TABLE table_name_60 ( mountains_classification VARCHAR, winner VARCHAR, general_classification VARCHAR )
What is the mountain classification of Mario Cipollini, who has a general classification of Pavel tonkov?
SELECT mountains_classification FROM table_name_60 WHERE winner = "mario cipollini" AND general_classification = "pavel tonkov"
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...
在医院5882181中患者59383313就诊科室名称包含复工的所有医疗就诊记录都是啥呀?
SELECT * FROM qtb WHERE qtb.PERSON_ID = '59383313' AND qtb.MED_SER_ORG_NO = '5882181' AND qtb.MED_ORG_DEPT_NM LIKE '%复工%' UNION SELECT * FROM gyb WHERE gyb.PERSON_ID = '59383313' AND gyb.MED_SER_ORG_NO = '5882181' AND gyb.MED_ORG_DEPT_NM LIKE '%复工%' UNION SELECT * FROM zyb WHERE zyb.PERSON_ID = '59383313' AND zyb.MED_S...
css
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 minimum days of hospital stay of patients whose year of birth is greater than 2065?
SELECT MIN(demographic.days_stay) FROM demographic WHERE demographic.dob_year > "2065"
mimicsql_data
CREATE TABLE table_29207 ( "Model" text, "Speed (GHz)" text, "L2 Cache (MB)" real, "L3 Cache (MB)" real, "FSB (MHz)" real, "TDP (W)" real )
How many different FSB are there for the 7140N model?
SELECT COUNT("FSB (MHz)") FROM table_29207 WHERE "Model" = '7140N'
wikisql
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
医疗就诊39443182794可以在哪天出院
SELECT OUT_HOSP_DATE FROM t_kc21 WHERE MED_CLINIC_ID = '39443182794'
css
CREATE TABLE table_4093 ( "Country" text, "Area (km 2 )" real, "Population(2012)" real, "Density (/km 2 )" real, "GDP (nominal), USD (2012)" text, "GDP (nominal) per capita, USD (2012)" text, "HDI (2012)" text, "Capital" text )
How few km 2 does the area with Nay Pyi Taw as capital cover?
SELECT MIN("Area (km 2 )") FROM table_4093 WHERE "Capital" = 'Nay Pyi Taw'
wikisql
CREATE TABLE match_result ( Rank int, Club_ID int, Gold int, Big_Silver int, Small_Silver int, Bronze int, Points int ) CREATE TABLE club ( Club_ID int, Club_name text, Region text, Start_year int ) CREATE TABLE player_coach ( Player_ID int, Coach_ID int, Starti...
Show different occupations along with the number of players in each occupation Show bar chart, and show y-axis from high to low order.
SELECT Occupation, COUNT(*) FROM player GROUP BY Occupation ORDER BY COUNT(*) DESC
nvbench