instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
TOP 100 Most Altruistic Users.
CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE Votes (Id number,PostId number,Vo...
SELECT Users.DisplayName, Users.Reputation AS "currentrep", COUNT(Votes.Id) AS "bountiesoffered", SUM(Votes.BountyAmount) AS "totalbountyrepoffered", 'http://scifi.stackexchange.com/users/' + CAST(Users.Id AS TEXT(30)) + '/?tab=bounties' AS "viewprofile" FROM Votes INNER JOIN Users ON Votes.UserId = Users.Id INNER JOIN...
how many days have passed since the last time that patient 027-188709 has received a rbc laboratory test during the current hospital visit?
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 treatment (treatmentid number,patientunitstayid number,treatmentname text,...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', lab.labresulttime)) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-188709' AND patient.hosp...
What is the stepping for the processor released June 5, 2007?
CREATE TABLE table_name_25 (stepping VARCHAR,release_date VARCHAR)
SELECT stepping FROM table_name_25 WHERE release_date = "june 5, 2007"
How many yards for the player with 20 solo tackles and under 0 TDs?
CREATE TABLE table_52379 ("Player" text,"Tackles" real,"Solo" real,"Assisted" real,"Sack" real,"Yards" real,"TD's" real)
SELECT SUM("Yards") FROM table_52379 WHERE "Solo" = '20' AND "TD's" < '0'
What is the Date of inauguration of the President with an Age at inauguration of 73years, 262days?
CREATE TABLE table_name_10 (date_of_inauguration VARCHAR,age_at_inauguration VARCHAR)
SELECT date_of_inauguration FROM table_name_10 WHERE age_at_inauguration = "73years, 262days"
Where was the tournament played on Oct. 8, 2006?
CREATE TABLE table_79987 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Opponent" text,"Score" text)
SELECT "Tournament" FROM table_79987 WHERE "Date" = 'oct. 8, 2006'
What was the date of the game with a goal of 7?
CREATE TABLE table_78153 ("Goal" real,"Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text)
SELECT "Date" FROM table_78153 WHERE "Goal" = '7'
What was the first season for Syrianska FC
CREATE TABLE table_1560673_1 (first_season VARCHAR,club VARCHAR)
SELECT first_season FROM table_1560673_1 WHERE club = "Syrianska FC"
What is the lowest Overall, when College is Hardin-Simmons, and when Round is greater than 26?
CREATE TABLE table_44478 ("Round" real,"Pick" real,"Overall" real,"Name" text,"Position" text,"College" text)
SELECT MIN("Overall") FROM table_44478 WHERE "College" = 'hardin-simmons' AND "Round" > '26'
How many different locations does each school have Show bar chart, and I want to sort by the X-axis in asc please.
CREATE TABLE DEPARTMENT (DEPT_CODE varchar(10),DEPT_NAME varchar(30),SCHOOL_CODE varchar(8),EMP_NUM int,DEPT_ADDRESS varchar(20),DEPT_EXTENSION varchar(4))CREATE TABLE PROFESSOR (EMP_NUM int,DEPT_CODE varchar(10),PROF_OFFICE varchar(50),PROF_EXTENSION varchar(4),PROF_HIGH_DEGREE varchar(5))CREATE TABLE CLASS (CLASS_COD...
SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_ADDRESS) FROM DEPARTMENT ORDER BY SCHOOL_CODE
Who was the away team when 6 was the tie no?
CREATE TABLE table_66105 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text)
SELECT "Away team" FROM table_66105 WHERE "Tie no" = '6'
What was the most recent year when a g-force chassis started in 1st?
CREATE TABLE table_33407 ("Year" real,"Chassis" text,"Engine" text,"Start" text,"Finish" text,"Team" text)
SELECT MAX("Year") FROM table_33407 WHERE "Start" = '1st' AND "Chassis" = 'g-force'
What is the number of wins in the playoffs league?
CREATE TABLE table_60659 ("Season" text,"League" text,"Finish" text,"Wins" text,"Losses" text,"Pct." text)
SELECT "Wins" FROM table_60659 WHERE "League" = 'playoffs'
What was the competition when there was no competition for mens doubles?
CREATE TABLE table_1161 ("Year" real,"Mens singles" text,"Womens singles" text,"Mens doubles" text,"Womens doubles" text,"Mixed doubles" text)
SELECT "Womens doubles" FROM table_1161 WHERE "Mens doubles" = 'No competition'
What was England's total?
CREATE TABLE table_name_75 (total VARCHAR,country VARCHAR)
SELECT total FROM table_name_75 WHERE country = "england"
Show the number of documents created in each day and bin document date by weekday and group by document type with a stacked bar chart, and could you order Y in descending order?
CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR(15),Document_Type_Name VARCHAR(255),Document_Type_Description VARCHAR(255))CREATE TABLE Documents (Document_ID INTEGER,Document_Type_Code CHAR(15),Project_ID INTEGER,Document_Date DATETIME,Document_Name VARCHAR(255),Document_Description VARCHAR(255),Other_Details...
SELECT Document_Date, COUNT(Document_Date) FROM Ref_Document_Types AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code GROUP BY Document_Type_Name ORDER BY COUNT(Document_Date) DESC
Show the number of customers for different customer last name in a bar chart, show by the the number of customer last name in ascending.
CREATE TABLE Customers_Cards (card_id INTEGER,customer_id INTEGER,card_type_code VARCHAR(15),card_number VARCHAR(80),date_valid_from DATETIME,date_valid_to DATETIME,other_card_details VARCHAR(255))CREATE TABLE Customers (customer_id INTEGER,customer_first_name VARCHAR(20),customer_last_name VARCHAR(20),customer_address...
SELECT customer_last_name, COUNT(customer_last_name) FROM Customers GROUP BY customer_last_name ORDER BY COUNT(customer_last_name)
what is death status of subject id 2560?
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 demographic.expire_flag FROM demographic WHERE demographic.subject_id = "2560"
Top 100 Users From The Philippines.
CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)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,I...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%philippines%' OR UPPER(Location) LIKE '%PHI' ORDER BY Reputation DESC LIMIT 100
bmi of 25 _ 39.9 kg / m2 both inclusive.
CREATE TABLE table_train_188 ("id" int,"systolic_blood_pressure_sbp" int,"hemoglobin_a1c_hba1c" float,"diastolic_blood_pressure_dbp" int,"body_mass_index_bmi" float,"age" float,"NOUSE" float)
SELECT * FROM table_train_188 WHERE body_mass_index_bmi > 25 AND body_mass_index_bmi < 39.9
What is the average year they finished 5th in santiago, chile?
CREATE TABLE table_53675 ("Year" real,"Competition" text,"Venue" text,"Position" text,"Event" text)
SELECT AVG("Year") FROM table_53675 WHERE "Position" = '5th' AND "Venue" = 'santiago, chile'
How old is each gender, on average?
CREATE TABLE personfriend (name text,friend text,year number)CREATE TABLE person (name text,age number,city text,gender text,job text)
SELECT AVG(age), gender FROM person GROUP BY gender
how many patients whose age is less than 67 and year of death is less than or equal to 2122?
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 (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "67" AND demographic.dod_year <= "2122.0"
What is the lowest grid that has over 67 laps with stefan bellof driving?
CREATE TABLE table_name_52 (grid INTEGER,laps VARCHAR,driver VARCHAR)
SELECT MIN(grid) FROM table_name_52 WHERE laps > 67 AND driver = "stefan bellof"
How many people named Nick Lucas are on the show?
CREATE TABLE table_12441518_1 (portrayed_by VARCHAR,character VARCHAR)
SELECT COUNT(portrayed_by) FROM table_12441518_1 WHERE character = "Nick Lucas"
how many times patient 15905 until 3 years ago visited the hospital.
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 number,amount number)CREATE TABLE d_items (row_id number,itemid number...
SELECT COUNT(DISTINCT admissions.hadm_id) FROM admissions WHERE admissions.subject_id = 15905 AND DATETIME(admissions.admittime) <= DATETIME(CURRENT_TIME(), '-3 year')
What is the casting temperature for a hardness of 22?
CREATE TABLE table_name_88 (casting_at__°c_ VARCHAR,hardness VARCHAR)
SELECT casting_at__°c_ FROM table_name_88 WHERE hardness = "22"
What is the average Frequency MHz that is on farwell, texas?
CREATE TABLE table_name_72 (frequency_mhz INTEGER,city_of_license VARCHAR)
SELECT AVG(frequency_mhz) FROM table_name_72 WHERE city_of_license = "farwell, texas"
how many patients whose ethnicity is white and drug route is id?
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,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE" AND prescriptions.route = "ID"
Who directed the episode that aired on july15,2012?
CREATE TABLE table_20704243_6 (directed_by VARCHAR,original_air_date VARCHAR)
SELECT directed_by FROM table_20704243_6 WHERE original_air_date = "July15,2012"
How many position in channel 4s ratings a have February 24, 2010 as the original airing on channel 4?
CREATE TABLE table_22170495_6 (position_in_channel_4s_ratings_a VARCHAR,original_airing_on_channel_4 VARCHAR)
SELECT COUNT(position_in_channel_4s_ratings_a) FROM table_22170495_6 WHERE original_airing_on_channel_4 = "February 24, 2010"
What is the name of the roller coaster that opened in 2000 in Brighton Pier?
CREATE TABLE table_54287 ("Name" text,"Model" text,"Park" text,"Country" text,"Opened" real)
SELECT "Name" FROM table_54287 WHERE "Opened" = '2000' AND "Park" = 'brighton pier'
count the number of patients whose primary disease is abdominal abscess and who have died in or before the year 2179.
CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ABDOMINAL ABSCESS" AND demographic.dod_year <= "2179.0"
What is the Date of the game where the Cavaliers have a Record of 15-27?
CREATE TABLE table_45626 ("Date" text,"H/A/N" text,"Opponent" text,"Score" text,"Record" text)
SELECT "Date" FROM table_45626 WHERE "Record" = '15-27'
What year did the Grizzlies play for the UNLV team?
CREATE TABLE table_name_81 (years_for_grizzlies VARCHAR,school_club_team VARCHAR)
SELECT years_for_grizzlies FROM table_name_81 WHERE school_club_team = "unlv"
Which driver drove a Ferrari in the 2007 European Grand Prix with a grid less than 3?
CREATE TABLE table_32123 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Driver" FROM table_32123 WHERE "Constructor" = 'ferrari' AND "Grid" < '3'
What is Date, when Margin Of Victory is 4 Strokes?
CREATE TABLE table_name_1 (date VARCHAR,margin_of_victory VARCHAR)
SELECT date FROM table_name_1 WHERE margin_of_victory = "4 strokes"
how many creatures are included before page 42 ?
CREATE TABLE table_204_427 (id number,"creature (other planes)" text,"page" text,"other appearances" text,"variants" text,"description" text)
SELECT COUNT("creature (other planes)") FROM table_204_427 WHERE "page" < 42
A bar chart for what are the number of the distinct visit dates?, and rank total number from low to high order.
CREATE TABLE Royal_Family (Royal_Family_ID INTEGER,Royal_Family_Details VARCHAR(255))CREATE TABLE Visits (Visit_ID INTEGER,Tourist_Attraction_ID INTEGER,Tourist_ID INTEGER,Visit_Date DATETIME,Visit_Details VARCHAR(40))CREATE TABLE Street_Markets (Market_ID INTEGER,Market_Details VARCHAR(255))CREATE TABLE Photos (Photo_...
SELECT Visit_Date, COUNT(Visit_Date) FROM Visits ORDER BY COUNT(Visit_Date)
Which Coach has a Most Improved of rory thompson?
CREATE TABLE table_name_75 (coach VARCHAR,most_improved VARCHAR)
SELECT coach FROM table_name_75 WHERE most_improved = "rory thompson"
What is the fewest number of top-25s for events with more than 13 cuts made?
CREATE TABLE table_name_31 (top_25 INTEGER,cuts_made INTEGER)
SELECT MIN(top_25) FROM table_name_31 WHERE cuts_made > 13
what is the five most commonly ordered procedure in patients aged 20s in 2104?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,...
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 20 AND 29) AND STRFTIME('%y', treatment.treatmenttime) = '2104' GROUP BY treatment.t...
what are all the adversary where the beginning is 1899
CREATE TABLE table_2846320_4 (rival VARCHAR,first_meeting VARCHAR)
SELECT rival FROM table_2846320_4 WHERE first_meeting = 1899
What are the 2fm's for erp 16?
CREATE TABLE table_18475946_2 (erp__kw_ VARCHAR)
SELECT 2 AS fm__mhz_ FROM table_18475946_2 WHERE erp__kw_ = "16"
Find the ids of all distinct customers who made order after some orders that were Cancelled.
CREATE TABLE Customer_Orders (customer_id VARCHAR,order_date INTEGER,order_status_code VARCHAR)
SELECT DISTINCT customer_id FROM Customer_Orders WHERE order_date > (SELECT MIN(order_date) FROM Customer_Orders WHERE order_status_code = "Cancelled")
what is the highest attendance for week 3?
CREATE TABLE table_45180 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real)
SELECT MAX("Attendance") FROM table_45180 WHERE "Week" = '3'
What is the PSIP Short name for the Channel that is less than 51.6?
CREATE TABLE table_51056 ("Channel" real,"Video" text,"Aspect" text,"PSIP Short Name" text,"Programming" text)
SELECT "PSIP Short Name" FROM table_51056 WHERE "Channel" < '51.6'
What is the week 1 with candice hunnicutt in week 3?
CREATE TABLE table_78885 ("Week 1" text,"Week 2" text,"Week 3" text,"Week 4" text,"Week 5" text)
SELECT "Week 1" FROM table_78885 WHERE "Week 3" = 'candice hunnicutt'
Name the oberliga sudwest for spvgg unterhaching for 1988-89
CREATE TABLE table_14242137_4 (oberliga_südwest VARCHAR,oberliga_bayern VARCHAR,season VARCHAR)
SELECT oberliga_südwest FROM table_14242137_4 WHERE oberliga_bayern = "SpVgg Unterhaching" AND season = "1988-89"
What opponent played on 07-09-2012?
CREATE TABLE table_name_26 (opponent VARCHAR,date VARCHAR)
SELECT opponent FROM table_name_26 WHERE date = "07-09-2012"
Most popular StackOverflow tags in 2011 & 2012.
CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class number,TagBased boolean)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE Tags (Id numbe...
SELECT num.TagName AS Tag, ROW_NUMBER() OVER (ORDER BY rate.Rate DESC) AS Rank, 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 AND P...
Name the total number of date for score being l 106 116 (ot)
CREATE TABLE table_23281862_10 (date VARCHAR,score VARCHAR)
SELECT COUNT(date) FROM table_23281862_10 WHERE score = "L 106–116 (OT)"
how many votes were not attributed to the australian labor party ?
CREATE TABLE table_203_494 (id number,"party" text,"votes" number,"%" number,"swing" number,"seats" number,"change" number)
SELECT SUM("votes") FROM table_203_494 WHERE "party" <> 'australian labor party'
Provide the number of urgent hospital admission patients who have syncope telemetry as their primary disease.
CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.diagnosis = "SYNCOPE;TELEMETRY"
What is the name of immunity when the finish is 3rd voted out day 9?
CREATE TABLE table_30716 ("First air date" text,"Reward" text,"Immunity" text,"Eliminated" text,"Vote" text,"Finish" text)
SELECT "Immunity" FROM table_30716 WHERE "Finish" = '3rd Voted Out Day 9'
Which country is Leo Najorda from?
CREATE TABLE table_53677 ("Pick" real,"Player" text,"Country of origin*" text,"PBA team" text,"College" text)
SELECT "Country of origin*" FROM table_53677 WHERE "Player" = 'leo najorda'
When is the winner olympiacos, the venue is georgios karaiskakis stadium and the runner-up is iraklis?
CREATE TABLE table_name_12 (year VARCHAR,runner_up VARCHAR,winner VARCHAR,venue VARCHAR)
SELECT year FROM table_name_12 WHERE winner = "olympiacos" AND venue = "georgios karaiskakis stadium" AND runner_up = "iraklis"
Death to 'Belongs on SF'. Comments from migrations into Server Fault about migrating to Server Fault
CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment te...
SELECT c.PostId AS "post_link", c.Text AS Commented FROM Comments AS C WHERE C.Text LIKE '%belongs on server fault%' OR C.Text LIKE '%belongs on serverfault%' OR C.Text LIKE '%belongs on sf%' ORDER BY c.CreationDate DESC LIMIT 300
What is the stadium for the city of Braga?
CREATE TABLE table_62103 ("Club" text,"Season's Last Head Coach" text,"City" text,"Stadium" text,"2004-2005 season" text)
SELECT "Stadium" FROM table_62103 WHERE "City" = 'braga'
what number of patients who had exteriorization of small intestine stayed in the hospital for more than 2 days?
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.days_stay > "2" AND procedures.long_title = "Exteriorization of small intestine"
Name the city of license with frequency of 90.1 fm
CREATE TABLE table_71970 ("Call sign" text,"Frequency" text,"City of license" text,"Facility ID" real,"ERP / Power W" real,"Height m (ft)" text,"Class" text)
SELECT "City of license" FROM table_71970 WHERE "Frequency" = '90.1 fm'
How many of the patients admitted before the year 2180 had a liver transplant ?
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 COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "LIVER TRANSPLANT" AND demographic.admityear < "2180"
What is the score when the tie no is 29?
CREATE TABLE table_name_65 (score VARCHAR,tie_no VARCHAR)
SELECT score FROM table_name_65 WHERE tie_no = "29"
On what day was Game 7 of this season played?
CREATE TABLE table_name_78 (date VARCHAR,game VARCHAR)
SELECT date FROM table_name_78 WHERE game = "game 7"
how many patients received chest x-ray within 2 months after being diagnosed with hypoxemia since 2 years ago?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid n...
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'hypoxemia' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-2 year')) AS t1 JOIN (SELECT ...
when was the last time patient 007-9853 had been prescribed senna-docusate and chlorhexidine gluconate ud liq 15ml at the same time in 10/2102?
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,wardid number,admissionheight number,admissionweight number,disch...
SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'senna-docusate' AND patient.uniquepid = '007-9853' AND STRFTIME('%y-%m', medication.drugstarttime) = '2102-10') AS t1 JOI...
Who directed the episode with the production code 209?
CREATE TABLE table_20712 ("Number in series" real,"Broadcast Order" text,"Title" text,"Directed by" text,"Written by" text,"Original airdate" text,"Production Code" real)
SELECT "Directed by" FROM table_20712 WHERE "Production Code" = '209'
What's the language of the school founded in 1949?
CREATE TABLE table_1930857_1 (language VARCHAR,year_founded VARCHAR)
SELECT language FROM table_1930857_1 WHERE year_founded = "1949"
Get the number of posts there are.
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 CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwne...
SELECT COUNT(Votes.Id) FROM Votes WHERE VoteTypeId = 4
Are there any Adv Hlth Assess courses of 18 credits ?
CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE TABLE student_record (student_id int,course_id int,semester int,grade varchar,how varchar,transfer_source varchar,earn_credit varchar,r...
SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%Adv Hlth Assess%' OR name LIKE '%Adv Hlth Assess%') AND credits = 18
What is the name of each course and the corresponding number of student enrollment?
CREATE TABLE student_tests_taken (registration_id number,date_test_taken time,test_result text)CREATE TABLE student_course_enrolment (registration_id number,student_id number,course_id number,date_of_enrolment time,date_of_completion time)CREATE TABLE students (student_id number,date_of_registration time,date_of_latest...
SELECT T1.course_name, COUNT(*) FROM courses AS T1 JOIN student_course_enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name
What year was the Album/Song Speaking louder than before?
CREATE TABLE table_name_39 (year INTEGER,album___song VARCHAR)
SELECT SUM(year) FROM table_name_39 WHERE album___song = "speaking louder than before"
What was the Attendance on November 6, 1960?
CREATE TABLE table_name_65 (attendance VARCHAR,date VARCHAR)
SELECT attendance FROM table_name_65 WHERE date = "november 6, 1960"
how many times lactated ringers iv : 1000 ml bag is prescribed?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmen...
SELECT COUNT(*) FROM medication WHERE medication.drugname = 'lactated ringers iv : 1000 ml bag'
Show me about the distribution of name and meter_100 in a bar chart, and display y axis in asc order.
CREATE TABLE event (ID int,Name text,Stadium_ID int,Year text)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,Country text,Opening_year...
SELECT name, meter_100 FROM swimmer ORDER BY meter_100
what is the difference between germany and spains total medals ?
CREATE TABLE table_203_374 (id number,"rank" number,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number)
SELECT (SELECT "total" FROM table_203_374 WHERE "nation" = 'germany') - (SELECT "total" FROM table_203_374 WHERE "nation" = 'spain')
What is the damage of storm three?
CREATE TABLE table_name_58 (damage__millions_usd__ VARCHAR,storm_name VARCHAR)
SELECT damage__millions_usd__ FROM table_name_58 WHERE storm_name = "three"
What was the total when the first was November 1966?
CREATE TABLE table_name_42 (total INTEGER,first VARCHAR)
SELECT SUM(total) FROM table_name_42 WHERE first = "november 1966"
Name the total number of director for oro diablo
CREATE TABLE table_22156 ("Year (Ceremony)" text,"Original title" text,"Film title used in nomination" text,"Director" text,"Result" text)
SELECT COUNT("Director") FROM table_22156 WHERE "Original title" = 'Oro Diablo'
what is the name of the processor for model x33x0?
CREATE TABLE table_26584 ("Processor" text,"Brand Name" text,"Model (list)" text,"Cores" real,"L2 Cache" text,"Socket" text,"TDP" text)
SELECT "Processor" FROM table_26584 WHERE "Model (list)" = 'X33x0'
which envoy was the first appointed by woodrow wilson ?
CREATE TABLE table_203_778 (id number,"representative" text,"title" text,"presentation\nof credentials" text,"termination\nof mission" text,"appointed by" text)
SELECT "representative" FROM table_203_778 WHERE "appointed by" = 'woodrow wilson' ORDER BY "termination\nof mission" LIMIT 1
Which team drafted Michael Orn?
CREATE TABLE table_2850912_10 (nhl_team VARCHAR,player VARCHAR)
SELECT nhl_team FROM table_2850912_10 WHERE player = "Michael Orn"
How many figures are named for security forces in 1998?
CREATE TABLE table_21636599_2 (security_forces VARCHAR,period VARCHAR)
SELECT COUNT(security_forces) FROM table_21636599_2 WHERE period = 1998
Show sum team id from each all home, and list Y in ascending order.
CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,Enrollment real,Nickname text,Primary_conference text)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_Perce...
SELECT All_Home, SUM(Team_ID) FROM basketball_match GROUP BY All_Home ORDER BY SUM(Team_ID)
until 1 year ago, what are the four most frequent medications prescribed within 2 months to the patients aged 40s after they have been diagnosed with seizures?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissio...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'seizures' AND DATETIME(diagnosis.diagnosistime) <=...
What day in February had an opponent of @ Colorado Rockies?
CREATE TABLE table_name_57 (february INTEGER,opponent VARCHAR)
SELECT SUM(february) FROM table_name_57 WHERE opponent = "@ colorado rockies"
TOP VBA PERFORMERS for date range. Top VBA/Excel Users for specified date range (or enter 0 in both for 'last 10 days with data'). Ranked by Overall: Sum of ( comments + score + (Answers * 2) )
CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,Creatio...
SELECT c.UserId, COUNT(c.Id) AS qComments FROM Comments AS c JOIN Posts AS q ON c.PostId = q.Id WHERE c.CreationDate >= DATEADD(d, -10, (SELECT MAX(CreationDate) FROM Posts)) AND (q.Tags LIKE '%vba>%' OR q.Tags LIKE '%excel%') GROUP BY c.UserId ORDER BY COUNT(c.Id) DESC
what is the average total cost of a hospital that includes a medicine called heparin flush since 2102?
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 transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid numb...
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'heparin flush') AND STRFTIME('%y', cost.chargetime) >= '2102' GROUP BY cost.hadm_id) AS t1
What is the score of the match with opponents Gretchen Magers Kelly Jones?
CREATE TABLE table_1028356_3 (score VARCHAR,opponents VARCHAR)
SELECT score FROM table_1028356_3 WHERE opponents = "Gretchen Magers Kelly Jones"
What is the most points when Maserati made the engine, and a Entrant of owen racing organisation?
CREATE TABLE table_80233 ("Year" real,"Entrant" text,"Chassis" text,"Engine" text,"Points" real)
SELECT MAX("Points") FROM table_80233 WHERE "Engine" = 'maserati' AND "Entrant" = 'owen racing organisation'
Dead users with less than 200 rep, grouped by month they joined.
CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment te...
SELECT YEAR(Users.CreationDate), MONTH(Users.CreationDate), COUNT(Users.CreationDate) FROM Posts JOIN Users ON Users.Id = Posts.OwnerUserId WHERE Users.Reputation < 200 GROUP BY YEAR(Users.CreationDate), MONTH(Users.CreationDate) ORDER BY YEAR(Users.CreationDate), MONTH(Users.CreationDate)
Sort all captain names by their ages from old to young.
CREATE TABLE captain (captain_id number,name text,ship_id number,age text,class text,rank text)CREATE TABLE ship (ship_id number,name text,type text,built_year number,class text,flag text)
SELECT name FROM captain ORDER BY age DESC
Return the minimum, average and maximum distances traveled across all aircrafts.
CREATE TABLE flight (flno number,origin text,destination text,distance number,departure_date time,arrival_date time,price number,aid number)CREATE TABLE aircraft (aid number,name text,distance number)CREATE TABLE certificate (eid number,aid number)CREATE TABLE employee (eid number,name text,salary number)
SELECT MIN(distance), AVG(distance), MAX(distance) FROM aircraft
For short patent type of protections, what type of PCT route is available?
CREATE TABLE table_2279413_1 (pct_route_available VARCHAR,type_of_protection VARCHAR)
SELECT pct_route_available FROM table_2279413_1 WHERE type_of_protection = "short patent"
provide the number of patients whose item id is 51455?
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,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51455"
what is the number of patients whose marital status is single and gender is m?
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,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.gender = "M"
triglycerides greater than or equal to 500 mg / dl
CREATE TABLE table_dev_21 ("id" int,"gender" string,"leukopenia" int,"dialysis" bool,"hemoglobin_a1c_hba1c" float,"cd4_count" int,"platelets" int,"renal_disease" bool,"fasting_triglycerides" int,"hyperlipidemia" bool,"lymphopenia" int,"hba1c" float,"fasting_ldl_cholesterol" int,"serum_creatinine" float,"baseline_hemogl...
SELECT * FROM table_dev_21 WHERE triglyceride_tg >= 500
what is the most laps for driver jackie stewart?
CREATE TABLE table_name_43 (laps INTEGER,driver VARCHAR)
SELECT MAX(laps) FROM table_name_43 WHERE driver = "jackie stewart"
In which townlands is the civil parish Monkstown?
CREATE TABLE table_4292 ("Townland" text,"Area(acres)" real,"Barony" text,"Civil parish" text,"Poor law union" text)
SELECT "Townland" FROM table_4292 WHERE "Civil parish" = 'Monkstown'
Name the save for braves for may 15
CREATE TABLE table_name_86 (save VARCHAR,opponent VARCHAR,date VARCHAR)
SELECT save FROM table_name_86 WHERE opponent = "braves" AND date = "may 15"