instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
How many items are listed under gdp per capita under the nation of Burkina Faso? | CREATE TABLE table_2248991_2 (gdp_per_capita VARCHAR,nation VARCHAR) | SELECT COUNT(gdp_per_capita) FROM table_2248991_2 WHERE nation = "Burkina Faso" |
what is the name of the drug prescribed to patient 8098 within 2 days after diagnosis of hemododialysis hypotensn in 01/last year? | CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE admissions (row_id number,subject_id number,... | SELECT t2.drug FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 8098 AND diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'hemodod... |
What time contains the owner of maine chance farm? | CREATE TABLE table_name_55 (time VARCHAR,owner VARCHAR) | SELECT time FROM table_name_55 WHERE owner = "maine chance farm" |
What is the col (m) of the Barurumea Ridge peak? | CREATE TABLE table_18946749_2 (col__m_ INTEGER,peak VARCHAR) | SELECT MAX(col__m_) FROM table_18946749_2 WHERE peak = "Barurumea Ridge" |
how many patients who were admitted before the year 2150 had an iv bolus as the drug route? | 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 (subject_id text,hadm_id text,name text,marital_status text,age text,dob... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2150" AND prescriptions.route = "IV BOLUS" |
how many patients whose drug name is bethanechol? | 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 text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Bethanechol" |
Anonymous feedback votes over time. | CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score n... | SELECT COUNT(*) FROM PostFeedback |
How many female patients are American Indian/Alaska native? | 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 text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" |
With less than 7 Silver medals, how many Gold medals did Canada receive? | CREATE TABLE table_name_30 (gold INTEGER,nation VARCHAR,silver VARCHAR) | SELECT MAX(gold) FROM table_name_30 WHERE nation = "canada" AND silver < 7 |
how many patients had the diagnosis icd9 code 53190? | 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 text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.icd9_code = "53190" |
What home team played against Footscray as the away team? | CREATE TABLE table_name_73 (home_team VARCHAR,away_team VARCHAR) | SELECT home_team FROM table_name_73 WHERE away_team = "footscray" |
What is every value for points if rebounds is 6 and blocks is 0? | CREATE TABLE table_27581 ("Player" text,"Games Played" real,"Rebounds" real,"Assists" real,"Steals" real,"Blocks" real,"Points" real) | SELECT "Points" FROM table_27581 WHERE "Rebounds" = '6' AND "Blocks" = '0' |
Percentage of Questions Upvoted Lower than the Highest Upvoted Answer. | CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionD... | SELECT ROUND(AVG(CASE WHEN QuestionScore < HighestAnswerScore THEN 100.0 ELSE 0.0 END), 2) AS "Percentage" FROM (SELECT q.Id, MAX(q.Score) AS QuestionScore, MAX(a.Score) AS HighestAnswerScore FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id GROUP BY q.Id) AS Scores |
What is the total number of each fate? Give me the result in a bar graph, and could you order Y-axis from low to high order? | 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) | SELECT Fate, COUNT(Fate) FROM mission GROUP BY Fate ORDER BY COUNT(Fate) |
How many patients are admitted before the year 2162 with procedure left heart cardiac cath? | 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)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2162" AND procedures.short_title = "Left heart cardiac cath" |
What were the outcomes of matches with bill tilden florence ballin as opponents? | CREATE TABLE table_24244 ("Outcome" text,"Year" real,"Championship" text,"Surface" text,"Partner" text,"Opponents" text,"Score" text) | SELECT "Outcome" FROM table_24244 WHERE "Opponents" = 'Bill Tilden Florence Ballin' |
Which Points have a Score of 4 1, and a Record of 18 10 8 1, and a January larger than 2? | CREATE TABLE table_75362 ("Game" real,"January" real,"Opponent" text,"Score" text,"Record" text,"Points" real) | SELECT AVG("Points") FROM table_75362 WHERE "Score" = '4–1' AND "Record" = '18–10–8–1' AND "January" > '2' |
What is the date of birth for the player from Ulster and plays at Centre position? | CREATE TABLE table_37218 ("Player" text,"Position" text,"Date of Birth (Age)" text,"Caps" real,"Club/province" text) | SELECT "Date of Birth (Age)" FROM table_37218 WHERE "Club/province" = 'ulster' AND "Position" = 'centre' |
What is the highest rank for championships with christy heffernan with over 4 matches? | CREATE TABLE table_32614 ("Rank" real,"Player" text,"County" text,"Tally" text,"Total" real,"Matches" real,"Average" real) | SELECT MAX("Rank") FROM table_32614 WHERE "Player" = 'christy heffernan' AND "Matches" > '4' |
any absolute contraindication to central venous catheterization | CREATE TABLE table_train_40 ("id" int,"bone_marrow_transplant" bool,"organ_transplantation" bool,"systolic_blood_pressure_sbp" int,"do_not_resuscitate_dnr" bool,"autoimmune_disease" bool,"steroid_therapy" bool,"intention_to_central_venous_catheter" bool,"hematologic_disease" bool,"sepsis" bool,"acute_leukemia" bool,"al... | SELECT * FROM table_train_40 WHERE intention_to_central_venous_catheter = 0 |
Downvoted questions in the [row] tag. | CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId numb... | SELECT Id, Score, Title FROM Posts WHERE Tags LIKE '%<row>%' AND ClosedDate IS NULL AND Score < 0 ORDER BY Score |
What is the least amount of touchdowns scored on the chart? | CREATE TABLE table_1040 ("Player" text,"Position" text,"Starter" text,"Touchdowns" real,"Extra points" real,"Field goals" real,"Points" real) | SELECT MIN("Touchdowns") FROM table_1040 |
My answers in POPULAR QUESTIONS. | CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,... | SELECT SUM(q.ViewCount) AS views, q.Id AS "post_link", a.Score FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id WHERE a.OwnerUserId = '##userid##' HAVING SUM(q.ViewCount) > 1000 ORDER BY views DESC |
what is the number of patients whose discharge location is home health care and age is less than 41? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,sho... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "HOME HEALTH CARE" AND demographic.age < "41" |
What is the Winning score in 1956? | CREATE TABLE table_39386 ("Year" real,"Championship" text,"54 holes" text,"Winning score" text,"Margin" text,"Runner(s)-up" text) | SELECT "Winning score" FROM table_39386 WHERE "Year" = '1956' |
How many Games for Rank 2 Terrell McIntyre? | CREATE TABLE table_43055 ("Rank" real,"Name" text,"Team" text,"Games" real,"Assists" real) | SELECT MIN("Games") FROM table_43055 WHERE "Name" = 'terrell mcintyre' AND "Rank" > '2' |
In what place did Nick Faldo, who had more than 284 points and a to par score of +5, finish? | CREATE TABLE table_name_94 (finish VARCHAR,player VARCHAR,total VARCHAR,to_par VARCHAR) | SELECT finish FROM table_name_94 WHERE total > 284 AND to_par = "+5" AND player = "nick faldo" |
Find the id of the candidate who got the lowest oppose rate. | CREATE TABLE candidate (Candidate_ID VARCHAR,oppose_rate VARCHAR) | SELECT Candidate_ID FROM candidate ORDER BY oppose_rate LIMIT 1 |
A stacked bar chart showing the number of faults for different fault short name and skills required to fix them The x-axis is falut short name and group by skill description, and order in ascending by the X. | CREATE TABLE Part_Faults (part_fault_id INTEGER,part_id INTEGER,fault_short_name VARCHAR(20),fault_description VARCHAR(255),other_fault_details VARCHAR(255))CREATE TABLE Staff (staff_id INTEGER,staff_name VARCHAR(255),gender VARCHAR(1),other_staff_details VARCHAR(255))CREATE TABLE Assets (asset_id INTEGER,maintenance_c... | SELECT fault_short_name, COUNT(fault_short_name) FROM Part_Faults AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.part_fault_id = T2.part_fault_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id GROUP BY skill_description, fault_short_name ORDER BY fault_short_name |
What is the transcription of the sanskrit word chandra? | CREATE TABLE table_180802_3 (transcription VARCHAR,sanskrit_word VARCHAR) | SELECT transcription FROM table_180802_3 WHERE sanskrit_word = "Chandra" |
What is the mintage (bu) with the artist Royal Canadian Mint Staff and has an issue price (proof) of $54.95? | CREATE TABLE table_11916083_1 (mintage__bu_ VARCHAR,_clarification_needed_ VARCHAR,artist VARCHAR,issue_price__proof_ VARCHAR) | SELECT mintage__bu_ AS "_clarification_needed_" FROM table_11916083_1 WHERE artist = "Royal Canadian Mint Staff" AND issue_price__proof_ = "$54.95" |
I want a bar chart to show the frequency of the dates that have the 5 highest cloud cover rates each day, and could you sort in descending by the Y-axis? | CREATE TABLE weather (date TEXT,max_temperature_f INTEGER,mean_temperature_f INTEGER,min_temperature_f INTEGER,max_dew_point_f INTEGER,mean_dew_point_f INTEGER,min_dew_point_f INTEGER,max_humidity INTEGER,mean_humidity INTEGER,min_humidity INTEGER,max_sea_level_pressure_inches NUMERIC,mean_sea_level_pressure_inches NUM... | SELECT date, COUNT(date) FROM weather ORDER BY COUNT(date) DESC |
Trend for relevant questions (Tag and Searchstring). | CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class number,TagBased boolean)CREATE TABLE PostNotices (Id numb... | SELECT COUNT(UniqueId), WeekStart FROM (SELECT Posts.Id AS UniqueId, DATEADD(week, DATEDIFF(day, '20000109', CreationDate) / 7, '20000109') AS WeekStart FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.Id = PostTags.PostId WHERE Tags.TagName = @Tag AND (Posts.Body LIKE @Searchstring O... |
what is the tie number that has Portsmouth Home team | CREATE TABLE table_name_52 (tie_no VARCHAR,home_team VARCHAR) | SELECT tie_no FROM table_name_52 WHERE home_team = "portsmouth" |
What cart has a serpent shield animal? | CREATE TABLE table_60415 ("Knight" text,"Weapon/item" text,"External weapon" text,"Shield animal" text,"Cart" text) | SELECT "Cart" FROM table_60415 WHERE "Shield animal" = 'serpent' |
What is the quantity made number for the quantity preserved 4-6-0 ooooo ten-wheeler? | CREATE TABLE table_13476 ("Class" text,"Wheel arrangement" text,"Fleet number(s)" text,"Manufacturer" text,"Serial numbers" text,"Year made" text,"Quantity made" text,"Quantity preserved" text) | SELECT "Quantity made" FROM table_13476 WHERE "Quantity preserved" = '4-6-0 — ooooo — ten-wheeler' |
what are the procedures that are the top four most common in 2100? | CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,insurance text,language text,marital_status text,ethnicity text,age number)C... | 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, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE STRFTIME('%y', procedures_icd.charttime) = '2100' GROUP BY procedures_icd.icd9_code) AS t1 ... |
what is the name of the procedure that patient 1912 has undergone two times in 02/last year? | CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid number,intime time,outtime time)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text... | 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 = 191... |
Which award was given for the role of Elphaba in 2009? | CREATE TABLE table_name_92 (award VARCHAR,role VARCHAR,year VARCHAR) | SELECT award FROM table_name_92 WHERE role = "elphaba" AND year = "2009" |
What is Headquarter, when Newspaper/Magazine is Al-Ayyam? | CREATE TABLE table_76719 ("Newspaper/Magazine" text,"Type" text,"Language" text,"Headquarter" text,"Status" text) | SELECT "Headquarter" FROM table_76719 WHERE "Newspaper/Magazine" = 'al-ayyam' |
What is the Score when the set 3 is 26 28? | CREATE TABLE table_58653 ("Date" text,"Time" text,"Score" text,"Set 1" text,"Set 2" text,"Set 3" text,"Total" text) | SELECT "Score" FROM table_58653 WHERE "Set 3" = '26–28' |
Search for posts by deleted user. | CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,P... | SELECT CreationDate, Id AS "post_link" FROM Posts AS p WHERE OwnerDisplayName = '##Name:string##' ORDER BY CreationDate |
tell me the time of hospital admission of patient 51577 until 2104? | 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 microbiologyevents (row_id number,subject_id number,hadm_id number,charttime... | SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 51577 AND STRFTIME('%y', admissions.admittime) <= '2104' |
What is the largest drawn that has a played less than 38? | CREATE TABLE table_name_8 (drawn INTEGER,played INTEGER) | SELECT MAX(drawn) FROM table_name_8 WHERE played < 38 |
How many locations are listed for the winner Temple? | CREATE TABLE table_25180 ("Conference" text,"Regular Season Winner" text,"Conference Player of the Year" text,"Conference Tournament" text,"Tournament Venue (City)" text,"Tournament Winner" text) | SELECT COUNT("Tournament Venue (City)") FROM table_25180 WHERE "Tournament Winner" = 'Temple' |
provide the number of patients whose primary disease is newborn and year of death is less than or equal to 2112? | 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 lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "NEWBORN" AND demographic.dod_year <= "2112.0" |
Who is week 1 if week 3 is Natasha Budhi? | CREATE TABLE table_61292 ("Week 1" text,"Week 2" text,"Week 3" text,"Week 4" text,"Week 5" text) | SELECT "Week 1" FROM table_61292 WHERE "Week 3" = 'natasha budhi' |
What college was the draft pick from who plays center position? | CREATE TABLE table_49891 ("Round" real,"Pick #" real,"Player" text,"Position" text,"College" text) | SELECT "College" FROM table_49891 WHERE "Position" = 'center' |
Visualize a bar chart for what are the naems of all the projects, and how many scientists were assigned to each of them? | CREATE TABLE AssignedTo (Scientist int,Project char(4))CREATE TABLE Projects (Code Char(4),Name Char(50),Hours int)CREATE TABLE Scientists (SSN int,Name Char(30)) | SELECT Name, COUNT(*) FROM Projects AS T1 JOIN AssignedTo AS T2 ON T1.Code = T2.Project GROUP BY T1.Name |
How many Picks have a College of tennessee, and an Overall smaller than 270? | CREATE TABLE table_name_59 (pick__number INTEGER,college VARCHAR,overall VARCHAR) | SELECT SUM(pick__number) FROM table_name_59 WHERE college = "tennessee" AND overall < 270 |
What is the Pole Position of the Brazilian Grand Prix race? | CREATE TABLE table_name_28 (pole_position VARCHAR,race VARCHAR) | SELECT pole_position FROM table_name_28 WHERE race = "brazilian grand prix" |
What is Home Team, when Date is 18 February 1956, and when Tie No is 3? | CREATE TABLE table_9451 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text) | SELECT "Home team" FROM table_9451 WHERE "Date" = '18 february 1956' AND "Tie no" = '3' |
Close votes on Tag X. | CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLicense text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE FlagTypes ... | SELECT Posts.Id AS "post_link" FROM Posts INNER JOIN PostTags ON PostTags.PostId = Posts.Id INNER JOIN Tags ON PostTags.TagId = Tags.Id WHERE Tags.TagName = '##Tag:string##' AND Posts.CreationDate > DATEADD(year, -1, GETDATE()) |
How many weeks has the opponent been san francisco 49ers? | CREATE TABLE table_7899 ("Week" real,"Date" text,"TV Time" text,"Opponent" text,"Result" text) | SELECT COUNT("Week") FROM table_7899 WHERE "Opponent" = 'san francisco 49ers' |
When was the lock with 10 caps born? | CREATE TABLE table_name_20 (date_of_birth__age_ VARCHAR,position VARCHAR,caps VARCHAR) | SELECT date_of_birth__age_ FROM table_name_20 WHERE position = "lock" AND caps = 10 |
Which Giro di Lombardia has a Paris Roubaix of servais knaven ( ned )? | CREATE TABLE table_62553 ("Year" real,"Milan \u2013 San Remo" text,"Tour of Flanders" text,"Paris\u2013Roubaix" text,"Li\u00e8ge\u2013Bastogne\u2013Li\u00e8ge" text,"Giro di Lombardia" text) | SELECT "Giro di Lombardia" FROM table_62553 WHERE "Paris\u2013Roubaix" = 'servais knaven ( ned )' |
country with the most bronze medals . | CREATE TABLE table_204_308 (id number,"rank" number,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number) | SELECT "nation" FROM table_204_308 ORDER BY "bronze" DESC LIMIT 1 |
Return a histogram on how many students are from each city, and which cities have more than one cities? | 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 Has_amenity (dormid INTEGER,amenid INTEGER)CREATE TABLE Dorm (dormid INTEGER,dorm_name VARCHAR(20),student_capacity INTEGER,gender VARCHAR(1))CREATE TABLE Do... | SELECT city_code, COUNT(*) FROM Student GROUP BY city_code |
give the number of patients who were born before the year 1882 and whose item id is 51482 | 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)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital... | 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.itemid = "51482" |
has patient 021-79544 been prescribed any prescription drugs on this hospital visit? | CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean num... | SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-79544' AND patient.hospitaldischargetime IS NULL)) |
What team has +119 Points diff? | CREATE TABLE table_44341 ("Team" text,"Tries for" text,"Tries against" text,"Try diff" text,"Points for" text,"Points against" text,"Points diff" text) | SELECT "Team" FROM table_44341 WHERE "Points diff" = '+119' |
What County has a Longitude of 85 45 43 w? | CREATE TABLE table_34781 ("County" text,"Monument name" text,"Year built" real,"City or Town" text,"Latitude" text,"Longitude" text) | SELECT "County" FROM table_34781 WHERE "Longitude" = '85°45′43″w' |
What is the home team in week 1? | CREATE TABLE table_name_61 (home_team VARCHAR,week VARCHAR) | SELECT home_team FROM table_name_61 WHERE week = "1" |
When la salle is the team who has the highest amount of points? | CREATE TABLE table_31208 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "High points" FROM table_31208 WHERE "Team" = 'La Salle' |
What 1953 has 2 as a 1949, and 3 as 1952? | CREATE TABLE table_name_48 (Id VARCHAR) | SELECT 1953 FROM table_name_48 WHERE 1949 = "2" AND 1952 = "3" |
What country does Tiger Woods come from? | CREATE TABLE table_name_58 (country VARCHAR,player VARCHAR) | SELECT country FROM table_name_58 WHERE player = "tiger woods" |
diabetes type i and ii | CREATE TABLE table_train_96 ("id" int,"gender" string,"elevated_creatinine" float,"diabetic" string,"cerebrovascular_disease" bool,"moca_score" int,"parkinsonism" bool,"NOUSE" float) | SELECT * FROM table_train_96 WHERE diabetic = 'i' OR diabetic = 'ii' |
What is the total number of Score, when Country is 'United States', and when Player is 'Lee Trevino'? | CREATE TABLE table_77402 ("Place" text,"Player" text,"Country" text,"Score" real,"To par" text) | SELECT COUNT("Score") FROM table_77402 WHERE "Country" = 'united states' AND "Player" = 'lee trevino' |
i would like to see the flights from BALTIMORE to PHILADELPHIA please | CREATE TABLE class_of_service (booking_class varchar,rank int,class_description text)CREATE TABLE fare (fare_id int,from_airport varchar,to_airport varchar,fare_basis_code text,fare_airline text,restriction_code text,one_direction_cost int,round_trip_cost int,round_trip_required varchar)CREATE TABLE flight_stop (flight... | 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 = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHIL... |
mine old date and time. | CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLicense text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,... | SELECT Id, Score FROM Posts WHERE Score >= 10 AND (Title LIKE '%date%' OR Title LIKE '%Date%' OR Title LIKE '%time%' OR Title LIKE '%Time%') AND Tags LIKE '%python%' ORDER BY CreationDate DESC LIMIT 100 |
What was the final score in game 15? | CREATE TABLE table_21198 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "Score" FROM table_21198 WHERE "Game" = '15' |
What are the names of the technicians and how many machines are they assigned to repair. | CREATE TABLE repair (repair_ID int,name text,Launch_Date text,Notes text)CREATE TABLE repair_assignment (technician_id int,repair_ID int,Machine_ID int)CREATE TABLE machine (Machine_ID int,Making_Year int,Class text,Team text,Machine_series text,value_points real,quality_rank int)CREATE TABLE technician (technician_id ... | SELECT Name, COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_id = T2.technician_id GROUP BY T2.Name |
Which Grid has Laps smaller than 22, and a Bike of honda cbr1000rr, and a Rider of luca morelli? | CREATE TABLE table_8761 ("Rider" text,"Bike" text,"Laps" real,"Time" text,"Grid" real) | SELECT MIN("Grid") FROM table_8761 WHERE "Laps" < '22' AND "Bike" = 'honda cbr1000rr' AND "Rider" = 'luca morelli' |
What number has an acquisition via the Rookie Draft, and is part of a School/club team at Cal State Fullerton? | CREATE TABLE table_name_54 (number VARCHAR,acquisition_via VARCHAR,school_club_team VARCHAR) | SELECT number FROM table_name_54 WHERE acquisition_via = "rookie draft" AND school_club_team = "cal state fullerton" |
For all employees who have the letters D or S in their first name, a bar chart shows the distribution of hire_date and the average of manager_id bin hire_date by time. | CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS... | SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' |
What club does Manuel Fernandes coach? | CREATE TABLE table_60066 ("Club" text,"Head Coach" text,"City" text,"Stadium" text,"2003\u20132004 season" text) | SELECT "Club" FROM table_60066 WHERE "Head Coach" = 'manuel fernandes' |
among the patients with age 30s , what was the top five prescribed drugs? | CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate ... | SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 30 AND 39) GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 5 |
Get email MD5 hashes for StackExchange users. | CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE ... | SELECT Id, DisplayName, EmailHash FROM Users WHERE EmailHash = '5e7308ff7122df9ebbee7b52956a2ea3' LIMIT 50 |
this year patient 16088 had undergone any venous cath nec procedure? | CREATE TABLE d_labitems (row_id number,itemid number,label text)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 transfers (row_id num... | SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'venous cath nec') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 16088) AND DATETIME(procedures_... |
What is the total of blank ends at Prince Edward Island? | CREATE TABLE table_73254 ("Locale" text,"Skip" text,"W" real,"L" real,"PF" real,"PA" real,"Ends Won" real,"Ends Lost" real,"Blank Ends" real,"Stolen Ends" real,"Shot Pct." real) | SELECT MAX("Blank Ends") FROM table_73254 WHERE "Locale" = 'Prince Edward Island' |
What was the game result on November 29, 1959? | CREATE TABLE table_7829 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real) | SELECT "Result" FROM table_7829 WHERE "Date" = 'november 29, 1959' |
Give me a bar chart to compare the number of departments located in different cities, and rank in ascending by the x-axis. | CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE jobs (JOB_I... | SELECT CITY, COUNT(CITY) FROM locations GROUP BY CITY ORDER BY CITY |
provide the number of patients whose ethnicity is black/cape verdean and days of hospital stay is greater than 7? | 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 text,gender text,language text,religion text,admission_type text,days_stay ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND demographic.days_stay > "7" |
What year is the date when the boiler type is forward topfeed, the built at is Crewe, and lot number is less than 187? | CREATE TABLE table_50731 ("BR No." text,"Lot No." real,"Date" real,"Built at" text,"Boiler type" text) | SELECT COUNT("Date") FROM table_50731 WHERE "Boiler type" = 'forward topfeed' AND "Built at" = 'crewe' AND "Lot No." < '187' |
How many height entries are there for players from bayside high school? | CREATE TABLE table_25063 ("Name" text,"#" real,"Position" text,"Height" text,"Weight" real,"Year" text,"Home Town" text,"High School" text) | SELECT COUNT("Height") FROM table_25063 WHERE "High School" = 'Bayside' |
who has the most number of affiliates ? | CREATE TABLE table_204_796 (id number,"network name" text,"flagship" text,"programming type" text,"owner" text,"affiliates" number) | SELECT "network name" FROM table_204_796 ORDER BY "affiliates" DESC LIMIT 1 |
Return the number of music festivals of each category in a bar chart, and could you order x axis in descending order? | CREATE TABLE artist (Artist_ID int,Artist text,Age int,Famous_Title text,Famous_Release_date text)CREATE TABLE volume (Volume_ID int,Volume_Issue text,Issue_Date text,Weeks_on_Top real,Song text,Artist_ID int)CREATE TABLE music_festival (ID int,Music_Festival text,Date_of_ceremony text,Category text,Volume int,Result t... | SELECT Category, COUNT(*) FROM music_festival GROUP BY Category ORDER BY Category DESC |
Which united states player had a To par of 12? | CREATE TABLE table_name_63 (player VARCHAR,to_par VARCHAR,country VARCHAR) | SELECT player FROM table_name_63 WHERE to_par = 12 AND country = "united states" |
what are the number of times she came in 2nd position for the european championships ? | CREATE TABLE table_203_651 (id number,"year" number,"competition" text,"venue" text,"position" text,"notes" text) | SELECT COUNT(*) FROM table_203_651 WHERE "position" = 2 AND "competition" = 'european championships' |
Which is the lowest round to have a pick of 12 and position of linebacker? | CREATE TABLE table_33995 ("Round" real,"Pick #" real,"Overall" real,"Name" text,"Position" text,"College" text) | SELECT MIN("Round") FROM table_33995 WHERE "Pick #" = '12' AND "Position" = 'linebacker' |
Show all calendar dates and bin by year in a line chart. | CREATE TABLE Documents_to_be_Destroyed (Document_ID INTEGER,Destruction_Authorised_by_Employee_ID INTEGER,Destroyed_by_Employee_ID INTEGER,Planned_Destruction_Date DATETIME,Actual_Destruction_Date DATETIME,Other_Details VARCHAR(255))CREATE TABLE Employees (Employee_ID INTEGER,Role_Code CHAR(15),Employee_Name VARCHAR(25... | SELECT Calendar_Date, COUNT(Calendar_Date) FROM Ref_Calendar |
count the number of patients whose gender is m and diagnoses short title is ath ext ntv art gngrene? | 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 procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.short_title = "Ath ext ntv art gngrene" |
What was the streak for the game after 8 on Nov 22? | CREATE TABLE table_12513 ("Game" real,"Date" text,"Opponent" text,"Result" text,"Raiders points" real,"Opponents" real,"First Downs" real,"Record" text,"Streak" text,"Attendance" real) | SELECT "Streak" FROM table_12513 WHERE "Game" > '8' AND "Date" = 'nov 22' |
how many records were set in beijing ? | CREATE TABLE table_203_102 (id number,"event" text,"performance" text,"athlete" text,"nation" text,"place" text,"date" text) | SELECT COUNT(*) FROM table_203_102 WHERE "place" = 'beijing' |
tell me the sex of patient 55027. | CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_... | SELECT patients.gender FROM patients WHERE patients.subject_id = 55027 |
What nation won the fewest gold medals while being in Rank 1, with a total of 37 medals and more than 7 bronze medals? | CREATE TABLE table_name_4 (gold INTEGER,bronze VARCHAR,total VARCHAR,rank VARCHAR) | SELECT MIN(gold) FROM table_name_4 WHERE total = 37 AND rank = "1" AND bronze > 7 |
who would the next opponent be after week 4 ? | CREATE TABLE table_203_691 (id number,"week" number,"date" text,"opponent" text,"result" text,"attendance" number) | SELECT "opponent" FROM table_203_691 WHERE "week" = 4 + 1 |
Return a pie on how many books fall into each category? | CREATE TABLE book_club (book_club_id int,Year int,Author_or_Editor text,Book_Title text,Publisher text,Category text,Result text)CREATE TABLE culture_company (Company_name text,Type text,Incorporated_in text,Group_Equity_Shareholding real,book_club_id text,movie_id text)CREATE TABLE movie (movie_id int,Title text,Year ... | SELECT Category, COUNT(*) FROM book_club GROUP BY Category |
Name the lead with left bloc of 8.4% | CREATE TABLE table_5596 ("Date Released" text,"Institute" text,"Socialist" text,"Social Democratic" text,"Green-Communist" text,"Left Bloc" text,"People's Party" text,"Lead" text) | SELECT "Lead" FROM table_5596 WHERE "Left Bloc" = '8.4%' |
Who was the visitor on April 2? | CREATE TABLE table_9840 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Record" text) | SELECT "Visitor" FROM table_9840 WHERE "Date" = 'april 2' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.