table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE ReviewTasks (
Id number,
ReviewTaskTypeId number,
CreationDate time,
Dele... | test query for empty rows. | SELECT Posts.Id AS "post_link" FROM Posts WHERE Posts.OwnerUserId = @UserId |
CREATE TABLE table_24765815_1 (
team VARCHAR,
rank VARCHAR
) | What team was ranked in 7th? | SELECT team FROM table_24765815_1 WHERE rank = "7th" |
CREATE TABLE table_49985 (
"Draw" real,
"Song" text,
"Artist" text,
"Televotes" real,
"Place" real
) | What is the total number of Draw(s), when Televotes is greater than 1761, when Song is 'Ils Sont L ', and when Place is less than 2? | SELECT COUNT("Draw") FROM table_49985 WHERE "Televotes" > '1761' AND "Song" = 'ils sont là' AND "Place" < '2' |
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,
... | count the number of patients that died in the same month after having been diagnosed with bronchitis until 2104. | SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'bronchitis') AS t1 GROUP BY t1.uniquepid HAVING MIN(t1.diagnosis... |
CREATE TABLE table_name_99 (
Id VARCHAR
) | Who came in 3rd at Venue? | SELECT 3 AS rd_place FROM table_name_99 WHERE "venue" = "venue" |
CREATE TABLE Addresses (
city VARCHAR,
address_id VARCHAR
)
CREATE TABLE Staff (
staff_address_id VARCHAR,
first_name VARCHAR,
last_name VARCHAR
) | Which city does staff with first name as Janessa and last name as Sawayn live? | SELECT T1.city FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" |
CREATE TABLE table_36098 (
"Tournament" text,
"1998" text,
"1999" text,
"2001" text,
"2002" text,
"2003" text,
"2004" text,
"2005" text,
"2006" text,
"2007" text,
"2008" text,
"2009" text,
"2010" text,
"2011" text,
"2012" text,
"Career SR" text,
"Caree... | Which 2007 has a 2008 of 0 / 4? | SELECT "2007" FROM table_36098 WHERE "2008" = '0 / 4' |
CREATE TABLE table_name_85 (
datacenter VARCHAR,
features VARCHAR
) | What Datacenter is listed against the network access connections: rras Feature? | SELECT datacenter FROM table_name_85 WHERE features = "network access connections: rras" |
CREATE TABLE table_name_12 (
average_attendance INTEGER,
_number_of_home_games VARCHAR
) | What was the Average Attendance during the Year in which there were 9 Home Games? | SELECT MAX(average_attendance) FROM table_name_12 WHERE _number_of_home_games = 9 |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | what is the number of urgent hospital admission patients who had closed biopsy of bronchus? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.short_title = "Closed bronchial biopsy" |
CREATE TABLE table_63127 (
"Player" text,
"Int'l Debut" text,
"Year" real,
"Cross Code Debut" text,
"Date" text,
"Position" text
) | What date was the Cross Code Debut of rl 1st test great britain v australia, and the Int'l Debut was RU Five Nations v Ireland? | SELECT "Date" FROM table_63127 WHERE "Cross Code Debut" = 'rl 1st test great britain v australia' AND "Int'l Debut" = 'ru five nations v ireland' |
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,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 regions (
REGION_ID... | For those employees who did not have any job in the past, return a bar chart about the distribution of job_id and the sum of salary , and group by attribute job_id, and sort by the Y from high to low. | SELECT JOB_ID, SUM(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY SUM(SALARY) DESC |
CREATE TABLE table_name_83 (
ihsaa_class VARCHAR,
location VARCHAR
) | Which IHSAA Class has a Location of linton? | SELECT ihsaa_class FROM table_name_83 WHERE location = "linton" |
CREATE TABLE table_204_323 (
id number,
"year" number,
"film" text,
"function" text,
"notes" text
) | how many films did ms. starfelt produce after 2010 ? | SELECT COUNT("film") FROM table_204_323 WHERE "year" > 2010 |
CREATE TABLE table_64575 (
"County" text,
"Location" text,
"Distance" real,
"Total" real,
"Notes" text
) | How much Distance has Notes of north end terminus of ar 155? | SELECT SUM("Distance") FROM table_64575 WHERE "Notes" = 'north end terminus of ar 155' |
CREATE TABLE table_75448 (
"Celebrity" text,
"Famous for" text,
"Entered" text,
"Exited" text,
"Finished" text
) | What celebrity is famous for being an actor? | SELECT "Celebrity" FROM table_75448 WHERE "Famous for" = 'actor' |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | provide the number of patients whose drug type is additive and lab test name is calculated thyroxine (t4) index? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.drug_type = "ADDITIVE" AND lab.label = "Calculated Thyroxine (T4) Index" |
CREATE TABLE table_39313 (
"Name" text,
"GP-GS" text,
"Effic" real,
"Att-Cmp-Int" text,
"Avg/G" real
) | What is the Att-Cmp-Int for the player with a efficiency of 117.4? | SELECT "Att-Cmp-Int" FROM table_39313 WHERE "Effic" = '117.4' |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions... | provide the admission time and procedure icd9 code for chandra schulman. | SELECT demographic.admittime, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Chandra Schulman" |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
... | give the number of patients whose admission type is urgent and procedure icd9 code is 8968? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.icd9_code = "8968" |
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 all employees who have the letters D or S in their first name, draw a bar chart about the distribution of hire_date and the average of salary bin hire_date by time, and show by the y-axis in desc. | SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(SALARY) DESC |
CREATE TABLE table_name_91 (
music_video VARCHAR,
album VARCHAR,
length VARCHAR
) | What was the music video that was from the album High Society, with a length of 3:50? | SELECT music_video FROM table_name_91 WHERE album = "high society" AND length = "3:50" |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREAT... | what's first systemicsystolic value of patient 004-4326 since 2080 days ago? | SELECT vitalperiodic.systemicsystolic FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-4326')) AND NOT vitalperiodic.systemicsystolic... |
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... | What are the total enrollments of universities of each affiliation type Plot them as bar chart, and I want to show by the sum enrollment in desc. | SELECT Affiliation, SUM(Enrollment) FROM university GROUP BY Affiliation ORDER BY SUM(Enrollment) DESC |
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... | how many widowed patients had the procedure extracorporeal circulation auxiliary to open heart surgery? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "WIDOWED" AND procedures.long_title = "Extracorporeal circulation auxiliary to open heart surgery" |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wa... | count the number of patients who have been diagnosed since 2104 with acute lung injury - pulmonary etiology. | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'acute lung injury - pulmonary etiology' AND STRFTIME('%y', diagnosis.diagnosistime) >= '2104') |
CREATE TABLE table_41643 (
"Date" text,
"Home captain" text,
"Away captain" text,
"Venue" text,
"Result" text
) | What is the Date when the match Resulted in a draw? | SELECT "Date" FROM table_41643 WHERE "Result" = 'draw' |
CREATE TABLE table_name_91 (
work VARCHAR,
result VARCHAR,
year VARCHAR
) | what is the work when the result is won and the year is after 2002? | SELECT work FROM table_name_91 WHERE result = "won" AND year > 2002 |
CREATE TABLE table_34599 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Record" text
) | What was the record on March 22? | SELECT "Record" FROM table_34599 WHERE "Date" = 'march 22' |
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,
... | how many prescriptions was prescribed since 2 years ago for aspirin 81 mg chewable tablet? | SELECT COUNT(*) FROM medication WHERE medication.drugname = 'aspirin 81 mg chewable tablet' AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-2 year') |
CREATE TABLE table_273617_6 (
status VARCHAR
) | What is the 2011 number (,000) when the status is separated? | SELECT 2011 AS _number__, 000 AS _ FROM table_273617_6 WHERE status = "Separated" |
CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_description varchar,
manufacturer varchar,
basic_type varchar,
engines int,
pro... | i want a flight on TW from BOSTON to DENVER | 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 = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON... |
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,
... | give me the number of patients whose year of death is less than or equal to 2111 and lab test fluid is pleural? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2111.0" AND lab.fluid = "Pleural" |
CREATE TABLE table_69836 (
"Round" real,
"Pick #" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
) | Who had the placekicker position with a round above 10? | SELECT "Name" FROM table_69836 WHERE "Round" > '10' AND "Position" = 'placekicker' |
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense text
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,... | Would-be Diversity Badge Winners (alternate). | SELECT ROUND(t.Reputation / 5, -3) * 5, COUNT(t.Id) FROM (SELECT u.Id, u.Reputation FROM (SELECT a.OwnerUserId, pt.TagId FROM PostTags AS pt JOIN Posts AS q ON pt.PostId = q.Id JOIN Posts AS a ON a.ParentId = q.Id JOIN (SELECT * FROM Tags ORDER BY Count DESC LIMIT 40) AS t ON pt.TagId = t.Id GROUP BY a.OwnerUserId, pt.... |
CREATE TABLE table_37341 (
"Player" text,
"League" real,
"Malaysia Cup" real,
"FA Cup" real,
"Total" real
) | How many league cups for m patrick maria with 0 total? | SELECT SUM("League") FROM table_37341 WHERE "Player" = 'm patrick maria' AND "Total" < '0' |
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE cost (
costid number,
... | what was the name of that output that patient 015-8398 last had on the last intensive care unit visit? | SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-8398') AND NOT patient.unitdischargetime IS NULL ORDER B... |
CREATE TABLE supplier_addresses (
supplier_id number,
address_id number,
date_from time,
date_to time
)
CREATE TABLE addresses (
address_id number,
address_details text
)
CREATE TABLE department_stores (
dept_store_id number,
dept_store_chain_id number,
store_name text,
store_a... | Give the ids of the three products purchased in the largest amounts. | SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3 |
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE S... | Get all down votes on my posts. | SELECT v.CreationDate, pt.Name, CASE p.PostTypeId WHEN 1 THEN CONCAT('http://stackoverflow.com/q/', p.Id) ELSE CONCAT('http://stackoverflow.com/a/', p.Id) END AS Link, p.Title, p.Body FROM Votes AS v LEFT JOIN VoteTypes AS vt ON vt.Id = v.VoteTypeId LEFT JOIN Posts AS p ON v.PostId = p.Id LEFT JOIN PostTypes AS pt ON p... |
CREATE TABLE SuggestedEdits (
Id number,
PostId number,
CreationDate time,
ApprovalDate time,
RejectionDate time,
OwnerUserId number,
Comment text,
Text text,
Title text,
Tags text,
RevisionGUID other
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId nu... | # of posts on Stack Overflow. | SELECT COUNT(*) FROM Posts |
CREATE TABLE table_819 (
"Year" real,
"Winner" text,
"Language" text,
"Artist" text,
"Song" text,
"Points" real,
"Margin" real,
"Second place" text,
"Date" text,
"Venue" text,
"Location" text,
"Participants" real
) | where is hte second place winner from united kingdom? | SELECT "Winner" FROM table_819 WHERE "Second place" = 'United Kingdom' |
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
meter_600 text,
meter_700 text,
Time text
)
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
... | Show me about the distribution of meter_400 and ID in a bar chart. | SELECT meter_400, ID FROM swimmer |
CREATE TABLE table_name_7 (
venue VARCHAR,
competition VARCHAR
) | Which venue is the friendly match in? | SELECT venue FROM table_name_7 WHERE competition = "friendly match" |
CREATE TABLE table_name_52 (
name_of_ship VARCHAR,
date VARCHAR
) | Which ship was raided on 26 September 1940? | SELECT name_of_ship FROM table_name_52 WHERE date = "26 september 1940" |
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
meter_600 text,
meter_700 text,
Time text
)
CREATE TABLE stadium (
ID int,
name text,
Capacity int,
City text,
Coun... | A bar chart shows the distribution of meter_500 and meter_100 , and list by the Y-axis in asc. | SELECT meter_500, meter_100 FROM swimmer ORDER BY meter_100 |
CREATE TABLE table_78687 (
"Tournament" text,
"2004" text,
"2005" text,
"2006" text,
"2007" text,
"2008" text,
"2009" text,
"2010" text,
"2011" text
) | What is 2011, when 2010 is 'WTA Premier 5 Tournaments'? | SELECT "2011" FROM table_78687 WHERE "2010" = 'wta premier 5 tournaments' |
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 prescriptions (
subject_id text,
hadm_id... | what is maximum age of patients whose insurance is private and days of hospital stay is 8? | SELECT MAX(demographic.age) FROM demographic WHERE demographic.insurance = "Private" AND demographic.days_stay = "8" |
CREATE TABLE table_10001 (
"Line name" text,
"Opened" real,
"Last extension" real,
"Stations served" real,
"Length" text,
"Average Interstation" text,
"Journeys made (per annum)" real
) | What is the average opened year of the line with 59 stations served and more than 145,000,000 journeys made per annum? | SELECT AVG("Opened") FROM table_10001 WHERE "Stations served" = '59' AND "Journeys made (per annum)" > '145,000,000' |
CREATE TABLE table_53059 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What is the name of the home team that played against Hawthorn? | SELECT "Home team" FROM table_53059 WHERE "Away team" = 'hawthorn' |
CREATE TABLE table_46730 (
"Model" text,
"Memory ( RAM )" text,
"Storage ( flash )" text,
"Operating system version" text,
"Memory card" text,
"Weight, dimensions" text,
"Retail availability" text
) | Which operating system has a storage (flash) of 128MB? | SELECT "Operating system version" FROM table_46730 WHERE "Storage ( flash )" = '128mb' |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions... | what is the age and diagnosis icd9 code of subject id 2560? | SELECT demographic.age, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "2560" |
CREATE TABLE table_name_28 (
crowd VARCHAR,
away_team VARCHAR
) | Which Crowd has an Away team of st kilda? | SELECT crowd FROM table_name_28 WHERE away_team = "st kilda" |
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_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
... | what are the four most commonly prescribed drugs that patients of the 60 or above were prescribed within 2 months after having been diagnosed with dmi ophth nt st uncntrld in a year before? | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ... |
CREATE TABLE SuggestedEditVotes (
Id number,
SuggestedEditId number,
UserId number,
VoteTypeId number,
CreationDate time,
TargetUserId number,
TargetRepChange number
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDat... | select Body, Id,PostId,Text from Posts, Comments where Id=PostID. | SELECT Body, Posts.Id, Comments.PostId, Comments.Text FROM Posts, Comments WHERE Posts.Id = Comments.PostId ORDER BY Comments.Score LIMIT 5 |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | what is average age of patients whose admission location is phys referral/normal deli and primary disease is celo-vessicle fistula? | SELECT AVG(demographic.age) FROM demographic WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND demographic.diagnosis = "CELO-VESSICLE FISTULA" |
CREATE TABLE table_28211988_1 (
mens_doubles VARCHAR,
mens_singles VARCHAR
) | Who is everyone on the men's doubles when men's singles is Ma Wenge? | SELECT mens_doubles FROM table_28211988_1 WHERE mens_singles = "Ma Wenge" |
CREATE TABLE table_name_88 (
attendance INTEGER,
score VARCHAR
) | How many Attendances have a Score of 4 5? Question 4 | SELECT MAX(attendance) FROM table_name_88 WHERE score = "4 – 5" |
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAd... | Search posts by user and partial title. | SELECT p.Id AS "post_link", p.CreationDate, p.Score FROM Posts AS p LEFT OUTER JOIN Posts AS q ON p.ParentId = q.Id WHERE p.OwnerUserId = '##UserId:int##' AND COALESCE(p.Title, q.Title) LIKE '%##Query##%' ORDER BY p.CreationDate DESC |
CREATE TABLE table_name_45 (
height__m_ INTEGER,
peak VARCHAR,
class VARCHAR,
prom__m_ VARCHAR
) | What is the average height for hewitt class, with prom less than 86, and a Peak of gragareth? | SELECT AVG(height__m_) FROM table_name_45 WHERE class = "hewitt" AND prom__m_ < 86 AND peak = "gragareth" |
CREATE TABLE table_55049 (
"Name" text,
"Model" text,
"Park" text,
"Opened" text,
"Status" text
) | What is the name of the coaster that opened in 2011 and is a euro-fighter model? | SELECT "Name" FROM table_55049 WHERE "Model" = 'euro-fighter' AND "Opened" = '2011' |
CREATE TABLE table_16351 (
"Year" text,
"Division" text,
"League" text,
"Reg. Season" text,
"Playoffs" text,
"Avg. Attendance" real
) | What is the division for the division semifinals playoffs? | SELECT "Division" FROM table_16351 WHERE "Playoffs" = 'Division Semifinals' |
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,
... | Bring the list of patients with hyperglycemia (hyponatremia) as their primary disease who are discharged to snf. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "SNF" AND demographic.diagnosis = "HYPERGLYCEMIA;HYPONATREMIA" |
CREATE TABLE table_name_45 (
bronze INTEGER,
silver INTEGER
) | Name the least bronze for silver being less than 0 | SELECT MIN(bronze) FROM table_name_45 WHERE silver < 0 |
CREATE TABLE table_name_75 (
nationality VARCHAR,
player VARCHAR,
position VARCHAR,
round VARCHAR
) | What nationality has a position of left wing, and a round greater than 4, with mattia baldi as the player? | SELECT nationality FROM table_name_75 WHERE position = "left wing" AND round > 4 AND player = "mattia baldi" |
CREATE TABLE table_203_489 (
id number,
"year" number,
"title" text,
"system" text,
"developer" text,
"publisher" text
) | how many games were produced from 1988 to 1993 ? | SELECT COUNT("title") FROM table_203_489 WHERE "year" >= 1988 AND "year" <= 1993 |
CREATE TABLE table_name_75 (
character VARCHAR,
artist VARCHAR,
year VARCHAR
) | who is the character when the artist is take and the year is before 2006? | SELECT character FROM table_name_75 WHERE artist = "take" AND year < 2006 |
CREATE TABLE table_name_28 (
winning_score VARCHAR,
tournament VARCHAR
) | In the Phoenix Open, what was the winning score? | SELECT winning_score FROM table_name_28 WHERE tournament = "phoenix open" |
CREATE TABLE table_name_10 (
type VARCHAR,
platform VARCHAR
) | What is the type of electronic with the Gamecube Platform? | SELECT type FROM table_name_10 WHERE platform = "gamecube" |
CREATE TABLE prereq (
course_id varchar(8),
prereq_id varchar(8)
)
CREATE TABLE advisor (
s_ID varchar(5),
i_ID varchar(5)
)
CREATE TABLE course (
course_id varchar(8),
title varchar(50),
dept_name varchar(20),
credits numeric(2,0)
)
CREATE TABLE takes (
ID varchar(5),
course_... | Bar chart x axis building y axis maximal capacity, show by the X-axis from high to low. | SELECT building, MAX(capacity) FROM classroom GROUP BY building ORDER BY building DESC |
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense text
)
CREATE TABLE PostsWithDeleted (
Id number,
PostTypeId number,
... | Python posts containing the mojibake ' '. | SELECT Id AS "post_link", Title, CreationDate, Tags FROM Posts WHERE Tags LIKE '%python%' AND Body LIKE '% %' ORDER BY CreationDate DESC LIMIT 25 |
CREATE TABLE table_32164 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What date was there a crowd larger than 30,343? | SELECT "Date" FROM table_32164 WHERE "Crowd" > '30,343' |
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
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,
even... | count the number of patients that are prescribed metoprolol tartrate in the same hospital encounter after having been diagnosed with abn react-cardiac cath until 3 years ago. | SELECT COUNT(DISTINCT t1.subject_id) 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_icd_diagnoses WHERE d_icd_diagnoses.short_title =... |
CREATE TABLE table_name_59 (
time_retired VARCHAR,
grid VARCHAR,
driver VARCHAR
) | What was the time of the race for Driver Jarno Trulli on a grid smaller than 13? | SELECT time_retired FROM table_name_59 WHERE grid < 13 AND driver = "jarno trulli" |
CREATE TABLE race (
race_id number,
name text,
class text,
date text,
track_id text
)
CREATE TABLE track (
track_id number,
name text,
location text,
seating number,
year_opened number
) | What are the names and dates of races, and the names of the tracks where they are held? | SELECT T1.name, T1.date, T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id |
CREATE TABLE table_name_27 (
award VARCHAR,
year VARCHAR,
result VARCHAR,
category VARCHAR
) | For the category of most popular star with a result of won for 2007, what was the award? | SELECT award FROM table_name_27 WHERE result = "won" AND category = "most popular star" AND year = 2007 |
CREATE TABLE table_56673 (
"Outcome" text,
"Tournament" text,
"Surface" text,
"Partnering" text,
"Score in the final" text
) | What score in the final had a tournament of $25,000 Glasgow, Great Britain? | SELECT "Score in the final" FROM table_56673 WHERE "Tournament" = '$25,000 glasgow, great britain' |
CREATE TABLE table_name_44 (
method VARCHAR,
record VARCHAR,
res VARCHAR,
round VARCHAR
) | What is the method of the match with a win res., 1 round, and a 3-2 record? | SELECT method FROM table_name_44 WHERE res = "win" AND round = 1 AND record = "3-2" |
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... | Number of users by reputation range (15K-75K). High rep users based on the amount of reputation they have earned per day | SELECT Id AS "user_link", DisplayName, Reputation, Location FROM Users WHERE (Reputation >= 15000) AND (Reputation <= 75000) ORDER BY Reputation DESC |
CREATE TABLE table_name_83 (
grid INTEGER,
laps VARCHAR,
time_retired VARCHAR,
driver VARCHAR
) | Tell me the lowest Grid for engine and driver of emerson fittipaldi with more laps than 70 | SELECT MIN(grid) FROM table_name_83 WHERE time_retired = "engine" AND driver = "emerson fittipaldi" AND laps > 70 |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime t... | how many days have passed since the first heparin lock iv fluids of patient 004-86136 on this hospital encounter? | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-86136'... |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE vitalperiodic (
vitalperiodici... | what are the four most frequently ordered procedures for patients who have previously received antiviral therapy - acyclovir within 2 months, since 2105? | SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'antiviral therapy - acyclovir' AND STRFT... |
CREATE TABLE table_name_88 (
outcome VARCHAR,
year VARCHAR,
score VARCHAR
) | What is the Outcome of the Match played after 2003 with a Score of 6 0, 6 3? | SELECT outcome FROM table_name_88 WHERE year > 2003 AND score = "6–0, 6–3" |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | provide the number of patients whose days of hospital stay is greater than 14 and lab test name is bilirubin, direct? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "14" AND lab.label = "Bilirubin, Direct" |
CREATE TABLE table_11707 (
"Date" text,
"Course" text,
"Distance" text,
"Type" text,
"Winner" text
) | What was the course type on 22 May? | SELECT "Type" FROM table_11707 WHERE "Date" = '22 may' |
CREATE TABLE table_57108 (
"Pick #" real,
"Player" text,
"Nationality" text,
"Position" text,
"Team from" text,
"League from" text
) | What is the lowest pick from Elitserien (Sweden)? | SELECT MIN("Pick #") FROM table_57108 WHERE "League from" = 'elitserien (sweden)' |
CREATE TABLE table_204_25 (
id number,
"rank" number,
"mountain peak" text,
"mountain range" text,
"elevation" text,
"prominence" text,
"isolation" text,
"location" text
) | what is the tallest peak in the sierra nevadas ? | SELECT "mountain peak" FROM table_204_25 WHERE "mountain range" = 'sierra nevada' ORDER BY "elevation" DESC LIMIT 1 |
CREATE TABLE table_name_64 (
year VARCHAR,
championship VARCHAR
) | How many years was there a peter jackson classic? | SELECT COUNT(year) FROM table_name_64 WHERE championship = "peter jackson classic" |
CREATE TABLE competition (
Competition_ID int,
Year real,
Competition_type text,
Country text
)
CREATE TABLE competition_result (
Competition_ID int,
Club_ID_1 int,
Club_ID_2 int,
Score text
)
CREATE TABLE club (
Club_ID int,
name text,
Region text,
Start_year text
)
C... | A stacked bar chart about the total number in each competition type, and then split by country, and rank by the y axis in desc please. | SELECT Country, COUNT(Country) FROM competition GROUP BY Competition_type, Country ORDER BY COUNT(Country) DESC |
CREATE TABLE table_43408 (
"Year (Ceremony)" text,
"Film title used in nomination" text,
"Serbian title" text,
"Director" text,
"Result" text
) | What is the Film title used in nomination of the Film with a Serbian title of ? | SELECT "Film title used in nomination" FROM table_43408 WHERE "Serbian title" = 'бело одело' |
CREATE TABLE table_8802 (
"Runs" text,
"Wicket" text,
"Batting partners" text,
"Batting team" text,
"Fielding team" text,
"Venue" text,
"Season" text
) | What batting team played in Chittagong in 2003? | SELECT "Batting team" FROM table_8802 WHERE "Venue" = 'chittagong' AND "Season" = '2003' |
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
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,
... | show me the flights from MIAMI to DENVER | 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 = 'MIAMI' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' ... |
CREATE TABLE table_57630 (
"Driver" text,
"Constructor" text,
"Laps" real,
"Time/Retired" text,
"Grid" real
) | What is the total grid number where the time/retired is +58.182 and the lap number is less than 67? | SELECT SUM("Grid") FROM table_57630 WHERE "Time/Retired" = '+58.182' AND "Laps" < '67' |
CREATE TABLE table_name_94 (
average_attendance INTEGER,
season VARCHAR
) | What was the highest average attendance in the 2009 season? | SELECT MAX(average_attendance) FROM table_name_94 WHERE season = "2009" |
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... | Top users by bounties on Writing.SE. | SELECT UserId AS "user_link", SUM(BountyAmount) FROM Votes WHERE NOT BountyAmount IS NULL AND VoteTypeId = 8 GROUP BY UserId ORDER BY SUM(BountyAmount) DESC |
CREATE TABLE table_40651 (
"Date" text,
"Visitor" text,
"Score" text,
"Home" text,
"Leading scorer" text,
"Record" text
) | Which date had the Hornets as the home team? | SELECT "Date" FROM table_40651 WHERE "Home" = 'hornets' |
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... | Top answers by score or the year. | SELECT Id AS "post_link", Score FROM Posts AS p WHERE YEAR(CreationDate) = '##year?2016##' AND p.PostTypeId = 2 ORDER BY Score DESC LIMIT 10 |
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
dual_airline varchar,
service_name text
)
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TABLE flight (
aircraft_code_sequence text,
... | what is the fare from BOSTON to OAKLAND on UA | 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 = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city... |
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
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,
JO... | For employees with first names that end with the letter m, groups and count the first name to visualize a bar graph, and could you display in desc by the x-axis? | SELECT FIRST_NAME, COUNT(FIRST_NAME) FROM employees WHERE FIRST_NAME LIKE '%m' GROUP BY FIRST_NAME ORDER BY FIRST_NAME DESC |
CREATE TABLE table_3441 (
"Actor/Actress" text,
"Character" text,
"First Appearance" text,
"Last Appearance" text,
"Duration" text,
"Total" real
) | Who was the actor/actress with a first appearance is 3 june 2007? | SELECT "Actor/Actress" FROM table_3441 WHERE "First Appearance" = '3 June 2007' |
CREATE TABLE table_78295 (
"Pick" real,
"Round" text,
"Player" text,
"Position" text,
"School" text
) | What is the highest pick from Washington? | SELECT MAX("Pick") FROM table_78295 WHERE "School" = 'washington' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.