table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE medication ( medication...
when was the last time patient 028-39354 heartrate was measured less than 108.0 until 125 days ago.
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-39354')) AND vitalperiodic.heartrate < 108.0 AN...
CREATE TABLE table_66238 ( "State (class)" text, "Vacator" text, "Reason for change" text, "Successor" text, "Date of successor's formal installation" text )
Which State (class) has a Successor of harry f. byrd, jr. (d)? Question
SELECT "State (class)" FROM table_66238 WHERE "Successor" = 'harry f. byrd, jr. (d)'
CREATE TABLE table_name_82 ( winner VARCHAR, prize VARCHAR, runner_up VARCHAR )
What is Winner, when Prize is ' 50,000', and when Runner-Up is 'Korosh Nejad'?
SELECT winner FROM table_name_82 WHERE prize = "£50,000" AND runner_up = "korosh nejad"
CREATE TABLE table_204_163 ( id number, "airline" text, "icao" text, "iata" text, "callsign" text, "commenced\noperations" number )
what other airline commenced operations the same year as eagle air ?
SELECT "airline" FROM table_204_163 WHERE "airline" <> 'eagle air' AND "commenced\noperations" = (SELECT "commenced\noperations" FROM table_204_163 WHERE "airline" = 'eagle air')
CREATE TABLE table_name_91 ( nation VARCHAR, bronze VARCHAR )
Which nation had 3 bronze?
SELECT nation FROM table_name_91 WHERE bronze = 3
CREATE TABLE table_name_27 ( team_2 VARCHAR )
What is the 1st leg for team 2 Portol Drac Palma Mallorca?
SELECT 1 AS st_leg FROM table_name_27 WHERE team_2 = "portol drac palma mallorca"
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE Users ( Id number, Reputation number,...
all questions with a particular tag. how long before I get tag badges?
SELECT Posts.Id AS "post_link", Posts.Id, Posts.Score, Tags.TagName AS "tagname" FROM Posts INNER JOIN PostTags ON PostTags.PostId = Posts.Id INNER JOIN Tags ON Tags.Id = PostTags.TagId WHERE Posts.PostTypeId = 1 AND Tags.TagName = @MyTag ORDER BY Posts.Score DESC
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...
how many hours is it since the first time patient 005-87465 had a po clears intake on the current icu visit?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', intakeoutput.intakeoutputtime)) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid ...
CREATE TABLE table_61847 ( "Tournament" text, "2009" text, "2010" text, "2011" text, "2012" text, "2013" text )
What is the 2012 with A in 2009 and 2r in 2010?
SELECT "2012" FROM table_61847 WHERE "2009" = 'a' AND "2010" = '2r'
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 ...
retrieve patient 4269's yearly minimum weight since 2 years ago.
SELECT MIN(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 4269)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit...
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE labevents ...
tell me the first specimen test that patient 76327 received during this hospital visit?
SELECT microbiologyevents.spec_type_desc FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 76327 AND admissions.dischtime IS NULL) ORDER BY microbiologyevents.charttime LIMIT 1
CREATE TABLE table_name_21 ( area_km_2 INTEGER, population INTEGER )
What is Area km 2, when Population is greater than 1,395?
SELECT MIN(area_km_2) FROM table_name_21 WHERE population > 1 OFFSET 395
CREATE TABLE Customers ( customer_id INTEGER, payment_method_code VARCHAR(10), customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80) ) CREATE TABLE Addresses ( address_id INTEGER, address_details V...
Bar graph to show the total number from different payment method code, I want to show by the payment_method_code in ascending.
SELECT payment_method_code, COUNT(*) FROM Customers GROUP BY payment_method_code ORDER BY payment_method_code
CREATE TABLE table_59716 ( "Initial-syllable open/semi-open unstressed vowels" text, "17th c." text, "American" text, "British" text, "Australian" text, "Examples" text )
What is American, when Initial-Syllable Open/Semi-Open Unstressed Vowels is 'y /a , /'?
SELECT "American" FROM table_59716 WHERE "Initial-syllable open/semi-open unstressed vowels" = 'y /aɪ, ɨ/'
CREATE TABLE table_27922491_8 ( matches INTEGER )
What is the least amount of matches?
SELECT MIN(matches) FROM table_27922491_8
CREATE TABLE table_27257896_2 ( indians VARCHAR, salary_range VARCHAR )
If the salary range is 4,000-9,000, what is the Indians %?
SELECT indians FROM table_27257896_2 WHERE salary_range = "4,000-9,000"
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE T...
Candidate obsolete comments mentioning accept rate. Picks up variations like 'acceptance' rate, and references to meta post on accepting answers.
SELECT c.PostId AS "post_link", c.CreationDate FROM Comments AS c JOIN Posts AS a ON a.Id = c.PostId AND a.PostTypeId = 2 JOIN Posts AS q ON q.Id = a.ParentId AND q.PostTypeId = 1 WHERE (c.Text LIKE '%accept% rate%' OR c.Text LIKE '%/5234/%') ORDER BY c.CreationDate
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code tex...
is patient 027-132801's systemicsystolic normal,?
SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-132801')) AND vitalperiodic.systemicsystolic BETWEEN systolic_bp...
CREATE TABLE table_31895 ( "Heat Rank" real, "Lane" real, "Swimmer" text, "Country" text, "Time" real, "Overall Rank" real )
Tell me the total number of time for luke hall overall rank being larger than 105
SELECT COUNT("Time") FROM table_31895 WHERE "Swimmer" = 'luke hall' AND "Overall Rank" > '105'
CREATE TABLE table_201_29 ( id number, "#" text, "picture" text, "name" text, "took office" text, "left office" text, "party" text )
which president had the shortest term without being deposed ?
SELECT "name" FROM table_201_29 ORDER BY JULIANDAY("left office") - JULIANDAY("took office") LIMIT 1
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( ...
how many patients died in or before 2126 and use the drug code d5w100?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2126.0" AND prescriptions.formulary_drug_cd = "D5W100"
CREATE TABLE table_29280 ( "Position" real, "Building" text, "City" text, "Height" text, "Number of floors" real, "Completion" real )
If the number of floors is 70, what is the height?
SELECT "Height" FROM table_29280 WHERE "Number of floors" = '70'
CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE swimme...
Find meter_200 and the average of ID , and group by attribute meter_200, and visualize them by a bar chart.
SELECT meter_200, AVG(ID) FROM swimmer GROUP BY meter_200
CREATE TABLE table_28887 ( "District" text, "Incumbent" text, "Party" text, "First elected" text, "Result" text, "Candidates" text )
How many people won the election in the district of Virginia 4?
SELECT COUNT("Result") FROM table_28887 WHERE "District" = 'Virginia 4'
CREATE TABLE member ( Member_ID int, Name text, Membership_card text, Age int, Time_of_purchase int, Level_of_membership int, Address text ) CREATE TABLE happy_hour_member ( HH_ID int, Member_ID int, Total_amount real ) CREATE TABLE happy_hour ( HH_ID int, Shop_ID int, ...
Find the number of members living in each address Show bar chart, and I want to show x-axis from low to high order.
SELECT Address, COUNT(*) FROM member GROUP BY Address ORDER BY Address
CREATE TABLE table_204_607 ( id number, "season" number, "date" text, "location" text, "discipline" text, "place" text )
how many races were in 2010 ?
SELECT COUNT(*) FROM table_204_607 WHERE "date" = 2010
CREATE TABLE table_79925 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
What was the record for the date of June 14?
SELECT "Record" FROM table_79925 WHERE "Date" = 'june 14'
CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, ...
What 10 -credit courses are there that are on the RCIDIV 400 -level ?
SELECT DISTINCT department, name, number FROM course WHERE credits = 10 AND department = 'RCIDIV' AND number < 400 + 100 AND number >= 400
CREATE TABLE table_73433 ( "P" real, "Player" text, "League" real, "Scottish Cup" real, "League Cup" real, "Challenge Cup" real, "Total" real )
What is Kris doolan's league number?
SELECT COUNT("League") FROM table_73433 WHERE "Player" = 'Kris Doolan'
CREATE TABLE table_32238 ( "Cyclist" text, "Country" text, "Team" text, "Time" text, "UCI ProTour Points" text )
What is Davide Rebellin' UCI ProTour Points?
SELECT "UCI ProTour Points" FROM table_32238 WHERE "Cyclist" = 'davide rebellin'
CREATE TABLE table_16912 ( "Date" text, "Tournament" text, "Location" text, "Purse( $ )" real, "Winner" text, "Score" text, "1st Prize( $ )" real )
What was the score for the tournament in Michigan where the purse was smaller than 1813335.221493934?
SELECT "Score" FROM table_16912 WHERE "Location" = 'Michigan' AND "Purse( $ )" < '1813335.221493934'
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...
Return a bar chart about the distribution of All_Home and Team_ID , and group by attribute ACC_Road.
SELECT All_Home, Team_ID FROM basketball_match GROUP BY ACC_Road, All_Home
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dis...
calculate the number of times that patient 3229 had urine out foley discharge since 12/2101.
SELECT COUNT(*) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3229)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urine out foley' AN...
CREATE TABLE table_name_88 ( label VARCHAR, catalog VARCHAR )
Name the label with catalog of mhcl-20005
SELECT label FROM table_name_88 WHERE catalog = "mhcl-20005"
CREATE TABLE table_19738 ( "Position" text, "Number" text, "Name" text, "Height" text, "Weight" text, "Class" text, "Hometown" text, "Games\u2191" real )
How tall is Braxton Kelley?
SELECT "Height" FROM table_19738 WHERE "Name" = 'Braxton Kelley'
CREATE TABLE table_9315 ( "Round" real, "Pick #" real, "Player" text, "Position" text, "College" text )
A Round larger than 1, a College of Oklahoma state, and a average Pick # that has a Position of tight end is what?
SELECT AVG("Pick #") FROM table_9315 WHERE "Position" = 'tight end' AND "College" = 'oklahoma state' AND "Round" > '1'
CREATE TABLE table_name_89 ( teams VARCHAR, season VARCHAR )
what is the teams for season 1950-51?
SELECT teams FROM table_name_89 WHERE season = "1950-51"
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE patient ( ...
how many patients received a normal saline administration - fluid bolus (250-1000mls) within the same hospital visit after the diagnosis of copd - moderate, during this year?
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'copd - moderate' AND DATETIME(diagnosis.diagnosistime, 'start of year') =...
CREATE TABLE table_name_86 ( to_par VARCHAR, place VARCHAR, score VARCHAR )
What is the to par of the player with a t9 place and a score of 72-67=139?
SELECT to_par FROM table_name_86 WHERE place = "t9" AND score = 72 - 67 = 139
CREATE TABLE has_amenity ( dorm_name VARCHAR, dormid VARCHAR ) CREATE TABLE dorm ( dorm_name VARCHAR, dormid VARCHAR )
Find the name of dorms that do not have any amenity
SELECT dorm_name FROM dorm WHERE NOT dormid IN (SELECT dormid FROM has_amenity)
CREATE TABLE gas_station ( Station_ID int, Open_Year int, Location text, Manager_Name text, Vice_Manager_Name text, Representative_Name text ) CREATE TABLE station_company ( Station_ID int, Company_ID int, Rank_of_the_Year int ) CREATE TABLE company ( Company_ID int, Rank i...
Show the number of companies whose headquarters are not from USA fpr each main industry in a bar chart, display bars in descending order.
SELECT Main_Industry, COUNT(Main_Industry) FROM company WHERE Headquarters <> 'USA' GROUP BY Main_Industry ORDER BY Main_Industry DESC
CREATE TABLE table_59841 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( \u00a3 )" real )
What Score has a Place of t8, and a Country of scotland?
SELECT "Score" FROM table_59841 WHERE "Place" = 't8' AND "Country" = 'scotland'
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 text ) CREATE TABLE diagnoses ( ...
How many patients admitted before 2112 are diagnosed with retained plastic fragments?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2112" AND diagnoses.long_title = "Retained plastic fragments"
CREATE TABLE table_13893 ( "Time" text, "Show Name" text, "DJ's" text, "Local/Networked" text, "Ad Freq" text, "News Freq" text )
What time that is networked has an ad freq of 20 minutes until 7pm?
SELECT "Time" FROM table_13893 WHERE "Local/Networked" = 'networked' AND "Ad Freq" = '20 minutes until 7pm'
CREATE TABLE table_50740 ( "Date" text, "Result" text, "Opponent" text, "Venue" text, "Location" text, "Method" text, "Round" real, "Time" text, "Record" text )
The match that was held at Club Med Sandpiper has what method?
SELECT "Method" FROM table_50740 WHERE "Venue" = 'club med sandpiper'
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 age is less than 47 and drug route is both eyes?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "47" AND prescriptions.route = "BOTH EYES"
CREATE TABLE table_14342210_12 ( points VARCHAR, position VARCHAR )
How many points where scored by the right end?
SELECT COUNT(points) FROM table_14342210_12 WHERE position = "Right end"
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId ...
All questions with a *single* tag in last month.
SELECT Id AS "post_link" FROM Posts WHERE PostTypeId = 1 AND DATEPART(m, CreationDate) = DATEPART(m, DATEADD(m, -1, GETDATE())) AND DATEPART(yyyy, CreationDate) = DATEPART(yyyy, DATEADD(m, -1, GETDATE())) AND Tags = CONCAT('<', '##Tag:string##', '>') ORDER BY CreationDate DESC
CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE gsi ( c...
What courses must I take to be allowed to take PORTUG 235 ?
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT...
CREATE TABLE table_203_591 ( id number, "high school" text, "join\nyear" text, "from" text, "left" text, "league left to" text )
what was the last school to join the genesee county b league ?
SELECT "high school" FROM table_203_591 ORDER BY "join\nyear" DESC LIMIT 1
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...
let me know the age and gender of patient with patient id 84129.
SELECT demographic.age, demographic.gender FROM demographic WHERE demographic.subject_id = "84129"
CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREAT...
what is the latest flight from MILWAUKEE to SEATTLE tomorrow
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SEATTLE' AND date_day.day_number = 20 AND date_day.month_number = 1 AND ...
CREATE TABLE table_13596 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is the to par of canada?
SELECT "To par" FROM table_13596 WHERE "Country" = 'canada'
CREATE TABLE table_name_46 ( away_team VARCHAR, home_team VARCHAR )
What is the score for the away team when they played Hawthorn?
SELECT away_team AS score FROM table_name_46 WHERE home_team = "hawthorn"
CREATE TABLE table_name_94 ( title VARCHAR, termination_of_mission VARCHAR )
Which Title has a Termination of Mission of current?
SELECT title FROM table_name_94 WHERE termination_of_mission = "current"
CREATE TABLE table_36618 ( "Date" text, "Tournament" text, "Location" text, "Winner" text, "Score" text, "1st prize ( $ )" real )
What was the date of the tournament in Scotland with a score of 270 ( 18)?
SELECT "Date" FROM table_36618 WHERE "Score" = '270 (–18)' AND "Location" = 'scotland'
CREATE TABLE Movie ( mID int, title text, year int, director text ) CREATE TABLE Reviewer ( rID int, name text ) CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date )
Compare the lowest rating among all movies by each title using a histogram.
SELECT title, MIN(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY title
CREATE TABLE table_70992 ( "Year" text, "Venue" text, "Winners" text, "2nd place" text, "3rd place" text )
Who came in 3rd at Venue?
SELECT "3rd place" FROM table_70992 WHERE "Venue" = 'venue'
CREATE TABLE table_204_700 ( id number, "name" text, "developer" text, "release" text, "type" text, "game flow" text, "setting" text )
what is the only game to be released by fubra ?
SELECT "name" FROM table_204_700 WHERE "developer" = 'fubra'
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE Posts ( Id number, PostTypeId number, Accepted...
In search of 10 post users by age....
SELECT Users.age AS user_age, COUNT(DISTINCT Users.Id) FROM Users, Posts WHERE NOT Users.age IS NULL AND Users.age BETWEEN 10 AND 70 AND Users.Reputation BETWEEN 2 AND 100000 AND Posts.OwnerUserId = Users.Id AND Users.Id IN (SELECT OwnerUserId FROM Posts GROUP BY OwnerUserId HAVING COUNT(*) >= 10) GROUP BY Users.age OR...
CREATE TABLE table_name_71 ( year INTEGER, points VARCHAR, rank VARCHAR )
What's the average Year that has Points that's smaller than 9 with a Rank of 24th?
SELECT AVG(year) FROM table_name_71 WHERE points < 9 AND rank = "24th"
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid nu...
what was the top four most commonly prescribed drugs until 3 years ago?
SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 4
CREATE TABLE table_12284476_8 ( alloy VARCHAR, series VARCHAR )
what's the alloy with series being ii series
SELECT alloy FROM table_12284476_8 WHERE series = "II series"
CREATE TABLE table_name_8 ( country VARCHAR, iata VARCHAR )
Which country has an IATA of EVN?
SELECT country FROM table_name_8 WHERE iata = "evn"
CREATE TABLE table_65957 ( "Township" text, "County" text, "Pop. (2010)" real, "Land ( sqmi )" real, "Water (sqmi)" real, "Latitude" real, "Longitude" real, "GEO ID" real, "ANSI code" real )
Which Water (sqmi) has a Pop (2010) of 359, and a Longitude smaller than -97.176811?
SELECT MAX("Water (sqmi)") FROM table_65957 WHERE "Pop. (2010)" = '359' AND "Longitude" < '-97.176811'
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, ...
list the top five most frequent treatments for patients with age 50s a year before?
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 50 AND 59) AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT...
CREATE TABLE table_41406 ( "Rank" real, "Name" text, "Team" text, "Games" real, "Rebounds" real )
How many Games for the Player from Lietuvos Rytas Vilnius with less the 43 Rebounds?
SELECT SUM("Games") FROM table_41406 WHERE "Team" = 'lietuvos rytas vilnius' AND "Rebounds" < '43'
CREATE TABLE table_name_81 ( time VARCHAR, notes VARCHAR, athlete VARCHAR )
What is the time of frida svensson's race that had sa/b under the notes?
SELECT time FROM table_name_81 WHERE notes = "sa/b" AND athlete = "frida svensson"
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...
since 2103 what are the top five most frequent lab tests ordered for patients during the same hospital encounter after the diagnosis of bacteremia - vascular catheter associated?
SELECT t3.labname FROM (SELECT t2.labname, 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 = 'bacteremia - vasc...
CREATE TABLE table_name_8 ( rank VARCHAR, nation VARCHAR, silver VARCHAR )
What is the total rank for the Netherlands when more than 2 silver medals were won?
SELECT COUNT(rank) FROM table_name_8 WHERE nation = "netherlands" AND silver > 2
CREATE TABLE table_16316 ( "Pick #" real, "CFL Team" text, "Player" text, "Position" text, "College" text )
Which player went to college at Laval?
SELECT "Player" FROM table_16316 WHERE "College" = 'Laval'
CREATE TABLE table_40 ( "Calls" text, "Frequency" text, "Branding" text, "Format" text, "Market/Rank" text, "Timeslot" text, "Group owner" text )
Which Frequency is used for WEGP calls?
SELECT "Frequency" FROM table_40 WHERE "Calls" = 'WEGP'
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, ...
how many patients whose discharge location is home health care and procedure short title is partial glossectomy?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "HOME HEALTH CARE" AND procedures.short_title = "Partial glossectomy"
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodi...
what was the total output of patient 016-9636's ileostomy on this month/29?
SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-9636')) AND intakeoutput.celllabel = 'ileost...
CREATE TABLE table_64002 ( "Wimmera FL" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real )
What's the total draws when the losses are less than 10, less than 2 byes, and 13 wins?
SELECT COUNT("Draws") FROM table_64002 WHERE "Losses" < '10' AND "Wins" = '13' AND "Byes" < '2'
CREATE TABLE buildings ( id number, name text, city text, height number, stories number, status text ) CREATE TABLE companies ( id number, name text, headquarters text, industry text, sales_billion number, profits_billion number, assets_billion number, market_val...
What are the average profits of companies?
SELECT AVG(profits_billion) FROM companies
CREATE TABLE table_203_353 ( id number, "#" number, "title" text, "producer(s)" text, "featured guest(s)" text, "time" text )
which songs does not have a producer listed .
SELECT "title" FROM table_203_353 WHERE "producer(s)" IS NULL
CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREAT...
Find the average age of students living in each dorm and the name of dorm Plot them as bar chart, I want to show by the y axis in descending.
SELECT dorm_name, AVG(T1.Age) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name ORDER BY AVG(T1.Age) DESC
CREATE TABLE table_name_72 ( state_champions INTEGER, co_champions VARCHAR, mrc_championships VARCHAR, records VARCHAR )
What is the sum of state champions with more tan 9 MRC Championships, more than 4 co-champions, and a record of 192-189-3?
SELECT SUM(state_champions) FROM table_name_72 WHERE mrc_championships > 9 AND records = "192-189-3" AND co_champions > 4
CREATE TABLE table_name_62 ( first VARCHAR, position VARCHAR, bats VARCHAR )
Which First has a Position of c, and Bats of l?
SELECT first FROM table_name_62 WHERE position = "c" AND bats = "l"
CREATE TABLE table_77246 ( "Position" real, "Team" text, "Rd 6" real, "Rd 7" real, "Rd 8" real, "Total" real )
What is the average value for Rd 8 in a position less than 2 for Audi Sport Australia?
SELECT AVG("Rd 8") FROM table_77246 WHERE "Team" = 'audi sport australia' AND "Position" < '2'
CREATE TABLE table_1245148_1 ( location VARCHAR, year_opened VARCHAR )
Where is the track that opened in 1995?
SELECT location FROM table_1245148_1 WHERE year_opened = 1995
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 newborn and item id is 51300?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "NEWBORN" AND lab.itemid = "51300"
CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int,...
show all WEDNESDAY morning flights from DENVER to BOSTON
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, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND days.day_name = 'WEDNESDAY' AND flight.flight_days = days.days_code AN...
CREATE TABLE table_name_68 ( attendance INTEGER, opponent VARCHAR )
What was the lowest attendance was the opponent was chelsea?
SELECT MIN(attendance) FROM table_name_68 WHERE opponent = "chelsea"
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 gender and language of travis hofman.
SELECT demographic.gender, demographic.language FROM demographic WHERE demographic.name = "Travis Hofman"
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
give me the number of emergency hospital admission patients who are taking drug via iv route.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND prescriptions.route = "IV"
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE treatment ( ...
what is the average total cost of a hospital that includes laboratory testing for alkaline phos. since 2105?
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT lab.patientunitstayid FROM lab WHERE lab.labname = 'alkaline phos.')) AND STRFTIME('%y', cost.chargetime) >= '2105' GROU...
CREATE TABLE table_name_41 ( home_team VARCHAR, away_team VARCHAR )
What is the home team when kwong wah was the away team?
SELECT home_team FROM table_name_41 WHERE away_team = "kwong wah"
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
what is the number of patients whose lab test category is blood gas?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab."CATEGORY" = "Blood Gas"
CREATE TABLE table_79726 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Record" text )
What is the score from September 15 that has the Indians as the opponent?
SELECT "Score" FROM table_79726 WHERE "Opponent" = 'indians' AND "Date" = 'september 15'
CREATE TABLE table_2668254_22 ( incumbent VARCHAR, candidates VARCHAR )
Who was the incumbent when the candidate was william drayton (j)?
SELECT incumbent FROM table_2668254_22 WHERE candidates = "William Drayton (J)"
CREATE TABLE Faculty_Participates_in ( FacID INTEGER, actid INTEGER ) CREATE TABLE Participates_in ( stuid INTEGER, actid INTEGER ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, c...
Bar graph to show the total number from different building, and could you rank by the bar from low to high?
SELECT Building, COUNT(*) FROM Faculty GROUP BY Building ORDER BY Building
CREATE TABLE table_1430913_1 ( height_from_sea_level_in_meters VARCHAR, trekking_route VARCHAR )
if 22km is the trekking route what is height from sea level in meters?
SELECT height_from_sea_level_in_meters FROM table_1430913_1 WHERE trekking_route = "22km"
CREATE TABLE table_72440 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (millions)" text )
Who wrote the episode that received 1.83 million U.S. viewers?
SELECT "Written by" FROM table_72440 WHERE "U.S. viewers (millions)" = '1.83'
CREATE TABLE table_name_91 ( qual_1 VARCHAR, team VARCHAR, best VARCHAR )
Which Qual 1 has a Team of team player's, and a Best of 58.405?
SELECT qual_1 FROM table_name_91 WHERE team = "team player's" AND best = "58.405"
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For those records from the products and each product's manufacturer, give me the comparison about code over the name , and group by attribute name by a bar chart, and list Y in descending order please.
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name, T1.Name ORDER BY T1.Code DESC
CREATE TABLE table_22597626_6 ( championship VARCHAR, year VARCHAR, surface VARCHAR )
Name the championship for 1980 hard surface
SELECT championship FROM table_22597626_6 WHERE year = 1980 AND surface = "Hard"
CREATE TABLE table_20281 ( "Name" text, "Overs Bowled" text, "Maidens" real, "Runs Conceded" real, "Wickets" real, "Extras" real, "E.R." text )
How many overs bowled for muttiah muralitharan?
SELECT COUNT("Overs Bowled") FROM table_20281 WHERE "Name" = 'Muttiah Muralitharan'
CREATE TABLE table_name_29 ( constructor VARCHAR, grid VARCHAR )
Who constructed the car that had a grid of 6?
SELECT constructor FROM table_name_29 WHERE grid = "6"