table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
CREATE TABLE table_4232 (
"Pick #" real,
"MLS team" text,
"Player" text,
"Position" text,
"Affiliation" text
) | how many pick# does the university of akron reading united michigan bucks affiliation have | SELECT COUNT("Pick #") FROM table_4232 WHERE "Affiliation" = 'University of Akron Reading United Michigan Bucks' |
CREATE TABLE table_54952 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | In games where st kilda was the away team, what was the smallest crowd? | SELECT MIN("Crowd") FROM table_54952 WHERE "Away team" = 'st kilda' |
CREATE TABLE table_16536 (
"Episode Titles" text,
"First air date" text,
"Reward" text,
"Immunity" text,
"Exiled" text,
"Eliminated" text,
"Vote" text,
"Finish" text
) | What were the results of episodes with the first air date of March 6, 2008? | SELECT "Finish" FROM table_16536 WHERE "First air date" = 'March 6, 2008' |
CREATE TABLE table_49309 (
"Year" real,
"Entrant" text,
"Chassis" text,
"Engine" text,
"Tyres" text,
"Points" text
) | Which engine of Rob Walker Racing Team has 47 points and F tyres? | SELECT "Engine" FROM table_49309 WHERE "Points" = '47' AND "Tyres" = 'f' AND "Entrant" = 'rob walker racing team' |
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInpu... | Number of questions per tag, for a given location of the user:. | SELECT t.TagName, u.Location, COUNT(*) AS "#_posts_per_tag/location" FROM Posts AS p INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON t.Id = pt.TagId INNER JOIN Users AS u ON u.Id = p.OwnerUserId WHERE Location LIKE '%' + '##country:string##' + '%' COLLATE latin1_general_ci_ai GROUP BY t.TagName, u... |
CREATE TABLE table_40955 (
"Position" text,
"Jersey number" real,
"Name v t e" text,
"Height (cm)" real,
"Weight (kg)" real,
"Birthplace" text,
"1995-96 team" text
) | What was the average Jersey number of the player for the Calgary Flames, whose Weight (kg) was greater than 84? | SELECT AVG("Jersey number") FROM table_40955 WHERE "1995-96 team" = 'calgary flames' AND "Weight (kg)" > '84' |
CREATE TABLE table_203_341 (
id number,
"season" text,
"champion" text,
"runner-up" text,
"score" text,
"third place" text
) | what are the total amounts of times that prokom trefl sopot is listed as the champion ? | SELECT COUNT(*) FROM table_203_341 WHERE "champion" = 'prokom trefl sopot' |
CREATE TABLE table_15327489_1 (
riders VARCHAR,
team_name VARCHAR
) | Name the rdiers for jir team scot motogp | SELECT riders FROM table_15327489_1 WHERE team_name = "JiR Team Scot MotoGP" |
CREATE TABLE table_24235 (
"Name" text,
"Municipal status" text,
"Census division" text,
"Population (2011)" real,
"Population (2006)" real,
"Change (%)" text,
"Area (km\u00b2)" text,
"Population density" text
) | What is the change (%) when the area size (km2) is 247.21? | SELECT "Change (%)" FROM table_24235 WHERE "Area (km\u00b2)" = '247.21' |
CREATE TABLE rating (
rid number,
mid number,
stars number,
ratingdate time
)
CREATE TABLE movie (
mid number,
title text,
year number,
director text
)
CREATE TABLE reviewer (
rid number,
name text
) | Find the names of all reviewers who rated Gone with the Wind. | SELECT DISTINCT T3.name FROM rating AS T1 JOIN movie AS T2 ON T1.mid = T2.mid JOIN reviewer AS T3 ON T1.rid = T3.rid WHERE T2.title = 'Gone with the Wind' |
CREATE TABLE table_name_35 (
score VARCHAR,
date VARCHAR
) | What was the score on 6 February 2008? | SELECT score FROM table_name_35 WHERE date = "6 february 2008" |
CREATE TABLE table_15840 (
"Year" real,
"Entrant" text,
"Chassis" text,
"Engine" text,
"Points" text
) | What year did Elf Team Tyrrell have 39 points and a Tyrrell 007 Chassis? | SELECT SUM("Year") FROM table_15840 WHERE "Entrant" = 'elf team tyrrell' AND "Points" = '39' AND "Chassis" = 'tyrrell 007' |
CREATE TABLE Financial_Transactions (
transaction_id INTEGER,
account_id INTEGER,
invoice_number INTEGER,
transaction_type VARCHAR(15),
transaction_date DATETIME,
transaction_amount DECIMAL(19,4),
transaction_comment VARCHAR(255),
other_transaction_details VARCHAR(255)
)
CREATE TABLE Cu... | what are total transaction amounts for each transaction type?, sort X in asc order please. | SELECT transaction_type, SUM(transaction_amount) FROM Financial_Transactions GROUP BY transaction_type ORDER BY transaction_type |
CREATE TABLE table_19309079_2 (
year VARCHAR,
qatari_male VARCHAR
) | How many years were there 97 qatari male births? | SELECT COUNT(year) FROM table_19309079_2 WHERE qatari_male = 97 |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | tell me the short title of diagnoses and time of discharge of patient with patient id 85673. | SELECT demographic.dischtime, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "85673" |
CREATE TABLE table_43269 (
"Date" text,
"Label" text,
"Format" text,
"Country" text,
"Catalog" text
) | What is the Label name that has a Country of uk and the Catalog is bpg 62988? | SELECT "Label" FROM table_43269 WHERE "Country" = 'uk' AND "Catalog" = 'bpg 62988' |
CREATE TABLE table_28059992_6 (
college VARCHAR,
cfl_team VARCHAR
) | What college did the player who was drafted by Calgary go to? | SELECT college FROM table_28059992_6 WHERE cfl_team = "Calgary" |
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,
... | how many patients admitted before 2187 had the drug route tp? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2187" AND prescriptions.route = "TP" |
CREATE TABLE table_1745843_9 (
part_1 VARCHAR,
verb_meaning VARCHAR
) | Name the part one for to give | SELECT part_1 FROM table_1745843_9 WHERE verb_meaning = "to give" |
CREATE TABLE table_name_94 (
score VARCHAR,
surface VARCHAR,
opponent_in_the_final VARCHAR
) | What was the score when the opponent was irena pavlovic and the surface was hard? | SELECT score FROM table_name_94 WHERE surface = "hard" AND opponent_in_the_final = "irena pavlovic" |
CREATE TABLE table_name_79 (
to_par VARCHAR,
score VARCHAR
) | In the game that has a score of 71-71-70-73=285 what is the to par? | SELECT to_par FROM table_name_79 WHERE score = 71 - 71 - 70 - 73 = 285 |
CREATE TABLE table_31322 (
"SAR No." real,
"Builder" text,
"Year" real,
"Works No." real,
"Firebox" text,
"Driver Diameter" text
) | For what year is the SAR no. 874? | SELECT "Year" FROM table_31322 WHERE "SAR No." = '874' |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime t... | what are the four most commonly prescribed medications for patients who have been previously diagnosed with anemia - acute blood loss anemia within 2 months, until 2103? | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'anemia - acute blood loss anemia' AND STRFTIME('%y... |
CREATE TABLE table_51325 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | What was Mike Hailwood's highest laps when he had a grid more than 7? | SELECT MAX("Laps") FROM table_51325 WHERE "Driver" = 'mike hailwood' AND "Grid" > '7' |
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
Ta... | Users with edit privileges who have actually made edits.. | WITH InstantEditors AS (SELECT u.* FROM PostHistory AS h INNER JOIN Posts AS p ON p.Id = h.PostId INNER JOIN Users AS u ON u.Id = h.UserId WHERE h.PostHistoryTypeId IN (4, 5, 6) AND h.RevisionGUID NOT IN (SELECT RevisionGUID FROM PostHistory WHERE PostHistoryTypeId = 24) AND h.UserId != p.OwnerUserId AND h.UserId > 0) ... |
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
)
... | what is the number of patients whose days of hospital stay is greater than 16 and item id is 51250? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "16" AND lab.itemid = "51250" |
CREATE TABLE table_27721 (
"Institution" text,
"Location" text,
"Nickname" text,
"Founded" real,
"Type" text,
"Enrollment" real,
"Joined" real
) | When was the University founded that joined in 1978? | SELECT MAX("Founded") FROM table_27721 WHERE "Joined" = '1978' |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
h... | how much does patient 017-83061 have change in the amount of sao2 last measured on the last icu visit compared to the second to last value measured on the last icu visit? | SELECT (SELECT 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 = '017-83061') AND NOT patient.unitdischargetime IS NULL ... |
CREATE TABLE table_name_79 (
fatalities VARCHAR,
epicenter VARCHAR
) | What number of Fatalities did the Epicenter M zandar n have? | SELECT fatalities FROM table_name_79 WHERE epicenter = "māzandarān" |
CREATE TABLE ReviewTaskStates (
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 PostHistoryTypes (
I... | Facebook Tags and Unanswered Questions. | SELECT SUM(CASE WHEN AnswerCount = 0 THEN 1 ELSE 0 END) AS Unanswered, SUM(CASE WHEN AcceptedAnswerId IS NULL THEN 1 ELSE 0 END) AS NoAcceptedAnswer, COUNT(*) AS Total FROM Posts WHERE Tags LIKE '%facebook%' AND ClosedDate IS NULL GROUP BY DATEADD(dd, 0, DATEDIFF(dd, 0, CreationDate)) |
CREATE TABLE table_79820 (
"Year" text,
"Start" text,
"Qual" text,
"Rank" text,
"Finish" text,
"Laps" real
) | What place did Jimmy Reece finish in 1957? | SELECT "Finish" FROM table_79820 WHERE "Year" = '1957' |
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime ... | what are patient 59916's genders? | SELECT patients.gender FROM patients WHERE patients.subject_id = 59916 |
CREATE TABLE table_name_80 (
score VARCHAR,
date VARCHAR
) | What source has july 1 as the date? | SELECT score FROM table_name_80 WHERE date = "july 1" |
CREATE TABLE table_31861 (
"Year" real,
"Tournament" text,
"Venue" text,
"Result" text,
"Extra" text
) | What is the result for the year 1999? | SELECT "Result" FROM table_31861 WHERE "Year" = '1999' |
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_nam... | how much does it cost for the hospital stay of patient 24364 in 2101? | SELECT SUM(cost.cost) FROM cost WHERE cost.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24364) AND STRFTIME('%y', cost.chargetime) = '2101' |
CREATE TABLE table_63230 (
"School" text,
"Location" text,
"Mascot" text,
"County" real,
"Enrollment" text,
"IHSAA Class" text,
"Year Joined" real,
"Previous Conference" text
) | Which school has an enrollment of A and had lost river as their previous conference? | SELECT "School" FROM table_63230 WHERE "Previous Conference" = 'lost river' AND "Enrollment" = 'a' |
CREATE TABLE table_204_77 (
id number,
"number" text,
"builder" text,
"type" text,
"date" text,
"works number" number,
"notes" text
) | what builder comes before ss & iw ? | SELECT "builder" FROM table_204_77 WHERE id = (SELECT id FROM table_204_77 WHERE "builder" = 'ss&iw') - 1 |
CREATE TABLE table_10288 (
"Tournament" text,
"2008" text,
"2009" text,
"2010" text,
"2011" text,
"2012" text,
"2013" text,
"Win %" text
) | Which 2009 had a 2011 of SF? | SELECT "2009" FROM table_10288 WHERE "2011" = 'sf' |
CREATE TABLE table_name_68 (
pick__number VARCHAR,
player VARCHAR
) | what is the pick # for william loftus? | SELECT pick__number FROM table_name_68 WHERE player = "william loftus" |
CREATE TABLE table_43758 (
"Position" real,
"Name" text,
"Played" real,
"Drawn" real,
"Lost" real,
"Points" real
) | Which Drawn has a Position of 2, and a Lost larger than 2? | SELECT MIN("Drawn") FROM table_43758 WHERE "Position" = '2' AND "Lost" > '2' |
CREATE TABLE table_204_320 (
id number,
"rank" number,
"nation" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
) | how many nations share the seventh rank ? | SELECT COUNT("nation") FROM table_204_320 WHERE "rank" = 7 |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
h... | what would be patient 006-161415's yearly minimum weight? | SELECT MIN(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-161415') AND NOT patient.admissionweight IS NULL GROUP BY STRFTIME('%y', patient.unitadmittime) |
CREATE TABLE table_63263 (
"City of license" text,
"Identifier" text,
"Frequency" text,
"Power" text,
"Class" text,
"RECNet" text
) | what is the class when the power is 22500 watts? | SELECT "Class" FROM table_63263 WHERE "Power" = '22500 watts' |
CREATE TABLE table_37022 (
"Player" text,
"League" real,
"Malaysia Cup" real,
"FA Cup" real,
"Total" real
) | Which FA Cup has a Malaysia Cup larger than 0, and a Total of 8? | SELECT SUM("FA Cup") FROM table_37022 WHERE "Malaysia Cup" > '0' AND "Total" = '8' |
CREATE TABLE program (
program_id int,
name varchar,
college varchar,
introduction varchar
)
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total_gpa float,
entered_as varchar,
admi... | Which upper level CS classes are offered this upcoming semester ? | SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE program_course.catego... |
CREATE TABLE View_Unit_Status (
apt_id INTEGER,
apt_booking_id INTEGER,
status_date DATETIME,
available_yn BIT
)
CREATE TABLE Apartment_Facilities (
apt_id INTEGER,
facility_code CHAR(15)
)
CREATE TABLE Guests (
guest_id INTEGER,
gender_code CHAR(1),
guest_first_name VARCHAR(80),
... | What is the number of booking start dates of the apartments with more than 2 bedrooms for each weekday? Show me a bar chart, and display by the total number in ascending please. | SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 2 ORDER BY COUNT(booking_start_date) |
CREATE TABLE table_name_56 (
round INTEGER,
circuit VARCHAR
) | What was the average round for the oulton park circuit? | SELECT AVG(round) FROM table_name_56 WHERE circuit = "oulton park" |
CREATE TABLE table_16275828_4 (
sanction VARCHAR,
location VARCHAR
) | Who sanctioned the event in lincoln, illinois? | SELECT sanction FROM table_16275828_4 WHERE location = "Lincoln, Illinois" |
CREATE TABLE table_test_19 (
"id" int,
"gender" string,
"left_ventricular_ejection_fraction_lvef" int,
"systolic_blood_pressure_sbp" int,
"acute_infectious" bool,
"hypertensive_retinopathy" bool,
"leukocyte_count" int,
"severe_uncontrolled_hypertension" bool,
"chronic_infectious" boo... | leukocyte count < 3000 / mm3 and / or platelet count < 100000 / mm3. | SELECT * FROM table_test_19 WHERE leukocyte_count < 3000 OR platelet_count < 100000 |
CREATE TABLE table_name_59 (
position VARCHAR,
against VARCHAR,
played VARCHAR
) | How many positions have an against of less than 27, and a played number of less than 8? | SELECT COUNT(position) FROM table_name_59 WHERE against < 27 AND played < 8 |
CREATE TABLE table_13978 (
"Stadium" text,
"Capacity" real,
"City" text,
"Region" text,
"Home Team" text,
"Opened" real
) | What capacity opened lessed than 1937 and is located in the region of champagne-ardenne? | SELECT "Capacity" FROM table_13978 WHERE "Opened" < '1937' AND "Region" = 'champagne-ardenne' |
CREATE TABLE Tags (
Id number,
TagName text,
Count number,
ExcerptPostId number,
WikiPostId number
)
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate time,
Score number,
ViewCount number,
... | Select all comments by UserId. | SELECT * FROM Comments WHERE UserId = @UserId ORDER BY Score DESC |
CREATE TABLE table_name_62 (
province VARCHAR,
iata VARCHAR
) | Which Province has a IATA of aku? | SELECT province FROM table_name_62 WHERE iata = "aku" |
CREATE TABLE table_46659 (
"Player" text,
"Country" text,
"Year(s) won" text,
"Total" text,
"To par" text
) | What is Country, when To Par is '+11'? | SELECT "Country" FROM table_46659 WHERE "To par" = '+11' |
CREATE TABLE table_204_270 (
id number,
"transmitter" text,
"kw" number,
"bbca" number,
"bbcb" number,
"d3&4" number,
"sdn" number,
"arqa" number,
"arqb" number,
"pol." text,
"a.g." text
) | which transmitter has a higher bbca , alston or haydon bridge ? | SELECT "transmitter" FROM table_204_270 WHERE "transmitter" IN ('alston', 'haydon bridge') ORDER BY "bbca" DESC LIMIT 1 |
CREATE TABLE table_62271 (
"Draw" real,
"Language" text,
"Artist" text,
"Song" text,
"English translation" text,
"National final" text,
"Place" real,
"Points" real
) | what is the language when the points is more than 119 and the place is higher than 5? | SELECT "Language" FROM table_62271 WHERE "Points" > '119' AND "Place" > '5' |
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CRE... | Can I get a witness?. | SELECT * FROM Posts |
CREATE TABLE table_78907 (
"Date" text,
"Tournament" text,
"Surface" text,
"Opponent in the final" text,
"Score" text
) | What is the Score of the Tournament with Opponent in the final of Martin Spottl? | SELECT "Score" FROM table_78907 WHERE "Opponent in the final" = 'martin spottl' |
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
a... | what are the top five most frequent procedures given to patients within 2 months after diagnosis of thrombocytopenia - itp? | SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'thrombocytopenia - itp') AS t1 JOIN (SEL... |
CREATE TABLE table_name_93 (
score VARCHAR,
december VARCHAR,
game VARCHAR
) | Which Score has a December smaller than 14, and a Game of 12? | SELECT score FROM table_name_93 WHERE december < 14 AND game = 12 |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
... | since 2105, what were the top four most frequent diagnoses with which patients were diagnosed during the same hospital encounter after diagnosis of ventricular premature beats? | SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'ventr... |
CREATE TABLE table_2668401_17 (
first_elected VARCHAR,
district VARCHAR
) | When was the incumbent from the Virginia 10 district first elected? | SELECT first_elected FROM table_2668401_17 WHERE district = "Virginia 10" |
CREATE TABLE table_39098 (
"Round" real,
"Pick #" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
) | Which pick number had a round of less than 7, an overall of less than 127, and where the name was Robert Alford? | SELECT "Pick #" FROM table_39098 WHERE "Round" < '7' AND "Overall" < '127' AND "Name" = 'robert alford' |
CREATE TABLE table_5393 (
"Frequency" real,
"Callsign" text,
"Brand" text,
"Format" text,
"City of License" text,
"Website" text,
"Webcast" text
) | What is the highest frequency from uncionfeypoder.com? | SELECT MAX("Frequency") FROM table_5393 WHERE "Website" = 'uncionfeypoder.com' |
CREATE TABLE table_2754 (
"Team" text,
"SEC Wins" real,
"SEC Losses" real,
"Percentage" text,
"Home Record" text,
"Road Record" text,
"Overall Record" text
) | What's the home record of the team with percentage of .168? | SELECT "Home Record" FROM table_2754 WHERE "Percentage" = '.168' |
CREATE TABLE table_51308 (
"Player" text,
"Team" text,
"Opponent" text,
"Year" real,
"Score" text
) | What's melbourne's average year? | SELECT AVG("Year") FROM table_51308 WHERE "Team" = 'melbourne' |
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 departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE... | For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about manager_id over the last_name by a bar chart, and show by the total number in ascending. | SELECT LAST_NAME, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY MANAGER_ID |
CREATE TABLE table_22514845_2 (
race_caller VARCHAR,
trophy_presentation VARCHAR
) | Name the total number for race caller for bob costas and charlsie cantey | SELECT COUNT(race_caller) FROM table_22514845_2 WHERE trophy_presentation = "Bob Costas and Charlsie Cantey" |
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE diagnosis (
diagn... | count the number of times that patient 027-154299 received the procedure for antihypertensive drug - nimodipine during the first hospital encounter. | SELECT COUNT(*) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-154299' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi... |
CREATE TABLE table_20515 (
"RR Romaja" text,
"M\u2013R Romaja" text,
"Hangul/Chosongul" text,
"Hanja" text,
"ISO" text,
"Area" text,
"Capital" text,
"Region" text,
"Country" text
) | Name the total number of hangul chosongul for 8,352 | SELECT COUNT("Hangul/Chosongul") FROM table_20515 WHERE "Area" = '8,352' |
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
... | among patients that were prescribed 100 ml glass cont : iopamidol 61 % iv soln, what was the four most commonly prescribed drugs at the same time, since 5 years ago? | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = '100 ml glass cont : iopamidol 61 % iv soln' AND DAT... |
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImage... | SO - Number of active posts last month per 19 moderators. | SELECT COUNT(*) AS PostsLastMonth, 19 AS Moderators, (COUNT(*) / 19) AS PostsLastMonthPerMod FROM Posts WHERE LastActivityDate >= DATEADD(month, -1, (SELECT MAX(LastActivityDate) FROM Posts)) |
CREATE TABLE table_18332 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" real,
"Result" text,
"Candidates" text
) | What district is Charles H. Wilson the incumbent of? | SELECT "District" FROM table_18332 WHERE "Incumbent" = 'Charles H. Wilson' |
CREATE TABLE table_282 (
"car plates (since 1937)" text,
"Voivodeship Separate city" text,
"Capital" text,
"Area in 1000km\u00b2 (1930)" text,
"Population in 1000 (1931)" text
) | List population when their car plates are 30-34. | SELECT "Population in 1000 (1931)" FROM table_282 WHERE "car plates (since 1937)" = '30-34' |
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
)
... | how many patients whose admission type is emergency and days of hospital stay is greater than 13? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.days_stay > "13" |
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... | what is average age of patients whose marital status is widowed and age is greater than or equal to 45? | SELECT AVG(demographic.age) FROM demographic WHERE demographic.marital_status = "WIDOWED" AND demographic.age >= "45" |
CREATE TABLE table_name_8 (
terry_mcauliffe VARCHAR,
dates_administered VARCHAR
) | Which Terry McAuliffe is it that has a Dates Administered on June 6 7? | SELECT terry_mcauliffe FROM table_name_8 WHERE dates_administered = "june 6–7" |
CREATE TABLE table_name_66 (
seasons VARCHAR,
poles VARCHAR,
entries VARCHAR
) | Which Seasons have a Poles larger than 29, and Entries larger than 191? | SELECT seasons FROM table_name_66 WHERE poles > 29 AND entries > 191 |
CREATE TABLE table_2637317_1 (
change_in_population_since_1993 VARCHAR,
_percentage_of_countrys_population VARCHAR
) | What is the change in population since 1993 in the region where the % of country's population was 4.2? | SELECT COUNT(change_in_population_since_1993) FROM table_2637317_1 WHERE _percentage_of_countrys_population = "4.2" |
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
)
CREATE ... | when was the last time that patient 26793 has a .9% normal saline intake until 08/25/2105? | SELECT inputevents_cv.charttime 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 = 26793)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label... |
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
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_re... | cheapest round trip airfare from TACOMA to ORLANDO | SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'TACOMA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_... |
CREATE TABLE table_name_90 (
december VARCHAR,
opponent VARCHAR
) | How many Decembers have calgary flames as the opponent? | SELECT COUNT(december) FROM table_name_90 WHERE opponent = "calgary flames" |
CREATE TABLE news_report (
journalist_ID int,
Event_ID int,
Work_Type text
)
CREATE TABLE event (
Event_ID int,
Date text,
Venue text,
Name text,
Event_Attendance int
)
CREATE TABLE journalist (
journalist_ID int,
Name text,
Nationality text,
Age text,
Years_working... | Visualize a pie chart, count and group by nationality from the journalist table. | SELECT Nationality, COUNT(Nationality) FROM journalist GROUP BY Nationality |
CREATE TABLE table_name_58 (
opponent VARCHAR,
save VARCHAR
) | Who was the opponent in the game with save ||33,389||87 62? | SELECT opponent FROM table_name_58 WHERE save = "||33,389||87–62" |
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE intakeoutput (
in... | count the number of medications that patient 032-24135 was prescribed during this hospital encounter. | SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '032-24135' AND patient.hospitaldischargetime IS NULL)) |
CREATE TABLE table_5999 (
"Stage" text,
"Winner" text,
"General classification" text,
"Points classification" text,
"Mountains classification" text,
"Combination classification" text,
"Team classification" text
) | Which Mountains classification has a Team classification of quick step? | SELECT "Mountains classification" FROM table_5999 WHERE "Team classification" = 'quick step' |
CREATE TABLE table_name_25 (
opponent VARCHAR,
week VARCHAR
) | Who was the opponent in week 13? | SELECT opponent FROM table_name_25 WHERE week = 13 |
CREATE TABLE Ref_calendar (
day_Number VARCHAR,
calendar_date VARCHAR
)
CREATE TABLE All_documents (
Date_Stored VARCHAR,
date_stored VARCHAR
) | What is the day Number and date of all the documents? | SELECT T2.day_Number, T1.Date_Stored FROM All_documents AS T1 JOIN Ref_calendar AS T2 ON T1.Date_Stored = T2.calendar_date |
CREATE TABLE Customer_Addresses (
customer_id INTEGER,
address_id INTEGER,
date_address_from DATETIME,
address_type VARCHAR(15),
date_address_to DATETIME
)
CREATE TABLE Order_Items (
order_id INTEGER,
product_id INTEGER,
order_quantity VARCHAR(15)
)
CREATE TABLE Products (
product_... | Find the number of customers that use email as the contact channel for each weekday. Visualize with a bar chart. | SELECT active_from_date, COUNT(active_from_date) FROM Customers AS t1 JOIN Customer_Contact_Channels AS t2 ON t1.customer_id = t2.customer_id WHERE t2.channel_code = 'Email' |
CREATE TABLE table_39344 (
"Round" real,
"Pick #" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
) | What is the mean pick number for the cornerback position when the overall is less than 134? | SELECT AVG("Pick #") FROM table_39344 WHERE "Position" = 'cornerback' AND "Overall" < '134' |
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
... | indicate the monthly maximum amount of respiration for patient 007-2065 since 77 months ago. | SELECT MAX(vitalperiodic.respiration) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-2065')) AND NOT vitalperiodic.respiration IS N... |
CREATE TABLE station_company (
Station_ID int,
Company_ID int,
Rank_of_the_Year int
)
CREATE TABLE gas_station (
Station_ID int,
Open_Year int,
Location text,
Manager_Name text,
Vice_Manager_Name text,
Representative_Name text
)
CREATE TABLE company (
Company_ID int,
Rank i... | For each company id, what are the companies and how many gas stations does each one operate Plot them as bar chart, could you order by the Y in desc? | SELECT Company, COUNT(*) FROM station_company AS T1 JOIN company AS T2 ON T1.Company_ID = T2.Company_ID GROUP BY T1.Company_ID ORDER BY COUNT(*) DESC |
CREATE TABLE table_67840 (
"Rank" real,
"Team" text,
"Wins" real,
"Losses" real,
"Runs Allowed" real,
"Run Ratio" real
) | What is the lowest amount of losses the United States, ranked higher than 3 with more than 6 wins, have? | SELECT MIN("Losses") FROM table_67840 WHERE "Rank" < '3' AND "Team" = 'united states' AND "Wins" > '6' |
CREATE TABLE table_name_54 (
game VARCHAR,
pov_character VARCHAR
) | Which game does the quentyn martell have? | SELECT game FROM table_name_54 WHERE pov_character = "quentyn martell" |
CREATE TABLE table_name_45 (
first_elected VARCHAR,
result VARCHAR,
district VARCHAR
) | Who was first elected as the result of a retired republican gain in the district of ohio 21? | SELECT first_elected FROM table_name_45 WHERE result = "retired republican gain" AND district = "ohio 21" |
CREATE TABLE table_name_48 (
loss VARCHAR,
date VARCHAR
) | What was the losing score on September 1? | SELECT loss FROM table_name_48 WHERE date = "september 1" |
CREATE TABLE table_16929 (
"Venue" text,
"Hosted" real,
"Average" real,
"Highest" real,
"Lowest" real,
"Total" real,
"Last Year" text,
"Up/Down" text
) | What is the up/down at the venue that hosted 7 games? | SELECT "Up/Down" FROM table_16929 WHERE "Hosted" = '7' |
CREATE TABLE Person (
name varchar(20),
age INTEGER,
city TEXT,
gender TEXT,
job TEXT
)
CREATE TABLE PersonFriend (
name varchar(20),
friend varchar(20),
year INTEGER
) | Return a pie on what is minimum age for different job title? | SELECT job, MIN(age) FROM Person GROUP BY job |
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... | What is the most number of comments on a single post?. | SELECT COUNT(c.Id) AS TotalNoComments, p.Id AS Posts_id FROM Posts AS p INNER JOIN Comments AS c ON (p.Id = c.Id) GROUP BY p.Id ORDER BY TotalNoComments DESC |
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
) | For those records from the products and each product's manufacturer, find name and code , and group by attribute founder, and visualize them by a bar chart, and rank by the bars in desc. | SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder, T1.Name ORDER BY T1.Name DESC |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.