context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_22839669_1 ( year INTEGER, score_in_the_final VARCHAR )
What is the most recent year where the final score is 4 6, 3 6, 6 4, 5 7?
SELECT MAX(year) FROM table_22839669_1 WHERE score_in_the_final = "4–6, 3–6, 6–4, 5–7"
sql_create_context
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
how many patients whose primary disease is gangrene?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "GANGRENE"
mimicsql_data
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE vitalperiodic ( ...
how many days have elapsed since the first time patient 006-133605 had an intake of iv/ivpb: on the current icu visit?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', intakeoutput.intakeoutputtime)) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid =...
eicu
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE procedures_icd ( row_id number, su...
what were the three most common lab tests performed since 2 years ago for patients aged 60 or above?
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t1.itemid FROM (SELECT labevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age >= 60) AND DATETIME(labevents.charttime) >= DATET...
mimic_iii
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 TABLE PostFeedback ( Id number, PostId number, IsAnon...
Number of questions concerning xamarin development.
SELECT COUNT(*) FROM Posts WHERE Id IN (SELECT DISTINCT (PostId) FROM PostTags WHERE TagId IN (SELECT Id FROM Tags WHERE TagName LIKE '%xamarin%'))
sede
CREATE TABLE table_47738 ( "Position" real, "Club" text, "Played" real, "Points" real, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real )
What is the minimum position when points are 32 and wins are greater than 13?
SELECT MIN("Position") FROM table_47738 WHERE "Points" = '32' AND "Wins" > '13'
wikisql
CREATE TABLE table_38763 ( "The Kennel Club (UK) Toy Group" text, "Canadian Kennel Club Toy Dogs Group" text, "American Kennel Club Toy Group" text, "Australian National Kennel Council Toy Dogs Group" text, "New Zealand Kennel Club Toy Group" text )
What is the Kennel Club (UK) Toy Group with the shih-tzu as the American Kennel Club Toy Group breed?
SELECT "The Kennel Club (UK) Toy Group" FROM table_38763 WHERE "American Kennel Club Toy Group" = 'shih-tzu'
wikisql
CREATE TABLE table_203_788 ( id number, "year" number, "author" text, "illustrator" text, "title" text, "publisher" text )
what are the number of kurt maschler awards helen oxenbury has won ?
SELECT COUNT(*) FROM table_203_788 WHERE "illustrator" = 'helen oxenbury'
squall
CREATE TABLE table_21330550_2 ( winner VARCHAR, challenge_leader VARCHAR )
Who is the winner when bigten (2-1) is the challenge leader?
SELECT winner FROM table_21330550_2 WHERE challenge_leader = "BigTen (2-1)"
sql_create_context
CREATE TABLE mzjybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH number, 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, ...
查一下在医疗就诊98195604452中给病人金德水做检验的科室名称和编码
SELECT zyjybgb.JYKSBM, zyjybgb.JYKSMC FROM zyjybgb WHERE zyjybgb.JZLSH = '98195604452' UNION SELECT mzjybgb.JYKSBM, mzjybgb.JYKSMC FROM mzjybgb WHERE mzjybgb.JZLSH = '98195604452'
css
CREATE TABLE table_1342359_17 ( district VARCHAR, first_elected VARCHAR )
how many people won in 1914
SELECT COUNT(district) FROM table_1342359_17 WHERE first_elected = 1914
sql_create_context
CREATE TABLE table_71895 ( "Episode" text, "First aired" text, "Entrepreneur(s)" text, "Company or product name" text, "Money requested (\u00a3)" text, "Investing Dragon(s)" text )
What Episode did Entrepreneur(s) Luke Booth and Christopher Eves take part?
SELECT "Episode" FROM table_71895 WHERE "Entrepreneur(s)" = 'luke booth and christopher eves'
wikisql
CREATE TABLE table_36851 ( "Result" text, "Date" text, "Race" text, "Venue" text, "Group" text, "Distance" text, "Weight (kg)" real, "Time" text, "Jockey" text, "Winner/2nd" text )
Which jockey had a group of G3?
SELECT "Jockey" FROM table_36851 WHERE "Group" = 'g3'
wikisql
CREATE TABLE Apartment_Bookings ( apt_booking_id INTEGER, apt_id INTEGER, guest_id INTEGER, booking_status_code CHAR(15), booking_start_date DATETIME, booking_end_date DATETIME ) CREATE TABLE Apartments ( apt_id INTEGER, building_id INTEGER, apt_type_code CHAR(15), apt_number CH...
What are the number of the facility codes of the apartments with more than four bedrooms?, and order by the total number in ascending please.
SELECT facility_code, COUNT(facility_code) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4 GROUP BY facility_code ORDER BY COUNT(facility_code)
nvbench
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text te...
Closed questions that need to be deleted.
SELECT CAST(DATEDIFF(DAY, ClosedDate, GETDATE()) AS FLOAT) AS Days, Posts.Title AS Title, 'https://stackoverflow.com/q/' + LTRIM(Posts.Id) AS url, Posts.Score AS Score FROM Posts WHERE CAST(DATEDIFF(DAY, ClosedDate, GETDATE()) AS FLOAT) != 0 AND Posts.Score <= '##Score##' ORDER BY -(CAST(DATEDIFF(DAY, ClosedDate, GETDA...
sede
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...
Among patients with icd9 code 4341, calculate the number of those who died in or before the year 2115.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2115.0" AND procedures.icd9_code = "4341"
mimicsql_data
CREATE TABLE table_66239 ( "State (class)" text, "Vacator" text, "Reason for change" text, "Successor" text, "Date of successor's formal installation" text )
Which date of Date of successor's formal installation has a State (class) of michigan (2)?
SELECT "Date of successor's formal installation" FROM table_66239 WHERE "State (class)" = 'michigan (2)'
wikisql
CREATE TABLE table_65657 ( "Game" text, "Date" text, "Opponent" text, "Score" text, "Location/Attendance" text, "Record" text )
What was the record on January 17?
SELECT "Record" FROM table_65657 WHERE "Date" = 'january 17'
wikisql
CREATE TABLE country ( country_id number, country_name text, capital text, official_native_language text ) CREATE TABLE team ( team_id number, name text ) CREATE TABLE player ( player_id number, player text, years_played text, total_wl text, singles_wl text, doubles_wl ...
Return the colleges that have players who play the Midfielder position, as well as players who play the Defender position.
SELECT college FROM match_season WHERE position = "Midfielder" INTERSECT SELECT college FROM match_season WHERE position = "Defender"
spider
CREATE TABLE table_name_98 ( champion VARCHAR )
what team was the 1st leg champion of sakalai
SELECT 1 AS st_leg FROM table_name_98 WHERE champion = "sakalai"
sql_create_context
CREATE TABLE Video_Games ( GameID INTEGER, GName VARCHAR(40), GType VARCHAR(40) ) CREATE TABLE Plays_Games ( StuID INTEGER, GameID INTEGER, Hours_Played INTEGER ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Ma...
Show me a scatter plot of major and the average of age for .
SELECT Major, AVG(Age) FROM Student GROUP BY Major
nvbench
CREATE TABLE table_name_2 ( rank INTEGER, country VARCHAR, total VARCHAR )
What is the lowest Rank of Denmark County with a Total smaller than 1?
SELECT MIN(rank) FROM table_name_2 WHERE country = "denmark" AND total < 1
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
what is the number of patients whose insurance is private and procedure icd9 code is 5059?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.icd9_code = "5059"
mimicsql_data
CREATE TABLE table_36030 ( "Team" text, "Location" text, "Venue" text, "Capacity" real, "Position in 2001" text )
what is the venue of neman
SELECT "Venue" FROM table_36030 WHERE "Team" = 'neman'
wikisql
CREATE TABLE table_name_47 ( home_team VARCHAR, venue VARCHAR )
When the Venue is mcg what is the Home team?
SELECT home_team FROM table_name_47 WHERE venue = "mcg"
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...
患者57086830出院诊断疾病名称包括瘙痒症的在病院1629085的医疗就诊记录号码是什么?
SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_ID = '57086830' AND gwyjzb.MED_SER_ORG_NO = '1629085' AND gwyjzb.OUT_DIAG_DIS_NM LIKE '%瘙痒症%' UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_ID = '57086830' AND fgwyjzb.MED_SER_ORG_NO = '1629085' AND fgwyjzb.OUT_DIAG_DIS_NM LIKE '%瘙痒症%'
css
CREATE TABLE table_63616 ( "Season" text, "Competition" text, "Round" text, "Opposition" text, "Score" text )
What is the Opposition in the First Round of the UEFA Cup with a Score of 3 1 (h), 2 0 (a)?
SELECT "Opposition" FROM table_63616 WHERE "Round" = 'first round' AND "Competition" = 'uefa cup' AND "Score" = '3–1 (h), 2–0 (a)'
wikisql
CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Participates_in ( stuid INTEGER, actid INTEGER ) CREATE TABLE Activity ( actid INTEGER, activity_...
Visualize a bar chart for how many male and female assistant professors do we have?
SELECT Sex, COUNT(*) FROM Faculty WHERE Rank = "AsstProf" GROUP BY Sex
nvbench
CREATE TABLE table_66085 ( "Frequency" text, "Call sign" text, "Branding" text, "Format" text, "Owner" text )
What is the branding for cbxp-fm?
SELECT "Branding" FROM table_66085 WHERE "Call sign" = 'cbxp-fm'
wikisql
CREATE TABLE table_name_40 ( rank INTEGER, nation VARCHAR, bronze VARCHAR )
What is the lowest Rank, when Nation is Great Britain, and when Bronze is less than 1?
SELECT MIN(rank) FROM table_name_40 WHERE nation = "great britain" AND bronze < 1
sql_create_context
CREATE TABLE table_name_76 ( nation VARCHAR, model VARCHAR )
What is Nation, when Model is M1895 & M1897 Carbine?
SELECT nation FROM table_name_76 WHERE model = "m1895 & m1897 carbine"
sql_create_context
CREATE TABLE table_77351 ( "Name" text, "GP-GS" text, "Effic" real, "Cmp-Att-Int" text, "Avg/G" real )
What is the avg/g of Rhines, Chris, who has an effic greater than 73.95?
SELECT "Avg/G" FROM table_77351 WHERE "Effic" > '73.95' AND "Name" = 'rhines, chris'
wikisql
CREATE TABLE table_name_58 ( college_junior_club_team__league_ VARCHAR, nationality VARCHAR )
Which College/junior/club team (league) was the player from Switzerland from?
SELECT college_junior_club_team__league_ FROM table_name_58 WHERE nationality = "switzerland"
sql_create_context
CREATE TABLE table_name_29 ( country VARCHAR, killed VARCHAR, year VARCHAR )
What coutry had a rampaged killing 14 in 1965?
SELECT country FROM table_name_29 WHERE killed = "14" AND year = 1965
sql_create_context
CREATE TABLE table_45250 ( "Name" text, "Country" text, "Birth Date" text, "Date" real, "Earned" text, "Peak rating (Nov 2012)" real )
What country was the woman from who was born 1976-07-23 and became a grandmaster in 1991?
SELECT "Country" FROM table_45250 WHERE "Date" = '1991' AND "Birth Date" = '1976-07-23'
wikisql
CREATE TABLE table_32864 ( "Club" text, "Played" real, "Lost" real, "Drawn" real, "Against" real, "Diff." real, "Points" real )
What is the average diff when games played are more than 6?
SELECT AVG("Diff.") FROM table_32864 WHERE "Played" > '6'
wikisql
CREATE TABLE table_16922657_2 ( Ends VARCHAR, country VARCHAR, Scotland VARCHAR )
When the country was Scotland, how many ends were won?
SELECT COUNT(Ends) AS won FROM table_16922657_2 WHERE country = Scotland
sql_create_context
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, ...
tell me the average sao2 in patient 5866?
SELECT AVG(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5866)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sao2'...
mimic_iii
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE prescriptions ( ...
how many patients died within 2 months after being diagnosed until 4 years ago with alkalosis?
SELECT COUNT(DISTINCT t2.subject_id) FROM (SELECT t1.subject_id, t1.charttime 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_di...
mimic_iii
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperio...
what was patient 021-35326's minimum sao2, until 03/01/2105?
SELECT MIN(vitalperiodic.sao2) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-35326')) AND NOT vitalperiodic.sao2 IS NULL AND STRFT...
eicu
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 d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE cost ( row_id...
have patient 13536 had any br milk fs ng intake in 05/this year?
SELECT COUNT(*) > 0 FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13536)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'br milk ...
mimic_iii
CREATE TABLE table_16868 ( "Player" text, "No." real, "Nationality" text, "Position" text, "Years for Jazz" text, "School/Club Team" text )
What's Jim Farmer's nationality?
SELECT "Nationality" FROM table_16868 WHERE "Player" = 'Jim Farmer'
wikisql
CREATE TABLE table_4655 ( "Date" text, "Epicenter" text, "Magnitude" text, "Fatalities" real, "Name" text )
What is the average number of deaths for earthquakes centered in Damghan?
SELECT AVG("Fatalities") FROM table_4655 WHERE "Epicenter" = 'damghan'
wikisql
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) ...
give me the top three most common diagnoses for patients with an age of 40s this year?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN...
mimic_iii
CREATE TABLE table_name_96 ( position VARCHAR, name VARCHAR, win_loss VARCHAR, spread VARCHAR, country VARCHAR )
What position has a spread greater than -319, and United States as the country, a win loss of 11-13, and gabriel, marty as the name?
SELECT position FROM table_name_96 WHERE spread > -319 AND country = "united states" AND win_loss = "11-13" AND name = "gabriel, marty"
sql_create_context
CREATE TABLE table_name_24 ( date VARCHAR, record VARCHAR )
What is the date of the match with a 28-15 record?
SELECT date FROM table_name_24 WHERE record = "28-15"
sql_create_context
CREATE TABLE table_name_75 ( aircraft VARCHAR, tail_number VARCHAR )
What type of aircraft was the plane with a tail number of ya-bao?
SELECT aircraft FROM table_name_75 WHERE tail_number = "ya-bao"
sql_create_context
CREATE TABLE table_name_91 ( nation VARCHAR, sail VARCHAR )
Which Nation has the USA-18 sail?
SELECT nation FROM table_name_91 WHERE sail = "usa-18"
sql_create_context
CREATE TABLE table_name_16 ( away_team VARCHAR, home_team VARCHAR )
What away team is the home team richmond?
SELECT away_team FROM table_name_16 WHERE home_team = "richmond"
sql_create_context
CREATE TABLE table_name_59 ( winning_driver VARCHAR, circuit VARCHAR )
Name the winning driver with circuit of monza
SELECT winning_driver FROM table_name_59 WHERE circuit = "monza"
sql_create_context
CREATE TABLE table_name_67 ( tournament VARCHAR )
What is 2000, when Tournament is 'Canada Masters'?
SELECT 2000 FROM table_name_67 WHERE tournament = "canada masters"
sql_create_context
CREATE TABLE table_65579 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location/Attendance" text, "Series" text )
what is the score for game 4?
SELECT "Score" FROM table_65579 WHERE "Game" = '4'
wikisql
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
Number of Rust questions per month.
SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0) AS "month", COUNT(DISTINCT Posts.Id) AS Count FROM Posts INNER JOIN PostTags ON PostTags.PostId = Posts.Id INNER JOIN Tags ON PostTags.TagId = Tags.Id WHERE Tags.TagName LIKE '%rust%' AND PostTypeId = 1 GROUP BY DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), ...
sede
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
provide the number of patients whose admission location is clinic referral/premature and diagnoses long title is acidosis?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND diagnoses.long_title = "Acidosis"
mimicsql_data
CREATE TABLE table_1708014_1 ( poles VARCHAR, team_s_ VARCHAR )
How many poles did team #14 ginn racing have?
SELECT poles FROM table_1708014_1 WHERE team_s_ = "#14 Ginn Racing"
sql_create_context
CREATE TABLE services ( service_id number, service_name text ) CREATE TABLE settlements ( settlement_id number, claim_id number, effective_date time, settlement_amount number ) CREATE TABLE claims ( claim_id number, fnol_id number, effective_date time ) CREATE TABLE available_poli...
Count the total number of available services.
SELECT COUNT(*) FROM services
spider
CREATE TABLE Customers ( Customer_ID VARCHAR(100), Address_ID INTEGER, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Marketing_Regions ( Marketing_Region_Code CHAR(15), Marketing_Region_Name VARCHA...
Show all the actual delivery dates and bin by weekday in a bar chart, and sort in desc by the y-axis please.
SELECT Actual_Delivery_Date, COUNT(Actual_Delivery_Date) FROM Bookings ORDER BY COUNT(Actual_Delivery_Date) DESC
nvbench
CREATE TABLE table_name_25 ( tournament VARCHAR )
What is 2009, when 2008 is 'A', when 2011 is 'A', and when Tournament is 'Paris Masters'?
SELECT 2009 FROM table_name_25 WHERE 2008 = "a" AND 2011 = "a" AND tournament = "paris masters"
sql_create_context
CREATE TABLE table_10467 ( "Independent" text, "Lost" real, "Tied" real, "Pct." real, "Years" real, "Total Games" real )
What is the highest number lost when the number tied is more than 42, the years are less than 132, and the PCT is less than 0.5729000000000001?
SELECT MAX("Lost") FROM table_10467 WHERE "Tied" > '42' AND "Years" < '132' AND "Pct." < '0.5729000000000001'
wikisql
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 )
Give me a bar chart to show the names and revenue of the company that earns the highest revenue in each headquarter city.
SELECT Name, MAX(Revenue) FROM Manufacturers GROUP BY Headquarter
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
give me the number of patients whose ethnicity is asian and year of death is less than or equal to 2148?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "ASIAN" AND demographic.dod_year <= "2148.0"
mimicsql_data
CREATE TABLE table_75288 ( "Series Ep." text, "Episode" real, "Netflix" text, "Segment A" text, "Segment B" text, "Segment C" text, "Segment D" text )
What is the segment A name, having a Netflix of s01e12?
SELECT "Segment A" FROM table_75288 WHERE "Netflix" = 's01e12'
wikisql
CREATE TABLE table_45251 ( "Position" real, "Team" text, "Played" real, "Wins" real, "Draws" real, "Losses" real, "Scored" real, "Conceded" real, "Bonus Points" text, "Points" real )
Name the Points which has a Team of sportivo luque o, and Wins larger than 1?
SELECT MIN("Points") FROM table_45251 WHERE "Team" = 'sportivo luqueño' AND "Wins" > '1'
wikisql
CREATE TABLE editor ( Editor_ID int, Name text, Age real ) CREATE TABLE journal_committee ( Editor_ID int, Journal_ID int, Work_Type text ) CREATE TABLE journal ( Journal_ID int, Date text, Theme text, Sales int )
Group and count the name attribute for visualizing a bar chart.
SELECT Name, COUNT(Name) FROM editor GROUP BY Name
nvbench
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime tim...
when did patient 49654 last have a microbiological test in 07/this year?
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 49654) AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', microbiolo...
mimic_iii
CREATE TABLE fgwyjzb ( 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, ...
42924157患者从2004年8月9日至2009年2月15日之内最常去哪家医院?
SELECT gwyjzb.MED_SER_ORG_NO FROM gwyjzb WHERE gwyjzb.PERSON_ID = '42924157' AND gwyjzb.IN_HOSP_DATE BETWEEN '2004-08-09' AND '2009-02-15' GROUP BY gwyjzb.MED_SER_ORG_NO ORDER BY COUNT(*) DESC LIMIT 1 UNION SELECT fgwyjzb.MED_SER_ORG_NO FROM fgwyjzb WHERE fgwyjzb.PERSON_ID = '42924157' AND fgwyjzb.IN_HOSP_DATE BETWEEN ...
css
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airlin...
show me all flights from PITTSBURGH to SAN FRANCISCO
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 = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN...
atis
CREATE TABLE table_name_11 ( total INTEGER, rank VARCHAR, gold VARCHAR, silver VARCHAR )
What is the sum of Total for 0 gold and less than 2, silver with a rank of 6?
SELECT SUM(total) FROM table_name_11 WHERE gold = 0 AND silver < 2 AND rank = "6"
sql_create_context
CREATE TABLE table_name_20 ( game_site VARCHAR, week VARCHAR )
What is the Game site week 1?
SELECT game_site FROM table_name_20 WHERE week = 1
sql_create_context
CREATE TABLE table_203_305 ( id number, "round" number, "#" number, "player" text, "nationality" text, "college/junior/club team (league)" text )
how many canadian players are listed ?
SELECT COUNT("player") FROM table_203_305 WHERE "nationality" = 'canada'
squall
CREATE TABLE table_16729 ( "Rnd" real, "Race" text, "Date" text, "Location" text, "Pole Position" text, "Fastest Lap" text, "Race Winner" text, "Constructor" text, "Report" text )
Who was the constructor in the location Monza?
SELECT "Constructor" FROM table_16729 WHERE "Location" = 'Monza'
wikisql
CREATE TABLE table_78074 ( "Subframe #" real, "Page #" text, "Name" text, "Word #" real, "Bits" text )
What is the word count that is named omega dot?
SELECT "Word #" FROM table_78074 WHERE "Name" = 'omega dot'
wikisql
CREATE TABLE table_22633 ( "Model number" text, "sSpec number" text, "Frequency" text, "Turbo" text, "Cores" real, "L2 cache" text, "L3 cache" text, "I/O bus" text, "Mult." text, "Memory" text, "Voltage" text, "TDP" text, "Socket" text, "Release date" text, "P...
When by80607002907ahbx80607i7720qm is the part number what is the socket?
SELECT "Socket" FROM table_22633 WHERE "Part number(s)" = 'BY80607002907AHBX80607I7720QM'
wikisql
CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConce...
Duplicate questions asked by someone who answered the original.
SELECT orgs.Id AS "post_link", orgs.Id, orgs.Title AS "titulo_original", dupes.Id AS "post_link", dupes.Id, dupes.Title AS "titulo_duplicado" FROM Posts AS orgs JOIN PostLinks AS links ON (orgs.Id = links.RelatedPostId AND LinkTypeId = 3) JOIN Posts AS dupes ON (dupes.Id = links.PostId AND dupes.PostTypeId = 1) WHERE o...
sede
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_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...
编号为34880372495的医疗就诊中的个人自理金是多少
SELECT t_kc24.PER_SOL FROM t_kc24 JOIN t_kc21_t_kc24 JOIN t_kc21 ON t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID AND t_kc21_t_kc24.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc21.MED_CLINIC_ID = '34880372495'
css
CREATE TABLE txmzjzjlb ( 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...
在门诊就诊中开出的检验报告单编号是18617943504对应的患者姓名可以告诉我吗?
SELECT person_info.XM FROM person_info JOIN hz_info JOIN txmzjzjlb JOIN jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE jybgb.BGDH = '1...
css
CREATE TABLE table_64409 ( "Rank" real, "Lane" real, "Name" text, "Nationality" text, "Time" text )
Can you tell me the Name that has the Rank of 4?
SELECT "Name" FROM table_64409 WHERE "Rank" = '4'
wikisql
CREATE TABLE table_name_7 ( wins INTEGER, losses VARCHAR, against VARCHAR )
How many wins when there are 4 losses and against are fewer than 1281?
SELECT AVG(wins) FROM table_name_7 WHERE losses = 4 AND against < 1281
sql_create_context
CREATE TABLE person_info ( RYBH text, XBDM number, XBMC text, XM text, CSRQ time, CSD text, MZDM text, MZMC text, GJDM text, GJMC text, JGDM text, JGMC text, XLDM text, XLMC text, ZYLBDM text, ZYMC text ) CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGD...
查一下病人韦德润在1777463这家医院门诊被诊断出的病情不含有失眠的就诊记录
SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb 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 WHERE person_info.XM = '韦德润' AND hz_info.YLJGDM = '1777463' AND NOT mzjzjlb.JZZDSM LIKE '%失眠%'
css
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE labevents ( row_id number, subject_id number, ...
has patient 97733 been diagnosed with rotator cuff synd nos since 2105.
SELECT COUNT(*) > 0 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'rotator cuff synd nos') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 97733) AND STRFTIME('%y', diagn...
mimic_iii
CREATE TABLE table_name_53 ( catalogue VARCHAR, region VARCHAR )
Name the catalogue for australia
SELECT catalogue FROM table_name_53 WHERE region = "australia"
sql_create_context
CREATE TABLE table_19242_5 ( _km² VARCHAR, of_which_currently_forests INTEGER, land_formation VARCHAR )
When middle prut valley is the land formation what is the highest of which currently forests, km ?
SELECT MAX(of_which_currently_forests), _km² FROM table_19242_5 WHERE land_formation = "Middle Prut Valley"
sql_create_context
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 the number of asian ethnic background patients who were admitted in hospital before the year 2112?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "ASIAN" AND demographic.admityear < "2112"
mimicsql_data
CREATE TABLE table_name_46 ( country VARCHAR, year_s__won VARCHAR )
What country won in 1977?
SELECT country FROM table_name_46 WHERE year_s__won = "1977"
sql_create_context
CREATE TABLE person_info ( RYBH text, XBDM number, XBMC text, XM text, CSRQ time, CSD text, MZDM text, MZMC text, GJDM text, GJMC text, JGDM text, JGMC text, XLDM text, XLMC text, ZYLBDM text, ZYMC text ) CREATE TABLE hz_info ( KH text, KLX number...
把检测指标名称与检测指标结果定量单位跟检验指标记录99657546229一样,而且检测指标结果定量不等于其的检验指标记录列出来
SELECT * FROM jyjgzbb WHERE JCZBMC = (SELECT JCZBMC FROM jyjgzbb WHERE JYZBLSH = '99657546229') AND JCZBJGDW = (SELECT JCZBJGDW FROM jyjgzbb WHERE JYZBLSH = '99657546229') AND JCZBJGDL <> (SELECT JCZBJGDL FROM jyjgzbb WHERE JYZBLSH = '99657546229')
css
CREATE TABLE list ( lastname text, firstname text, grade number, classroom number ) CREATE TABLE teachers ( lastname text, firstname text, classroom number )
How many students are taught by teacher TARRING LEIA?
SELECT COUNT(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "TARRING" AND T2.lastname = "LEIA"
spider
CREATE TABLE table_34579 ( "Position" text, "Artist" text, "Single" text, "Year" text, "Weeks" text )
what is the single of the queen
SELECT "Single" FROM table_34579 WHERE "Artist" = 'queen'
wikisql
CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int ) CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text )
What is the total number of different nationalities of all ships? Give me a bar graph, list X-axis in desc order.
SELECT Nationality, COUNT(Nationality) FROM ship GROUP BY Nationality ORDER BY Nationality DESC
nvbench
CREATE TABLE table_19272 ( "Player" text, "Position" text, "Starter" text, "Touchdowns" real, "Extra points" real, "Field goals" real, "Points" real )
Name the number of points for right halfback and starter being yes
SELECT COUNT("Points") FROM table_19272 WHERE "Position" = 'Right halfback' AND "Starter" = 'yes'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE txmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, K...
在00年10月14日到2011年2月11日期间为病患谢芳蕙执行检测指标607066的医务人员的工号还有姓名是什么?
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM person_info JOIN hz_info JOIN txmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZ...
css
CREATE TABLE table_name_10 ( class VARCHAR, type VARCHAR )
What is the class of the a1 bm type?
SELECT class FROM table_name_10 WHERE type = "a1 bm"
sql_create_context
CREATE TABLE table_34064 ( "Name" text, "Years" text, "Seasons" real, "Lost" real, "Pct." real )
What's the average pct for George Felton when he had losses greater than 7?
SELECT AVG("Pct.") FROM table_34064 WHERE "Lost" > '7' AND "Name" = 'george felton'
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 prescriptions...
How many patients of hispanic, or latino-puerto rican ethnicity had colonoscopy?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND procedures.long_title = "Colonoscopy"
mimicsql_data
CREATE TABLE table_46534 ( "Round" real, "Pick" real, "Overall" real, "Name" text, "Position" text, "College" text )
WHAT IS THE SUM OF PICK WITH AN OVERALL LARGER THAN 250, AND FOR FLORIDA COLLEGE?
SELECT SUM("Pick") FROM table_46534 WHERE "Overall" > '250' AND "College" = 'florida'
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...
Give me a pie to show how many sex from different sex.
SELECT Sex, COUNT(Sex) FROM people GROUP BY Sex
nvbench
CREATE TABLE table_75700 ( "Ballarat FL" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real )
How many Against has Byes smaller than 2?
SELECT AVG("Against") FROM table_75700 WHERE "Byes" < '2'
wikisql
CREATE TABLE table_name_44 ( week VARCHAR, tv_time VARCHAR, attendance VARCHAR )
Which Week has a TV Time of cbs 1:00pm, and an Attendance of 72,714?
SELECT week FROM table_name_44 WHERE tv_time = "cbs 1:00pm" AND attendance = "72,714"
sql_create_context
CREATE TABLE appellations ( no number, appelation text, county text, state text, area text, isava text ) CREATE TABLE grapes ( id number, grape text, color text ) CREATE TABLE wine ( no number, grape text, winery text, appelation text, state text, name text,...
Which wineries produce at least four wines?
SELECT winery FROM wine GROUP BY winery HAVING COUNT(*) >= 4
spider
CREATE TABLE table_name_40 ( transfer_window VARCHAR, moving_from VARCHAR )
What is the transfer window of the player moving from barueri?
SELECT transfer_window FROM table_name_40 WHERE moving_from = "barueri"
sql_create_context