context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE Ref_Address_Types ( address_type_code VARCHAR(15), address_type_description VARCHAR(80) ) CREATE TABLE Teachers ( teacher_id INTEGER, address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(80), last_name VARCHAR(80), gender VARCHAR(1), cell_mobile_number VARCHA...
Show me about the distribution of date_address_from and the sum of monthly_rental bin date_address_from by weekday in a bar chart.
SELECT date_address_from, SUM(monthly_rental) FROM Student_Addresses ORDER BY monthly_rental DESC
nvbench
CREATE TABLE table_64963 ( "Rank" real, "Name" text, "1st run" text, "2nd run" text, "3rd run" text, "Total" real )
With a 1st run of 53.300 (7), and greater than 21 total, what is the average rank?
SELECT AVG("Rank") FROM table_64963 WHERE "1st run" = '53.300 (7)' AND "Total" > '21'
wikisql
CREATE TABLE table_59086 ( "German" text, "Low German" text, "Plautdietsch" text, "Dutch" text, "English" text )
Which English has Dutch of tong?
SELECT "English" FROM table_59086 WHERE "Dutch" = 'tong'
wikisql
CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname var...
Prof. Jonathan Freedman has taught which courses ?
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course_offering.semester < (SELECT SEMESTERalias0.semester_id FROM semester AS SEMESTERalias0 WHERE SEMESTERalias0.semester = 'WN' AND SEMESTERalias0.year = 2016) AND course.course_id = cour...
advising
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( ...
what is maximum age of patients whose primary disease is hyperglycemia and days of hospital stay is 3?
SELECT MAX(demographic.age) FROM demographic WHERE demographic.diagnosis = "HYPERGLYCEMIA" AND demographic.days_stay = "3"
mimicsql_data
CREATE TABLE table_2742 ( "Season" text, "Premiere" text, "Finale" text, "Reunion" text, "Winners" text, "Runners up" text, "Number of contestants" real, "Number of episodes" real )
Name the most number of contestants
SELECT MAX("Number of contestants") FROM table_2742
wikisql
CREATE TABLE member ( Membership_card VARCHAR )
Which membership card has more than 5 members?
SELECT Membership_card FROM member GROUP BY Membership_card HAVING COUNT(*) > 5
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...
give me the number of patients whose ethnicity is black/haitian and year of birth is less than 2130?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/HAITIAN" AND demographic.dob_year < "2130"
mimicsql_data
CREATE TABLE table_15940 ( "Season" real, "Timeslot ( ET )" text, "Season premiere" text, "Season finale" text, "TV season" text, "Rank" text, "Viewers (millions)" text )
What year is the season with the 10.73 million views?
SELECT "TV season" FROM table_15940 WHERE "Viewers (millions)" = '10.73'
wikisql
CREATE TABLE table_29963 ( "No." real, "Player" text, "Club" text, "Test career" text, "Tests" real, "Catches" real, "Stumpings" real, "Total dismissals" real )
How many total catches did the player with no. 46 have?
SELECT COUNT("Catches") FROM table_29963 WHERE "No." = '46'
wikisql
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE fare ( fare_id int, from_...
can you show me flights that are economy class from BALTIMORE to DALLAS
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, fare, fare_basis, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND fare_basis.economy = 'YES' AND fare.fare_basis...
atis
CREATE TABLE airports ( name VARCHAR, city VARCHAR, country VARCHAR, elevation VARCHAR )
Find the name, city, and country of the airport that has the highest latitude.
SELECT name, city, country FROM airports ORDER BY elevation DESC LIMIT 1
sql_create_context
CREATE TABLE table_27032 ( "\u2116" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (million)" text )
What day did episode number 4 air originally?
SELECT "Original air date" FROM table_27032 WHERE "\u2116" = '4'
wikisql
CREATE TABLE table_2226343_1 ( laps VARCHAR, race_time VARCHAR )
How many laps have a race time of 3:31:24?
SELECT laps FROM table_2226343_1 WHERE race_time = "3:31:24"
sql_create_context
CREATE TABLE table_name_63 ( bronze INTEGER, gold VARCHAR, silver VARCHAR )
What's the bronze medal count when the silver is less than 3 and the gold is 1?
SELECT SUM(bronze) FROM table_name_63 WHERE gold = 1 AND silver < 3
sql_create_context
CREATE TABLE table_train_74 ( "id" int, "gender" string, "pregnancy_or_lactation" bool, "mini_mental_state_examination_mmse" int, "clinical_dementia_rating_cdr" float, "age" float, "NOUSE" float )
mini mental state examination ( mmse ) >= 18
SELECT * FROM table_train_74 WHERE mini_mental_state_examination_mmse >= 18
criteria2sql
CREATE TABLE table_name_56 ( subject INTEGER, plural VARCHAR )
What subject has a plural of am( )ra (we)?
SELECT AVG(subject) FROM table_name_56 WHERE plural = "am(ô)ra (we)"
sql_create_context
CREATE TABLE table_name_81 ( week_5_sept_28 VARCHAR, week_10_nov_2 VARCHAR )
What was the week 5 opponent for the year with a week 10 opponent of Maryland (6-2)?
SELECT week_5_sept_28 FROM table_name_81 WHERE week_10_nov_2 = "maryland (6-2)"
sql_create_context
CREATE TABLE table_5942 ( "Draw" real, "Artist" text, "Song" text, "Jury" real, "Televote" real, "Total" real, "Place" real )
How much Draw has a Televote larger than 18, and an Artist of elizabeth anastasiou, and a Jury larger than 4?
SELECT COUNT("Draw") FROM table_5942 WHERE "Televote" > '18' AND "Artist" = 'elizabeth anastasiou' AND "Jury" > '4'
wikisql
CREATE TABLE Customer_Orders ( order_id INTEGER, customer_id INTEGER, order_status_code VARCHAR(15), shipping_method_code VARCHAR(15), order_placed_datetime DATETIME, order_delivered_datetime DATETIME, order_shipping_charges VARCHAR(255) ) CREATE TABLE Customers ( customer_id INTEGER, ...
Show how many customer addresses in each address type code with a bar chart.
SELECT address_type_code, COUNT(address_type_code) FROM Customer_Addresses AS T1 JOIN Premises AS T2 ON T1.premise_id = T2.premise_id GROUP BY address_type_code
nvbench
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic (...
what is drug type of subject name evelyn lawrence?
SELECT prescriptions.drug_type FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.name = "Evelyn Lawrence"
mimicsql_data
CREATE TABLE table_25920798_2 ( finish VARCHAR, vote VARCHAR )
Name the finish for 4-4
SELECT finish FROM table_25920798_2 WHERE vote = "4-4"
sql_create_context
CREATE TABLE table_7585 ( "1900s" real, "1920s" real, "1930s" real, "1940s" real, "1950s" real, "1960s" real, "1970s" real, "1980s" real, "1990s" real, "2000s to date" real, "Total to date" real )
What was the sum for the 1990s, that has 0 in the 1900s?
SELECT SUM("1990s") FROM table_7585 WHERE "1900s" < '0'
wikisql
CREATE TABLE table_1193568_1 ( province VARCHAR, member VARCHAR )
what's the province where member is dingley brittin category:articles with hcards
SELECT province FROM table_1193568_1 WHERE member = "Dingley Brittin Category:Articles with hCards"
sql_create_context
CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE equipment_sequence ( aircraft_code_sequence varch...
how many flights come from DENVER to BALTIMORE on 7 19
SELECT COUNT(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 (((flight.arrival_time < flight.departure_time) AND date_day.day_number = 18 AND date_day.month_number = 7 AND date_day.year = 1991 AND da...
atis
CREATE TABLE table_32333 ( "Race Name" text, "Circuit" text, "City/Location" text, "Date" text, "Pole position" text, "Winning driver" text, "Winning team" text, "Report" text )
Where is Emerson Fittipaldi starting in Pole position?
SELECT "City/Location" FROM table_32333 WHERE "Pole position" = 'emerson fittipaldi'
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
how many patients admission location is transfer from hosp/extram and were discharged to disc-tran cancer/chldrn h?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.discharge_location = "DISC-TRAN CANCER/CHLDRN H"
mimicsql_data
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 )
Draw a bar chart showing the total number of every ship type by categorizing by nationality, and list x-axis in descending order.
SELECT Type, COUNT(Type) FROM ship GROUP BY Nationality, Type ORDER BY Type DESC
nvbench
CREATE TABLE table_23184448_3 ( date VARCHAR, location VARCHAR )
On how many different dates did the team play a game in Cedar Falls, Iowa?
SELECT COUNT(date) FROM table_23184448_3 WHERE location = "Cedar Falls, Iowa"
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...
00年6月2号到06年12月18号,患者方欣悦的236211指标是怎样的
(SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGD...
css
CREATE TABLE table_22688 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location" text, "Record" text )
Where was the game played that had a record of 19-6?
SELECT "Location" FROM table_22688 WHERE "Record" = '19-6'
wikisql
CREATE TABLE table_8500 ( "Date" text, "Time" text, "Home" text, "Guest" text, "Result" text )
What was the result when home was fc luzern (asl)?
SELECT "Result" FROM table_8500 WHERE "Home" = 'fc luzern (asl)'
wikisql
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE ReviewTaskSt...
Top 50 Users from Ahmedabad..
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "http://stackoverflow.com/users/1844392/piyush", Reputation FROM Users WHERE LOWER(Location) LIKE '%ahmedabad%' OR UPPER(Location) LIKE '%AHMEDABAD' ORDER BY Reputation DESC LIMIT 50
sede
CREATE TABLE table_22756549_1 ( party VARCHAR, winner VARCHAR )
How many times did M. Gounder win for Party A?
SELECT COUNT(party) AS a FROM table_22756549_1 WHERE winner = "M. Gounder"
sql_create_context
CREATE TABLE table_name_11 ( quantity_preserved VARCHAR, fleet_number_s_ VARCHAR )
What is the quantity preserved for fleet number(s) 3000 3015?
SELECT quantity_preserved FROM table_name_11 WHERE fleet_number_s_ = "3000–3015"
sql_create_context
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_CLINIC_ID text, MED_DIRE_CD tex...
二零一五年十月二十六日到二零一八年七月九日,9987120医院的科室小儿胃肠外科涉及到多少医疗费用
SELECT SUM(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.t_kc21_MED_SER_ORG_NO = '9987120' AND t_kc24.t_kc21_MED_ORG_DEPT_NM = '小儿胃肠外科') AND t_kc24.CLINIC_SLT_DATE BETWEEN '2015-10-26' AND '2018-07-09'
css
CREATE TABLE Has_Allergy ( StuID INTEGER, Allergy VARCHAR(20) ) CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), AllergyType VARCHAR(20) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER...
A bar chart about the number of last name for all female students whose sex is F.
SELECT LName, COUNT(LName) FROM Student WHERE Sex = 'F' GROUP BY LName
nvbench
CREATE TABLE table_17881 ( "No" real, "Player" text, "Height" text, "Position" text, "Year born" real, "Current Club" text )
What number does aleksandar apin wear?
SELECT MAX("No") FROM table_17881 WHERE "Player" = 'Aleksandar Ćapin'
wikisql
CREATE TABLE Customer_Policies ( Policy_ID INTEGER, Customer_ID INTEGER, Policy_Type_Code CHAR(15), Start_Date DATE, End_Date DATE ) CREATE TABLE Claims ( Claim_ID INTEGER, Policy_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INTEGER, Amount_Settl...
Compare the frequency of each payment method code using a bar chart, rank Y-axis in asc order.
SELECT Payment_Method_Code, COUNT(Payment_Method_Code) FROM Payments GROUP BY Payment_Method_Code ORDER BY COUNT(Payment_Method_Code)
nvbench
CREATE TABLE table_name_84 ( player VARCHAR, long VARCHAR, yards VARCHAR )
Who has greater than 8 Long and a 73 Yards?
SELECT player FROM table_name_84 WHERE long > 8 AND yards = "73"
sql_create_context
CREATE TABLE table_23130 ( "Pick #" real, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
What's the nationality of the player coming from Edmonton Oil Kings (WCHL)?
SELECT "Nationality" FROM table_23130 WHERE "College/junior/club team" = 'Edmonton Oil Kings (WCHL)'
wikisql
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
Stacked bar chart of team_id for with each ACC_Road in each all home, and list in asc by the y-axis.
SELECT All_Home, Team_ID FROM basketball_match GROUP BY ACC_Road, All_Home ORDER BY Team_ID
nvbench
CREATE TABLE table_11674683_2 ( swimsuit VARCHAR, delegate VARCHAR )
What are the swimsuits for south africa?
SELECT swimsuit FROM table_11674683_2 WHERE delegate = "South Africa"
sql_create_context
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 id of all the files in mp3 format?
SELECT f_id FROM files WHERE formats = "mp3"
spider
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicatio...
what are the four most frequent laboratory tests among patients of age 60 or above in 2100?
SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age >= 60) AND STRFTIME('%y', lab.labresulttime) = '2100' GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 4
eicu
CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) C...
ASP.NET thread volume, page views, unique OPs by month.
SELECT COUNT(*) AS Volume, SUM(ViewCount) AS PageViews, COUNT(DISTINCT OwnerUserId) AS UniqueOPs, TIME_TO_STR(P.CreationDate, '%Y') AS "year", TIME_TO_STR(P.CreationDate, '%m') AS Month FROM Posts AS P WHERE (Tags LIKE '%<activedirectorymembership>%' OR Tags LIKE '%<custom-server-controls>%' OR Tags LIKE '%<dynamicdata...
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
count the number of patients whose year of death is less than or equal to 2155 and item id is 50811?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2155.0" AND lab.itemid = "50811"
mimicsql_data
CREATE TABLE table_63329 ( "Restaurant Name" text, "Original Name" text, "Location" text, "Chef" text, "Designer" text, "Still Open?" text )
What is the original name of the place by designer Glen Peloso with a Location of n/a?
SELECT "Original Name" FROM table_63329 WHERE "Designer" = 'glen peloso' AND "Location" = 'n/a'
wikisql
CREATE TABLE table_204_849 ( id number, "rank" number, "name" text, "nationality" text, "time" text )
who was the first person of the race to break the nine minute mark ?
SELECT "name" FROM table_204_849 WHERE "time" >= 9 ORDER BY "rank" LIMIT 1
squall
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 icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, fi...
during this month was patient 14671 prescribed methadone?
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14671) AND prescriptions.drug = 'methadone' AND DATETIME(prescriptions.startdate, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month')
mimic_iii
CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, ...
give me the flights from LOS ANGELES to PITTSBURGH on tuesday
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 = 'PITTSBURGH' AND date_day.day_number = 22 AND date_day.month_number = 3 AN...
atis
CREATE TABLE company ( Name VARCHAR, Sales_in_Billion VARCHAR )
List the names of companies by ascending number of sales.
SELECT Name FROM company ORDER BY Sales_in_Billion
sql_create_context
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsysto...
tell me the four most common intakes in 2102?
SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%intake%' AND STRFTIME('%y', intakeoutput.intakeoutputtime) = '2102' GROUP BY intakeoutput.celllabel) AS t1 WHERE t1.c1 <= 4
eicu
CREATE TABLE table_name_61 ( neon VARCHAR, krypton VARCHAR )
What neon has a krypton of 213?
SELECT neon FROM table_name_61 WHERE krypton = "213"
sql_create_context
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
get the number of patients with lab test item id 51439 who were admitted to hospital before 2111.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2111" AND lab.itemid = "51439"
mimicsql_data
CREATE TABLE table_2668374_18 ( district VARCHAR, incumbent VARCHAR )
What district was John Dawson from?
SELECT district FROM table_2668374_18 WHERE incumbent = "John Dawson"
sql_create_context
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 those records from the products and each product's manufacturer, return a bar chart about the distribution of name and revenue , and group by attribute headquarter.
SELECT T1.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name
nvbench
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, Revision...
Popular tags with Google Maps APIs.
SELECT * FROM Posts AS a INNER JOIN Posts AS p ON a.ParentId = p.Id INNER JOIN Users AS u ON a.OwnerUserId = u.Id INNER JOIN PostTags AS pt ON p.Id = Pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE t.TagName IN ('google-maps-api-3', 'google-maps', 'google-maps-api', 'google-places-api', 'google-static-maps', 'g...
sede
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_labitems ( row_id ...
have patient 18237 had any lab testing done in 05/2105?
SELECT COUNT(*) > 0 FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18237) AND STRFTIME('%y-%m', labevents.charttime) = '2105-05'
mimic_iii
CREATE TABLE table_name_64 ( round VARCHAR, player VARCHAR )
What round does Bryan Berard do?
SELECT round FROM table_name_64 WHERE player = "bryan berard"
sql_create_context
CREATE TABLE table_204_854 ( id number, "#" number, "wrestlers" text, "reign" number, "date" text, "days\nheld" number, "location" text, "notes" text )
which wrestler has held the title for the most days ?
SELECT "wrestlers" FROM table_204_854 ORDER BY "days\nheld" DESC LIMIT 1
squall
CREATE TABLE table_name_17 ( season VARCHAR, races VARCHAR, points VARCHAR, percentage_of_possible_points VARCHAR )
Which season with 16 races had less than 321 points and a larger percent than 65.78 possible?
SELECT season FROM table_name_17 WHERE points < 321 AND percentage_of_possible_points > 65.78 AND races = 16
sql_create_context
CREATE TABLE actor ( Actor_ID int, Name text, Musical_ID int, Character text, Duration text, age int ) CREATE TABLE musical ( Musical_ID int, Name text, Year int, Award text, Category text, Nominee text, Result text )
Calculate the number of actors in each duration of actors using a bar chart, could you list X-axis in desc order please?
SELECT Duration, COUNT(Duration) FROM actor GROUP BY Duration ORDER BY Duration DESC
nvbench
CREATE TABLE table_name_54 ( nationality VARCHAR, player VARCHAR )
What is Michael Del Zotto's nationality?
SELECT nationality FROM table_name_54 WHERE player = "michael del zotto"
sql_create_context
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )...
indicate the monthly minimum amount of heartrate for patient 030-51920 since 17 months ago.
SELECT MIN(vitalperiodic.heartrate) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-51920')) AND NOT vitalperiodic.heartrate IS NULL...
eicu
CREATE TABLE table_name_16 ( avg INTEGER, yards VARCHAR, rec VARCHAR )
What is the average of the player with 124 yards and less than 13 rec.?
SELECT AVG(avg) FROM table_name_16 WHERE yards = 124 AND rec < 13
sql_create_context
CREATE TABLE table_name_18 ( score VARCHAR, date VARCHAR )
Name the score for 7 may 2000
SELECT score FROM table_name_18 WHERE date = "7 may 2000"
sql_create_context
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...
哪几家医院给名为苗梦菡的病患开过速效救心丸这个药
SELECT MED_SER_ORG_NO FROM t_kc21 WHERE PERSON_NM = '苗梦菡' AND MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc22 WHERE SOC_SRT_DIRE_NM = '速效救心丸')
css
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, ...
what was the name of the procedure that's been performed to patient 90369 two or more times until 46 months ago?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 903...
mimic_iii
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, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
在医疗就诊67597975665中,患者韦歌阑查询的检验报告单情况怎么样?
SELECT * FROM zyjybgb WHERE zyjybgb.JZLSH = '67597975665' UNION SELECT * FROM mzjybgb WHERE mzjybgb.JZLSH = '67597975665'
css
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, v...
since 2105 what are the five most frequent medications prescribed during the same hospital visit to female patients of age 50s after they have been diagnosed with tobacco use disorder?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 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_...
mimic_iii
CREATE TABLE table_name_70 ( games INTEGER, team VARCHAR, points VARCHAR )
What is the lowest game number with Aris Thessaloniki with points smaller than 120?
SELECT MIN(games) FROM table_name_70 WHERE team = "aris thessaloniki" AND points < 120
sql_create_context
CREATE TABLE table_38812 ( "Year" real, "Album" text, "Record label" text, "Info" text, "Music" text )
Which Info has an Album of romeo?
SELECT "Info" FROM table_38812 WHERE "Album" = 'romeo'
wikisql
CREATE TABLE table_21907 ( "Rank" real, "Family" text, "Abbre\u00adviation" text, "Constellation" text, "Area (sq.deg.)" text, "Area (msr)" text, "Per\u00adcent\u00adage" text, "Right ascension (hm)" text, "Decli\u00adnation (dm)" text, "Quad" text )
What is the percentage of this constellation abbreviated as 'nor'?
SELECT "Per\u00adcent\u00adage" FROM table_21907 WHERE "Abbre\u00adviation" = 'Nor'
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...
how many patients died in or before the year 2174 and were tested with lab item id 50990?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2174.0" AND lab.itemid = "50990"
mimicsql_data
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Tags ( Id number, TagName text, C...
SO - Total Posts by Database Server Per Month - PostgreSQL.
SELECT CONCAT(YEAR(P.CreationDate), '-', MONTH(P.CreationDate)) AS YearMonth, 'PostgreSQL' AS TagName, COUNT(*) AS PostCount FROM Posts AS P INNER JOIN PostTags AS PT ON (P.Id = PT.PostId) INNER JOIN Tags AS T ON (PT.TagId = T.Id) WHERE T.TagName LIKE 'postgresql%' GROUP BY YEAR(P.CreationDate), MONTH(P.CreationDate) O...
sede
CREATE TABLE table_49676 ( "Date" text, "Venue" text, "Opponents" text, "Score" text, "Comp" text, "Attendance" text )
Who was the opponent at Ullevi?
SELECT "Opponents" FROM table_49676 WHERE "Venue" = 'ullevi'
wikisql
CREATE TABLE train_station ( Train_ID int, Station_ID int ) CREATE TABLE station ( Station_ID int, Name text, Annual_entry_exit real, Annual_interchanges real, Total_Passengers real, Location text, Main_Services text, Number_of_Platforms int ) CREATE TABLE train ( Train_ID ...
Visualize a bar chart showing each location's total number of passengers, show by the y-axis from high to low.
SELECT Location, SUM(Total_Passengers) FROM station GROUP BY Location ORDER BY SUM(Total_Passengers) DESC
nvbench
CREATE TABLE table_36651 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Record" text, "Venue" text, "Attendance" real )
What is the record of Tampa Bay Buccaneers?
SELECT "Record" FROM table_36651 WHERE "Opponent" = 'tampa bay buccaneers'
wikisql
CREATE TABLE table_15621965_10 ( years_in_orlando VARCHAR, school_club_team VARCHAR )
Name the years in orlando that the player from concord hs was in
SELECT years_in_orlando FROM table_15621965_10 WHERE school_club_team = "Concord HS"
sql_create_context
CREATE TABLE ref_attraction_types ( attraction_type_code text, attraction_type_description text ) CREATE TABLE street_markets ( market_id number, market_details text ) CREATE TABLE hotels ( hotel_id number, star_rating_code text, pets_allowed_yn text, price_range number, other_hote...
Show different tourist attractions' names, ids, and the corresponding number of visits.
SELECT T1.name, T2.tourist_attraction_id, COUNT(*) FROM tourist_attractions AS T1 JOIN visits AS T2 ON T1.tourist_attraction_id = T2.tourist_attraction_id GROUP BY T2.tourist_attraction_id
spider
CREATE TABLE table_name_80 ( score VARCHAR, opponent VARCHAR )
What was the score of the tournament against Isha Lakhani?
SELECT score FROM table_name_80 WHERE opponent = "isha lakhani"
sql_create_context
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
how many patients who had congestive heart failure expired in or before the year 2174?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CONGESTIVE HEART FAILURE" AND demographic.dod_year <= "2174.0"
mimicsql_data
CREATE TABLE table_train_166 ( "id" int, "hemoglobin_a1c_hba1c" float, "diabetic" string, "body_mass_index_bmi" float, "NOUSE" float )
history of type i diabetes
SELECT * FROM table_train_166 WHERE diabetic = 'i'
criteria2sql
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 all employees who have the letters D or S in their first name, show me about the distribution of job_id and the sum of salary , and group by attribute job_id in a bar chart, and I want to order y-axis in descending order.
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(SALARY) DESC
nvbench
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,...
门诊诊断为病人患疾病J02.597的的促甲状腺激素受体抗体数值的平均值以及最值分别是多少?
SELECT AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE zzmzjzjlb.JZZDBM = 'J02.597' AND jyjgzbb.JCZBMC = '...
css
CREATE TABLE table_52729 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
Which Bronze has a Gold smaller than 0?
SELECT AVG("Bronze") FROM table_52729 WHERE "Gold" < '0'
wikisql
CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text...
User, who has asked the most questions.
SELECT Users.Id, Users.DisplayName, COUNT(Posts.Id) AS post_count FROM Users LEFT JOIN Posts ON Users.Id = Posts.OwnerUserId WHERE PostTypeId = 1 GROUP BY Users.Id, Users.DisplayName, Users.Reputation ORDER BY post_count DESC, Users.DisplayName DESC LIMIT 50000
sede
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
bring me the number of patients with elective hospital admissions who were diagnosed with unspecified stomach ulcer.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND diagnoses.short_title = "Stomach ulcer NOS"
mimicsql_data
CREATE TABLE table_name_44 ( accolade VARCHAR, publication VARCHAR )
Which Accolade had a publication of Under the Radar?
SELECT accolade FROM table_name_44 WHERE publication = "under the radar"
sql_create_context
CREATE TABLE table_name_47 ( d_42_√ VARCHAR, d_45_o VARCHAR )
What is the value of D 42 , when the value of D 45 O is d 32 ?
SELECT d_42_√ FROM table_name_47 WHERE d_45_o = "d 32 √"
sql_create_context
CREATE TABLE table_47511 ( "Team A" text, "Team C" text, "Team D" text, "Team E" text, "Team F" text )
Who is Team D when Carmen Ada is team C?
SELECT "Team D" FROM table_47511 WHERE "Team C" = 'carmen ada'
wikisql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
give me the diagnosis of subject id 9258.
SELECT diagnoses.short_title FROM diagnoses WHERE diagnoses.subject_id = "9258"
mimicsql_data
CREATE TABLE table_4479 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What date did the VFL play Punt Road Oval?
SELECT "Date" FROM table_4479 WHERE "Venue" = 'punt road oval'
wikisql
CREATE TABLE table_name_56 ( date VARCHAR, handler VARCHAR, event VARCHAR )
On what date was Mike Jackson a handler at the Indianapolis Boat, Sport & Travel Show?
SELECT date FROM table_name_56 WHERE handler = "mike jackson" AND event = "indianapolis boat, sport & travel show"
sql_create_context
CREATE TABLE table_55007 ( "Date" text, "Ship" text, "Type" text, "Nationality" text, "Tonnage GRT" real )
What type has a Date of 8 dec 16, and a Ship of duchess of cornwall?
SELECT "Type" FROM table_55007 WHERE "Date" = '8 dec 16' AND "Ship" = 'duchess of cornwall'
wikisql
CREATE TABLE table_name_41 ( score VARCHAR, home VARCHAR, visitor VARCHAR )
What was the score from the game where Dallas played Home and Edmonton was visiting?
SELECT score FROM table_name_41 WHERE home = "dallas" AND visitor = "edmonton"
sql_create_context
CREATE TABLE table_name_56 ( home_team VARCHAR, venue VARCHAR )
What is the home team score for kardinia park?
SELECT home_team AS score FROM table_name_56 WHERE venue = "kardinia park"
sql_create_context
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...
how many government health insurance patients were diagnosed with retained foreign body of plastic fragments?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Government" AND diagnoses.short_title = "Retain plastic fragments"
mimicsql_data
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE d_icd_diag...
what was the last hospital admission type during the last year for patient 2238.
SELECT admissions.admission_type FROM admissions WHERE admissions.subject_id = 2238 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY admissions.admittime DESC LIMIT 1
mimic_iii