instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
What is the average and total transaction amount?
CREATE TABLE Financial_transactions (transaction_amount INTEGER)
SELECT AVG(transaction_amount), SUM(transaction_amount) FROM Financial_transactions
Number of users with activity in the last year.
CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLicense text)CREATE TABLE Tags (Id number,TagName text,Count number,Excerpt...
SELECT COUNT(*) FROM Users WHERE LastAccessDate > DATEADD(year, -1, GETDATE()) AND Reputation > 10
give me the number of patients whose procedure icd9 code is 3804?
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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.icd9_code = "3804"
What was the score of the away team at princes park?
CREATE TABLE table_name_30 (away_team VARCHAR,venue VARCHAR)
SELECT away_team AS score FROM table_name_30 WHERE venue = "princes park"
What year did the B-Side of Just Squeeze Me come out?
CREATE TABLE table_64255 ("Year" real,"A-side" text,"B-side" text,"Catalog number" text,"Label" text)
SELECT "Year" FROM table_64255 WHERE "B-side" = 'just squeeze me'
What is the first broadcast date of the episode in which Dave's team is made up of Dave Johns and Sally Lindsay?
CREATE TABLE table_23292220_3 (first_broadcast VARCHAR,daves_team VARCHAR)
SELECT first_broadcast FROM table_23292220_3 WHERE daves_team = "Dave Johns and Sally Lindsay"
What is the Date of the Vigo Tournament?
CREATE TABLE table_48259 ("Date" text,"Tournament" text,"Surface" text,"Partner" text,"Opponent in the final" text,"Score" text)
SELECT "Date" FROM table_48259 WHERE "Tournament" = 'vigo'
What's the Qual listed with a Rank of 27?
CREATE TABLE table_69561 ("Year" text,"Start" text,"Qual" text,"Rank" text,"Finish" text,"Laps" real)
SELECT "Qual" FROM table_69561 WHERE "Rank" = '27'
How many spectators were at the away team Carlton?
CREATE TABLE table_55975 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Crowd" FROM table_55975 WHERE "Away team" = 'carlton'
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of hire_date and the sum of department_id bin hire_date by time in a bar chart.
CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,J...
SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
was the heartrate normal for patient 017-59454 on the first intensive care unit visit?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE treatment (treatmentid number,patientunitstayid ...
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 = '017-59454') AND NOT patient.unitdischargetime IS NULL ORDER BY patie...
cardona island light and caja de muertos light are both located in what municipality ?
CREATE TABLE table_203_665 (id number,"name" text,"municipality" text,"established" number,"tower height\nin meters (ft)" text,"focal plane\nin meters (ft)" text,"current status" text,"current condition" text)
SELECT "municipality" FROM table_203_665 WHERE "name" IN ('cardona island light', 'caja de muertos light')
Who is the winner in 2011?
CREATE TABLE table_name_30 (winners VARCHAR,season VARCHAR)
SELECT winners FROM table_name_30 WHERE season = 2011
The longest answers by an user.. To find those that required a lot of work. :-) Or a copy/paste. :-(
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,CreationDate time,DisplayName text,LastAccessDate time,WebsiteU...
SELECT Id AS "post_link", LENGTH(Body) AS Length, LastActivityDate AS "last_activity_date" FROM Posts WHERE PostTypeId = 2 AND OwnerUserId = '##UserId##' ORDER BY Length DESC LIMIT 1000
what is the number of patients whose diagnoses short title is ac/chr syst/dia hrt fail and lab test fluid is joint fluid?
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 (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Ac/chr syst/dia hrt fail" AND lab.fluid = "Joint Fluid"
Calculate the number of patients with diagnoses icd9 code v4281 who had a cerebrospinal fluid lab test.
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (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,ethni...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "V4281" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
What race did Simon Pagenaud have the most laps in?
CREATE TABLE table_3936 ("Round" real,"Race" text,"Pole position" text,"Fastest lap" text,"Most laps led" text,"Driver" text,"Team" text,"Manufacturer" text,"Report" text)
SELECT "Race" FROM table_3936 WHERE "Most laps led" = 'Simon Pagenaud'
Name the least game for score of l 93 109 (ot)
CREATE TABLE table_2796 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT MIN("Game") FROM table_2796 WHERE "Score" = 'L 93–109 (OT)'
List name of all tracks in Balls to the Wall.
CREATE TABLE tracks (name VARCHAR,genre_id VARCHAR)CREATE TABLE albums (id VARCHAR,title VARCHAR)
SELECT T2.name FROM albums AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.title = "Balls to the Wall"
Name the realization for 'to be, to do
CREATE TABLE table_54557 ("Environment" text,"Realization" text,"Example" text,"Pronunciation" text,"Gloss" text)
SELECT "Realization" FROM table_54557 WHERE "Gloss" = 'to be, to do'
What is the score of the tournament on 25 July 1994 with a clay surface and Patricia Tarabini as the partner?
CREATE TABLE table_5647 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Partner" text,"Opponents" text,"Score" text)
SELECT "Score" FROM table_5647 WHERE "Surface" = 'clay' AND "Partner" = 'patricia tarabini' AND "Date" = '25 july 1994'
return me the paper after 2000 with more than 200 citations .
CREATE TABLE journal (homepage varchar,jid int,name varchar)CREATE TABLE domain (did int,name varchar)CREATE TABLE domain_author (aid int,did int)CREATE TABLE author (aid int,homepage varchar,name varchar,oid int)CREATE TABLE writes (aid int,pid int)CREATE TABLE conference (cid int,homepage varchar,name varchar)CREATE ...
SELECT title FROM publication WHERE citation_num > 200 AND year > 2000
Runs smaller than 6106, and Inns smaller than 146 has what total number of matches?
CREATE TABLE table_69327 ("Name" text,"Seasons" text,"Matches" real,"Inns" real,"Runs" real)
SELECT COUNT("Matches") FROM table_69327 WHERE "Runs" < '6106' AND "Inns" < '146'
On what Date was the Winning score of 72-67-68-67=274?
CREATE TABLE table_name_30 (date VARCHAR,winning_score VARCHAR)
SELECT date FROM table_name_30 WHERE winning_score = 72 - 67 - 68 - 67 = 274
What is the name of the artist of ' bang bang boom '?
CREATE TABLE table_47051 ("Volume:Issue" text,"Issue Date(s)" text,"Weeks on Top" text,"Song" text,"Artist" text)
SELECT "Artist" FROM table_47051 WHERE "Song" = ' bang bang boom '
How many teams participated (maximum) when Cornish All Blacks Pertemps Bees were relegated to the league?
CREATE TABLE table_26410 ("Season" text,"Name" text,"Teams" real,"Relegated to league" text,"Promoted to league" text,"Promoted from league" text,"Relegated from league" text)
SELECT MAX("Teams") FROM table_26410 WHERE "Relegated to league" = 'Cornish All Blacks Pertemps Bees'
Who was the opponent on week 7?
CREATE TABLE table_name_82 (opponent VARCHAR,week VARCHAR)
SELECT opponent FROM table_name_82 WHERE week = "7"
Top 100 questions by tags in the last year (sorted by viewcount).
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId numbe...
SELECT Id, Title, CreationDate, Tags, ClosedDate, FavoriteCount, ViewCount, Score FROM Posts WHERE PostTypeId = 1 AND Tags LIKE '%##TagName1##%' AND Tags LIKE '%##TagName2##%' AND NOT Tags LIKE '%##ExcludedTag##%' AND Posts.CreationDate > CURRENT_TIMESTAMP() - 365 ORDER BY ViewCount DESC, FavoriteCount DESC, Score DESC...
What is the smallest number of wins where goals conceded are below 26, draws are 1 and goals scored are below 74?
CREATE TABLE table_59272 ("Position" real,"Club" text,"Games played" real,"Wins" real,"Draws" real,"Loses" real,"Goals scored" real,"Goals conceded" real,"Points" real)
SELECT MIN("Wins") FROM table_59272 WHERE "Goals conceded" < '26' AND "Draws" = '1' AND "Goals scored" < '74'
Name the team for launceston
CREATE TABLE table_name_60 (team VARCHAR,race_title VARCHAR)
SELECT team FROM table_name_60 WHERE race_title = "launceston"
Which city has a school of North Vernon and a county of 40 Jennings?
CREATE TABLE table_64905 ("School" text,"City" text,"Team Name" text,"County" text,"Year Joined" text,"Year Left" text)
SELECT "City" FROM table_64905 WHERE "County" = '40 jennings' AND "School" = 'north vernon'
what is the intake method of the trandate?
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 intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabe...
SELECT DISTINCT medication.routeadmin FROM medication WHERE medication.drugname = 'trandate'
Return the full name of the customer who made the first rental.
CREATE TABLE film (film_id number,title text,description text,release_year time,language_id number,original_language_id number,rental_duration number,rental_rate number,length number,replacement_cost number,rating text,special_features text,last_update time)CREATE TABLE actor (actor_id number,first_name text,last_name ...
SELECT T1.first_name, T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.rental_date LIMIT 1
Name the number of captains for barcelona
CREATE TABLE table_29398373_2 (captain VARCHAR,team VARCHAR)
SELECT COUNT(captain) FROM table_29398373_2 WHERE team = "Barcelona"
Give me a histogram for what are the statuses and average populations of each city?
CREATE TABLE farm_competition (Competition_ID int,Year int,Theme text,Host_city_ID int,Hosts text)CREATE TABLE competition_record (Competition_ID int,Farm_ID int,Rank int)CREATE TABLE farm (Farm_ID int,Year int,Total_Horses real,Working_Horses real,Total_Cattle real,Oxen real,Bulls real,Cows real,Pigs real,Sheep_and_Go...
SELECT Status, AVG(Population) FROM city GROUP BY Status
If the time/retired is +1 lap, what is the amount of maximum laps?
CREATE TABLE table_17693171_1 (laps INTEGER,time_retired VARCHAR)
SELECT MAX(laps) FROM table_17693171_1 WHERE time_retired = "+1 lap"
how many patients were diagnosed with ards and didn't return back to the hospital within 2 months until 3 years ago?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number...
SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'ards' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-3 year')) AS t1) - (SELECT...
What is the score at game 31?
CREATE TABLE table_38880 ("Game" real,"Date" text,"Opponent" text,"Score" text,"Location" text,"Record" text)
SELECT "Score" FROM table_38880 WHERE "Game" = '31'
what is the yearly maximum output (ml)-nephrostomy right 10 fr. output that patient 015-16479 has had since 32 months ago?
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 allergy (allergyid number,patientunitstayid number,drugname text,allergyna...
SELECT MAX(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 = '015-16479')) AND intakeoutput.celllabel = 'outpu...
mini mental state examination ( mmse ) total score < 27
CREATE TABLE table_train_82 ("id" int,"mini_mental_state_examination_mmse" int,"systolic_blood_pressure_sbp" int,"diastolic_blood_pressure_dbp" int,"body_mass_index_bmi" float,"hypertension" bool,"age" float,"NOUSE" float)
SELECT * FROM table_train_82 WHERE mini_mental_state_examination_mmse < 27
List the number of completion students in each day and group by date of completion in a line chart.
CREATE TABLE Course_Authors_and_Tutors (author_id INTEGER,author_tutor_ATB VARCHAR(3),login_name VARCHAR(40),password VARCHAR(40),personal_name VARCHAR(80),middle_name VARCHAR(80),family_name VARCHAR(80),gender_mf VARCHAR(1),address_line_1 VARCHAR(80))CREATE TABLE Student_Course_Enrolment (registration_id INTEGER,stude...
SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment GROUP BY date_of_completion
Comments that have imgur images.
CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId n...
SELECT Id AS "comment_link", Text FROM Comments WHERE LOWER(Text) LIKE '%i.stack.imgur.com%' LIMIT 100
Which Model has a GCM (kg) Technical Capacity of 35000, a GVM (kg) Technical Capacity of 16000, and Cummins Interact 6.0-euro III (turbo intercooler) for the Engine?
CREATE TABLE table_name_94 (model VARCHAR,engine_make_capacity VARCHAR,gcm__kg__technical_capacity VARCHAR,gvm__kg__technical_capacity VARCHAR)
SELECT model FROM table_name_94 WHERE gcm__kg__technical_capacity = "35000" AND gvm__kg__technical_capacity = "16000" AND engine_make_capacity = "cummins interact 6.0-euro iii (turbo intercooler)"
What is the average number of games with a record of 20-12?
CREATE TABLE table_9892 ("Game" real,"Date" text,"Opponent" text,"Score" text,"Location" text,"Record" text)
SELECT AVG("Game") FROM table_9892 WHERE "Record" = '20-12'
What team was Tom Sneva on in rounds 1-9?
CREATE TABLE table_33762 ("Team" text,"Chassis" text,"Engine" text,"Driver(s)" text,"Sponsor(s)" text,"Rounds" text)
SELECT "Team" FROM table_33762 WHERE "Driver(s)" = 'tom sneva' AND "Rounds" = '1-9'
what's the mole with airdate being 8 january 2009
CREATE TABLE table_17948 ("Season" text,"Airdate" text,"The Mole" text,"Winner" text,"Runner-up" text,"Prize money" text,"International destination" text)
SELECT "The Mole" FROM table_17948 WHERE "Airdate" = '8 January 2009'
How many orders in each weekday? Return a bar chart to show.
CREATE TABLE Customer_Addresses (customer_id INTEGER,address_id INTEGER,date_address_from DATETIME,address_type VARCHAR(15),date_address_to DATETIME)CREATE TABLE Customer_Contact_Channels (customer_id INTEGER,channel_code VARCHAR(15),active_from_date DATETIME,active_to_date DATETIME,contact_number VARCHAR(50))CREATE TA...
SELECT order_date, COUNT(order_date) FROM Customers AS t1 JOIN Customer_Orders AS t2 ON t1.customer_id = t2.customer_id WHERE order_status = "Delivered"
What is the lowest number of Gold the Nation of Italy had when it ranked other than 1, and had more than 0 Silver?
CREATE TABLE table_51380 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MIN("Gold") FROM table_51380 WHERE "Rank" > '1' AND "Nation" = 'italy' AND "Silver" > '0'
What are the different positions for match season?
CREATE TABLE team (team_id number,name text)CREATE TABLE country (country_id number,country_name text,capital text,official_native_language text)CREATE TABLE match_season (season number,player text,position text,country number,team number,draft_pick_number number,draft_class text,college text)CREATE TABLE player (playe...
SELECT DISTINCT position FROM match_season
when was the first time that patient 70645 was admitted to the hospital during the last year?
CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREA...
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 70645 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY admissions.admittime LIMIT 1
when was the ship completed that was laid down on 23 march 1926?
CREATE TABLE table_name_31 (completed VARCHAR,laid_down VARCHAR)
SELECT completed FROM table_name_31 WHERE laid_down = "23 march 1926"
what is minimum age of patients whose admission type is emergency and primary disease is pneumonia;human immunodefiency virus;rule out tuberculosis?
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 (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.diagnosis = "PNEUMONIA;HUMAN IMMUNODEFIENCY VIRUS;RULE OUT TUBERCULOSIS"
What was the PAC-10 record of the game played on April 20?
CREATE TABLE table_3914 ("#" real,"Date" text,"Opponent" text,"Site/Stadium" text,"Score" text,"Win" text,"Loss" text,"Save" text,"Attendance" real,"Overall Record" text,"Pac-10 Record" text)
SELECT "Pac-10 Record" FROM table_3914 WHERE "Date" = 'April 20'
How many people were elected in 1929
CREATE TABLE table_1342359_17 (candidates VARCHAR,first_elected VARCHAR)
SELECT COUNT(candidates) FROM table_1342359_17 WHERE first_elected = 1929
What is the netflix episode number where Segment D is high-performance engines?
CREATE TABLE table_19903 ("Series Ep." text,"Episode" real,"Netflix" text,"Segment A" text,"Segment B" text,"Segment C" text,"Segment D" text)
SELECT "Netflix" FROM table_19903 WHERE "Segment D" = 'High-Performance Engines'
how many married patients had the procedure long title percutaneous abdominal drainage?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "MARRIED" AND procedures.long_title = "Percutaneous abdominal drainage"
Which country has a Lead of sarah wazney?
CREATE TABLE table_34914 ("Country" text,"Skip" text,"Third" text,"Second" text,"Lead" text)
SELECT "Country" FROM table_34914 WHERE "Lead" = 'sarah wazney'
What is the Score of the game with arsenal win 4-2 on penalties in the attendance field?
CREATE TABLE table_42784 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Attendance" text)
SELECT "Score" FROM table_42784 WHERE "Attendance" = 'arsenal win 4-2 on penalties'
what are the three most frequently ordered procedures for patients that have previously been diagnosed with tracheostomy status in the same hospital encounter during the previous year?
CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom te...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_i...
when the last time patient 031-4987 received a microbiology test on the last hospital visit?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE treatment (treatmentid number,patientun...
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-4987' AND NOT patient.hospitaldischargetime IS NULL ORDER BY ...
Who's the Opponents in the final with a Date of june 10, 1996?
CREATE TABLE table_40762 ("Date" text,"Tournament" text,"Surface" text,"Partnering" text,"Opponents in the final" text,"Score" text)
SELECT "Opponents in the final" FROM table_40762 WHERE "Date" = 'june 10, 1996'
Find the average capacity among rooms in each building with a bar chart, and order in ascending by the y axis please.
CREATE TABLE department (dept_name varchar(20),building varchar(15),budget numeric(12,2))CREATE TABLE advisor (s_ID varchar(5),i_ID varchar(5))CREATE TABLE takes (ID varchar(5),course_id varchar(8),sec_id varchar(8),semester varchar(6),year numeric(4,0),grade varchar(2))CREATE TABLE classroom (building varchar(15),room...
SELECT building, AVG(capacity) FROM classroom GROUP BY building ORDER BY AVG(capacity)
What was the result of the game that was played on february 27, 2000?
CREATE TABLE table_79321 ("Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text)
SELECT "Result" FROM table_79321 WHERE "Date" = 'february 27, 2000'
What is the total played games of a 22 G.A.?
CREATE TABLE table_name_24 (played VARCHAR,ga VARCHAR)
SELECT COUNT(played) FROM table_name_24 WHERE ga = "22"
unique posttypes for software languages.
CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLicense text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId n...
SELECT * FROM PostTypes
give me the number of patients whose days of hospital stay is greater than 6 and drug name is collagenase ointment?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "6" AND prescriptions.drug = "Collagenase Ointment"
How many papers was published in nature communications in 2015
CREATE TABLE journal (journalid int,journalname varchar)CREATE TABLE venue (venueid int,venuename varchar)CREATE TABLE paper (paperid int,title varchar,venueid int,year int,numciting int,numcitedby int,journalid int)CREATE TABLE paperdataset (paperid int,datasetid int)CREATE TABLE paperkeyphrase (paperid int,keyphrasei...
SELECT DISTINCT COUNT(paper.paperid) FROM paper, venue WHERE paper.year = 2015 AND venue.venueid = paper.venueid AND venue.venuename = 'nature communications'
What is in 2002 has a 2001 score 1 0, and a 2000 of 3 0?
CREATE TABLE table_6271 ("Tournament" text,"1999" text,"2000" text,"2001" text,"2002" text,"2003" text,"2004" text,"2005" text,"2006" text,"2007" text,"2008" text,"2009" text,"Career Win-Loss" text)
SELECT "2002" FROM table_6271 WHERE "2001" = '1–0' AND "2000" = '3–0'
In what rounds did the P15 Chassis and tyre D participate?
CREATE TABLE table_10618 ("Entrant" text,"Constructor" text,"Chassis" text,"Engine" text,"Tyre" text,"Driver" text,"Rounds" text)
SELECT "Rounds" FROM table_10618 WHERE "Tyre" = 'd' AND "Chassis" = 'p15'
Tell me the driver for 58 laps
CREATE TABLE table_10174 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Driver" FROM table_10174 WHERE "Laps" = '58'
provide the number of patients whose admission type is elective and lab test name is basophils?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab.label = "Basophils"
What was the constructor of the car that Hermann Lang drove after 1935?
CREATE TABLE table_name_89 (constructor VARCHAR,year VARCHAR,driver VARCHAR)
SELECT constructor FROM table_name_89 WHERE year > 1935 AND driver = "hermann lang"
WordPress Related Questions - 8 Months.
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 PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseR...
SELECT DISTINCT p.Id AS "ID", p.CreationDate AS "Date", p.Tags AS "Tags" FROM Posts AS p WHERE p.CreationDate BETWEEN '2019-01-01' AND '2019-08-28' AND (p.Tags LIKE '%wordpress%' OR p.Tags LIKE 'yoast%' OR p.Tags LIKE '%woocommerce%' OR p.Tags LIKE 'buddypress%' OR p.Tags LIKE 'bbpress%' OR p.Tags LIKE 'contact-form-7%...
Which party is associated with the person who was first elected in 1982?
CREATE TABLE table_18245 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "Party" FROM table_18245 WHERE "First elected" = '1982'
provide the number of patients whose marital status is single and gender is f?
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 text,icustay_id text,drug_type text,drug text,formulary_drug_cd t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.gender = "F"
How many seasons had a rank of 16?
CREATE TABLE table_72292 ("Season" text,"League" text,"Rank" real,"Games" real,"Points" real,"GF" real,"GA" real,"Manager" text,"Top Scorer" text,"Goals" real)
SELECT COUNT("Season") FROM table_72292 WHERE "Rank" = '16'
Write a query that will return the Website URL for the User called Mat Mannion..
CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREA...
SELECT b.Text, b.CreationDate FROM Users AS a INNER JOIN Comments AS b ON a.Id = b.UserId WHERE a.DisplayName = 'Mat Mannion' ORDER BY b.CreationDate DESC
count the number of patients whose admission type was newborn and discharge location was home.
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.discharge_location = "HOME"
What was the largest crowd for North Melbourne
CREATE TABLE table_33685 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT MAX("Crowd") FROM table_33685 WHERE "Home team" = 'north melbourne'
How many candidates were first elected in 1972?
CREATE TABLE table_1341640_11 (candidates VARCHAR,first_elected VARCHAR)
SELECT COUNT(candidates) FROM table_1341640_11 WHERE first_elected = 1972
What was the year opened for North Carolina with a smaller than 21,500 capacity?
CREATE TABLE table_name_50 (year_opened VARCHAR,state VARCHAR,capacity VARCHAR)
SELECT year_opened FROM table_name_50 WHERE state = "north carolina" AND capacity < 21 OFFSET 500
the last year, what were the three most frequent medications prescribed within 2 months to the female patients with age 60 or above after being diagnosed with septic shock?
CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid number,intime time,outtime time)CREATE TABLE labevents ...
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 ...
What is the Writer with an Actual Title that is mork & mindy?
CREATE TABLE table_name_8 (writer VARCHAR,actual_title VARCHAR)
SELECT writer FROM table_name_8 WHERE actual_title = "mork & mindy"
What was the average size of the crowd for matches held at Corio Oval?
CREATE TABLE table_33315 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT AVG("Crowd") FROM table_33315 WHERE "Venue" = 'corio oval'
On what date were there 50,324 votes?
CREATE TABLE table_name_78 (date VARCHAR,votes VARCHAR)
SELECT date FROM table_name_78 WHERE votes = "50,324"
Which Reigns has 92 days held?
CREATE TABLE table_14995 ("Wrestler" text,"Reigns" text,"Days held" real,"Location" text,"Successful defenses" text,"Event" text)
SELECT "Reigns" FROM table_14995 WHERE "Days held" = '92'
Which Venue has a Opponents of halmstad and a Score of 1-1?
CREATE TABLE table_44799 ("Date" text,"Venue" text,"Opponents" text,"Score" text,"Comp" text,"Attendance" text)
SELECT "Venue" FROM table_44799 WHERE "Opponents" = 'halmstad' AND "Score" = '1-1'
what is the cost of a diagnosis for an acute respiratory failure - due to increased co2 production?
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,hospitaladmitsource text,unitadmittime time,unitdischargetime tim...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'diagnosis' AND cost.eventid IN (SELECT diagnosis.diagnosisid FROM diagnosis WHERE diagnosis.diagnosisname = 'acute respiratory failure - due to increased co2 production')
How many ranks by average when Keiron & Brianne are the couple?
CREATE TABLE table_26375386_28 (rank_by_average VARCHAR,couple VARCHAR)
SELECT COUNT(rank_by_average) FROM table_26375386_28 WHERE couple = "Keiron & Brianne"
When the game was played at the EMCG venue, who was the away team?
CREATE TABLE table_55671 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Date" text)
SELECT "Away team" FROM table_55671 WHERE "Venue" = 'emcg'
what is the lab test name for the patient kelly gallardo?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug tex...
SELECT lab.label FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.name = "Kelly Gallardo"
Which station has park & ride lot parking?
CREATE TABLE table_24014 ("Stations" text,"Connections" text,"City/ Neighborhood" text,"Parking" text,"Date Opened" text)
SELECT "Stations" FROM table_24014 WHERE "Parking" = 'Park & Ride Lot'
Which School has a Capacity larger than 730, and an Ofsted smaller than 106135, and a Locality of heaton mersey?
CREATE TABLE table_name_89 (school VARCHAR,locality VARCHAR,capacity VARCHAR,ofsted VARCHAR)
SELECT school FROM table_name_89 WHERE capacity > 730 AND ofsted < 106135 AND locality = "heaton mersey"
What is the fewest losses that had an against score of 2190 and more than 0 draws?
CREATE TABLE table_name_27 (losses INTEGER,against VARCHAR,draws VARCHAR)
SELECT MIN(losses) FROM table_name_27 WHERE against = 2190 AND draws > 0
Most popular Stack Overflow tags.
CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE Post...
SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY num.Num DESC) AS TotalRank, rate.Rate AS QuestionsInMay, num.Num AS QuestionsTotal FROM (SELECT COUNT(PostId) AS Rate, TagName FROM Tags, PostTags, Posts WHERE Tags.Id = PostTags.TagId AND Posts.Id = PostId GROUP BY TagName) AS rate INNER JOIN (SELECT COUNT(PostId)...
Which Ratio has an in in of 17 22?
CREATE TABLE table_name_2 (ratio VARCHAR,in_×_in VARCHAR)
SELECT ratio FROM table_name_2 WHERE in_×_in = "17 × 22"
What is the total number of laps for the time of +7.277 and the grid number of more than 6?
CREATE TABLE table_name_56 (laps INTEGER,time VARCHAR,grid VARCHAR)
SELECT SUM(laps) FROM table_name_56 WHERE time = "+7.277" AND grid > 6
What was Kilgore's (R) percentage when Potts (I) polled at 1%?
CREATE TABLE table_61996 ("Source" text,"Date" text,"Kaine (D)" text,"Kilgore (R)" text,"Potts (I)" text)
SELECT "Kilgore (R)" FROM table_61996 WHERE "Potts (I)" = '1%'
Who earned high points in game 69?
CREATE TABLE table_17323092_8 (high_points VARCHAR,game VARCHAR)
SELECT high_points FROM table_17323092_8 WHERE game = 69
How many teams had 632 points against?
CREATE TABLE table_1676073_12 (points_for VARCHAR,points_against VARCHAR)
SELECT COUNT(points_for) FROM table_1676073_12 WHERE points_against = "632"