instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
What is the location and attendance total from the game on December 1?
CREATE TABLE table_29628 ("Game" real,"December" real,"Opponent" text,"Score" text,"Location/Attendance" text,"Record" text,"Points" real)
SELECT "Location/Attendance" FROM table_29628 WHERE "December" = '1'
Which Rank is the lowest one that has Points larger than 52, and a Year larger than 1970?
CREATE TABLE table_75473 ("Rank" real,"Player" text,"Year" real,"Game" text,"Points" real)
SELECT MIN("Rank") FROM table_75473 WHERE "Points" > '52' AND "Year" > '1970'
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about the average of employee_id over the hire_date bin hire_date by weekday by a bar chart, and show by the mean employee id from high to low.
CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2),COMMISSION_PCT decima...
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(EMPLOYEE_ID) DESC
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 sort from low to high by the Code.
CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)
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
provide the drug type and drug code for hydrocerin?
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 prescriptions.drug_type, prescriptions.formulary_drug_cd FROM prescriptions WHERE prescriptions.drug = "Hydrocerin"
when was patient 028-7951 admitted for the first time to the hospital until 2104?
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 patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '028-7951' AND STRFTIME('%y', patient.hospitaladmittime) <= '2104' ORDER BY patient.hospitaladmittime LIMIT 1
List the total numbers of Evian Masters tournaments.
CREATE TABLE table_22206 ("No." real,"Date" text,"Tournament" text,"Winning score" text,"To par" text,"Margin of victory" text,"Runner(s)-up" text,"Winners share ($)" real)
SELECT MAX("No.") FROM table_22206 WHERE "Tournament" = 'Evian Masters'
What is the entrant for 1967?
CREATE TABLE table_name_76 (entrant VARCHAR,year VARCHAR)
SELECT entrant FROM table_name_76 WHERE year = 1967
Tell me the lowest interview for oklahoma and swimsuit less than 8.8
CREATE TABLE table_name_46 (interview INTEGER,state VARCHAR,swimsuit VARCHAR)
SELECT MIN(interview) FROM table_name_46 WHERE state = "oklahoma" AND swimsuit < 8.8
uncontrolled hypertension ( i.e., systolic blood pressure > 160 mm hg, or a diastolic blood pressure > 95 mmhg based on an average of 3 readings sitting )
CREATE TABLE table_dev_51 ("id" int,"gender" string,"antihypertensive_agents" bool,"systolic_blood_pressure_sbp" int,"hemoglobin_a1c_hba1c" float,"obesity" bool,"diastolic_blood_pressure_dbp" int,"body_mass_index_bmi" float,"hypertension" bool,"prehypertension" bool,"age" float,"glycosylated_hemoglobin" float,"NOUSE" f...
SELECT * FROM table_dev_51 WHERE hypertension = 1 OR systolic_blood_pressure_sbp > 160 OR diastolic_blood_pressure_dbp > 95
How many stories have a height less than 138 meters with a completion date in 1971?
CREATE TABLE table_45205 ("Name" text,"Location" text,"Height (m)" real,"Stories" real,"Year of completion" real)
SELECT "Stories" FROM table_45205 WHERE "Height (m)" < '138' AND "Year of completion" = '1971'
What is the highest attendance among Group E games?
CREATE TABLE table_14003 ("Date" text,"Time (CET)" text,"Res." text,"Round" text,"Attendance" real)
SELECT MAX("Attendance") FROM table_14003 WHERE "Round" = 'group e'
Who plays for the chicago bulls?
CREATE TABLE table_name_92 (player VARCHAR,team VARCHAR)
SELECT player FROM table_name_92 WHERE team = "chicago bulls"
(EXAMPLE #3) Time to First Answer (Link to Q using 3rd join to [Posts]).
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 PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time...
SELECT q.Id AS "qid", t.Title AS "link", q.CreationDate AS "question_date", MIN(a.CreationDate) AS "1st_answer_date", DATEDIFF(n, q.CreationDate, MIN(a.CreationDate)) AS "min_to_1st_answer" FROM Posts AS q LEFT OUTER JOIN Posts AS a ON q.Id = a.ParentId LEFT OUTER JOIN Posts AS t ON q.Id = t.Id WHERE q.PostTypeId = 1 A...
Can you tell me the total number of Gain that has the Name of williams, jonathan, and the Loss larger than 3?
CREATE TABLE table_48410 ("Name" text,"Gain" real,"Loss" real,"Long" real,"Avg/g" real)
SELECT COUNT("Gain") FROM table_48410 WHERE "Name" = 'williams, jonathan' AND "Loss" > '3'
How many vap values are associated with 140469 valid votes?
CREATE TABLE table_29055 ("District" real,"Region" text,"Communes" text,"Population (2002 census)" real,"% of total population" text,"VAP" real,"Enrolled" real,"Total votes" real,"Valid votes" real,"Turnout" text,"E/VAP" text,"T/VAP" text,"V/VAP" text)
SELECT COUNT("VAP") FROM table_29055 WHERE "Valid votes" = '140469'
Which result has a Score of 1 1?
CREATE TABLE table_name_23 (result VARCHAR,score VARCHAR)
SELECT result FROM table_name_23 WHERE score = "1–1"
Which township has a longitude of -98.741656?
CREATE TABLE table_22467 ("Township" text,"County" text,"Pop. (2010)" real,"Land (sqmi)" text,"Water (sqmi)" text,"Latitude" text,"Longitude" text,"GEO ID" real,"ANSI code" real)
SELECT "Township" FROM table_22467 WHERE "Longitude" = '-98.741656'
how many patients are in admission location clinic referral/premature and with diagnosis icd9 code 431?
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)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND diagnoses.icd9_code = "431"
how many patients born before 2066 undertook procedure icd9 code 9983?
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)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2066" AND procedures.icd9_code = "9983"
Questions with X amount of votes..
CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate tim...
SELECT p.Id AS "post_link", p.Score, (SELECT COUNT(v.Id) FROM Votes AS v WHERE v.VoteTypeId IN (2, 3) AND v.PostId = p.Id) AS VoteCount, p.CreationDate FROM Posts AS p WHERE p.Score < '##ScoreInput##' AND (p.CreationDate < GETDATE() AND p.CreationDate > DATEADD(day, -'##DaysAgo##', GETDATE())) ORDER BY p.CreationDate D...
how many patients with newborn primary disease had joint fluid lab test?
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "NEWBORN" AND lab.fluid = "Joint Fluid"
Which kind of pesticide is the easiest to be tested?
CREATE TABLE sampledata15 (sample_pk number,state text,year text,month text,day text,site text,commod text,source_id text,variety text,origin text,country text,disttype text,commtype text,claim text,quantity number,growst text,packst text,distst text)CREATE TABLE resultsdata15 (sample_pk number,commod text,commtype tex...
SELECT MAX(pestcode) FROM resultsdata15
What is To par, when Country is 'United States', and when Player is 'Jay Haas'?
CREATE TABLE table_61998 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text,"Money ($)" real)
SELECT "To par" FROM table_61998 WHERE "Country" = 'united states' AND "Player" = 'jay haas'
What is the total number of positions when there are more than 48 goals against, 1 of 29 points are played, and less than 34 games have been played?
CREATE TABLE table_name_61 (position VARCHAR,played VARCHAR,goals_against VARCHAR,points_1 VARCHAR)
SELECT COUNT(position) FROM table_name_61 WHERE goals_against > 48 AND points_1 = "29" AND played < 34
Tell me the country for lane of 6
CREATE TABLE table_4328 ("Heat Rank" real,"Lane" real,"Swimmer" text,"Country" text,"Time" real,"Overall Rank" text)
SELECT "Country" FROM table_4328 WHERE "Lane" = '6'
What was the title for the Undercard of Stevenson/Bellew?
CREATE TABLE table_25840200_1 (titles VARCHAR,notes VARCHAR)
SELECT titles FROM table_25840200_1 WHERE notes = "Undercard of Stevenson/Bellew"
From what school was the player drafted in round 3?
CREATE TABLE table_name_88 (school VARCHAR,round VARCHAR)
SELECT school FROM table_name_88 WHERE round = 3
list the flights from BALTIMORE to SEATTLE that stop in MINNEAPOLIS
CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE fare (fare_id int,from_airport varchar,to_airport varchar,fare_basis_code text,fare_airline text,restriction_code text,one_direction_cost int,round_trip_cost int,round_trip_required varchar)CREATE TABLE dual_carrier (main_airl...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SEATTLE' AND CITY_2.ci...
What is Videoconferencing, when Synchronous Conferencing is 'No', when Web Conferencing is 'No', and when Faxing is 'Yes'?
CREATE TABLE table_59588 ("Name" text,"E-mail server" text,"Faxing" text,"Instant messaging" text,"Telephony" text,"Videoconferencing" text,"Web conferencing" text,"Data conferencing" text,"Application sharing" text,"Electronic meeting system" text,"Synchronous conferencing" text)
SELECT "Videoconferencing" FROM table_59588 WHERE "Synchronous conferencing" = 'no' AND "Web conferencing" = 'no' AND "Faxing" = 'yes'
Week smaller than 4, and a Game Site of rca dome, and a Opponent of new england patriots involves what date?
CREATE TABLE table_37637 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Record" text,"Game Site" text,"Attendance" text)
SELECT "Date" FROM table_37637 WHERE "Week" < '4' AND "Game Site" = 'rca dome' AND "Opponent" = 'new england patriots'
Top Irish users on Stackoverflow.
CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE T...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE Id = 1362136 ORDER BY Reputation DESC
Find the total claimed amount of all the claims.
CREATE TABLE Claims (Amount_Claimed INTEGER)
SELECT SUM(Amount_Claimed) FROM Claims
What district had someone first elected in 1932?
CREATE TABLE table_18642 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "District" FROM table_18642 WHERE "First elected" = '1932'
What was the total number of first down on October 23?
CREATE TABLE table_20334 ("Week" real,"Date" text,"Result" text,"Record" text,"Opponent" text,"Points For" real,"Points Against" real,"First Downs" real,"Attendance" real)
SELECT COUNT("First Downs") FROM table_20334 WHERE "Date" = 'October 23'
Which 1990-1991 is the average one that has Played of 38, and Points of 40?
CREATE TABLE table_name_26 (played VARCHAR,points VARCHAR)
SELECT AVG(1990 AS _1991) FROM table_name_26 WHERE played = 38 AND points = 40
What is the maximum elevation in netherlands?
CREATE TABLE table_26726 ("Country or region" text,"Highest point" text,"Maximum elevation" text,"Lowest point" text,"Minimum elevation" text,"Elevation span" text)
SELECT "Maximum elevation" FROM table_26726 WHERE "Country or region" = 'Netherlands'
provide the number of patients whose marital status is single and item id is 50911?
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "SINGLE" AND lab.itemid = "50911"
What is the average score of player lee trevino, who has a t8 place?
CREATE TABLE table_name_39 (score INTEGER,place VARCHAR,player VARCHAR)
SELECT AVG(score) FROM table_name_39 WHERE place = "t8" AND player = "lee trevino"
What is the highest percent of yes Alberta, which had less than 60.2 vote no, has?
CREATE TABLE table_11114 ("Jurisdiction" text,"Voted Yes" real,"Percent Yes" real,"Voted No" real,"Percent No" real)
SELECT MAX("Percent Yes") FROM table_11114 WHERE "Jurisdiction" = 'alberta' AND "Percent No" < '60.2'
What was the free score of the skater with a total of 156.67?
CREATE TABLE table_53591 ("Rank" real,"Name" text,"Nation" text,"Placings" real,"Figures" real,"Free" real,"Total" real)
SELECT "Free" FROM table_53591 WHERE "Total" = '156.67'
How many wins were there when the byes were more than 3?
CREATE TABLE table_name_27 (wins VARCHAR,byes INTEGER)
SELECT COUNT(wins) FROM table_name_27 WHERE byes > 3
give me the number of patients whose days of hospital stay is greater than 27 and diagnoses short title is intermed coronary synd?
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)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "27" AND diagnoses.short_title = "Intermed coronary synd"
what is the minimum age of patients who stayed in hospital for 4 days and were admitted in or after the year 2177?
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 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 ...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.days_stay = "4" AND demographic.admityear >= "2177"
What is the lowest Number, when School/Club Team is Misamis Institute?
CREATE TABLE table_name_30 (number INTEGER,school_club_team VARCHAR)
SELECT MIN(number) FROM table_name_30 WHERE school_club_team = "misamis institute"
Which Points have a Lost smaller than 1, and Games larger than 7?
CREATE TABLE table_name_81 (points INTEGER,lost VARCHAR,games VARCHAR)
SELECT MAX(points) FROM table_name_81 WHERE lost < 1 AND games > 7
Which party's 1st member is William Denison in the election of 1832?
CREATE TABLE table_80366 ("Election" text,"1st Member" text,"1st Party" text,"2nd Member" text,"2nd Party" text)
SELECT "1st Party" FROM table_80366 WHERE "1st Member" = 'william denison' AND "Election" = '1832'
What is the total swimsuit with Preliminaries smaller than 8.27?
CREATE TABLE table_name_48 (swimsuit INTEGER,preliminaries INTEGER)
SELECT SUM(swimsuit) FROM table_name_48 WHERE preliminaries < 8.27
Who is the Second with Nikolina Petric as Third?
CREATE TABLE table_75267 ("Nation" text,"Skip" text,"Third" text,"Second" text,"Lead" text)
SELECT "Second" FROM table_75267 WHERE "Third" = 'nikolina petric'
What is the lowest attendance?
CREATE TABLE table_27551 ("Week" real,"Date" text,"Kickoff" text,"Opponent" text,"Final score" text,"Team record" text,"Game site" text,"Attendance" real)
SELECT MIN("Attendance") FROM table_27551
Name the record for april 6
CREATE TABLE table_name_20 (record VARCHAR,date VARCHAR)
SELECT record FROM table_name_20 WHERE date = "april 6"
What college is getting a player that attends Wichita Heights High School?
CREATE TABLE table_name_32 (college VARCHAR,school VARCHAR)
SELECT college FROM table_name_32 WHERE school = "wichita heights high school"
Team of elgin city, and a Highest smaller than 537 had what total number of average?
CREATE TABLE table_34732 ("Team" text,"Stadium" text,"Capacity" real,"Highest" real,"Lowest" real,"Average" real)
SELECT COUNT("Average") FROM table_34732 WHERE "Team" = 'elgin city' AND "Highest" < '537'
How many positions were given when 30 points were won?
CREATE TABLE table_26769 ("Season" real,"Series" text,"Team" text,"Races" real,"Wins" real,"Poles" real,"F/Laps" real,"Podiums" real,"Points" text,"Position" text)
SELECT COUNT("Position") FROM table_26769 WHERE "Points" = '30'
What is the average Week when there were more than 63,866 people in attendance on September 7, 1981?
CREATE TABLE table_40281 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real)
SELECT AVG("Week") FROM table_40281 WHERE "Attendance" > '63,866' AND "Date" = 'september 7, 1981'
What is the highest 2010 population having GEO ID of 3802763220 and longitude over -98.936777?
CREATE TABLE table_name_58 (pop__2010_ INTEGER,geo_id VARCHAR,longitude VARCHAR)
SELECT MAX(pop__2010_) FROM table_name_58 WHERE geo_id = 3802763220 AND longitude > -98.936777
What is listed for the High rebounds on the Date of March 31?
CREATE TABLE table_8703 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"Location Attendance" text,"Record" text)
SELECT "High rebounds" FROM table_8703 WHERE "Date" = 'march 31'
Users with more than 28 questions.
CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDate time,CreationModeratorId number,ApprovalDa...
WITH QuestionsPerUser AS (SELECT U.Id AS UserId, COUNT(*) AS QuestionCount FROM Users AS u INNER JOIN Posts AS p ON u.Id = p.OwnerUserId WHERE p.PostTypeId = 1 GROUP BY U.Id), UsersWITHMoreThan28Questions AS (SELECT * FROM QuestionsPerUser WHERE QuestionCount > 28) SELECT SUM(QuestionCount) FROM UsersWITHMoreThan28Ques...
What rank is later than 1994?
CREATE TABLE table_69580 ("Year" real,"Team" text,"Chassis" text,"Engine" text,"Rank" text,"Points" real)
SELECT "Rank" FROM table_69580 WHERE "Year" > '1994'
The results for gt2 winning team is all lars-erik nielsen allan simonsen richard westbrook.
CREATE TABLE table_943 ("Rnd" real,"Circuit" text,"LMP1 Winning Team" text,"LMP2 Winning Team" text,"GT1 Winning Team" text,"GT2 Winning Team" text,"Results" text)
SELECT "Results" FROM table_943 WHERE "GT2 Winning Team" = 'Lars-Erik Nielsen Allan Simonsen Richard Westbrook'
What year was the downy woodpecker coin created?
CREATE TABLE table_name_46 (year INTEGER,animal VARCHAR)
SELECT SUM(year) FROM table_name_46 WHERE animal = "downy woodpecker"
what is patient 015-56556's daily minimum level of anion gap during the previous year?
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissio...
SELECT MIN(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-56556')) AND lab.labname = 'anion gap' AND DATETIME(lab.labresulttime, 'start ...
how many patients have undergone wound care until 1 year ago in the same month after the first procedure of a antiarrhythmics - class iv antiarrhythmic?
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 time)CREATE TABLE microlab (microlabid number,patientunitstayid ...
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'antiarrhythmics - class iv antiarrhythmic' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(),...
Which papers' first author is affiliated with an institution in the country 'Japan' and has last name 'Ohori'? Give me the titles of the papers.
CREATE TABLE authorship (authid number,instid number,paperid number,authorder number)CREATE TABLE papers (paperid number,title text)CREATE TABLE authors (authid number,lname text,fname text)CREATE TABLE inst (instid number,name text,country text)
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "Japan" AND t2.authorder = 1 AND t1.lname = "Ohori"
what was the weight change in patient 015-59552 second measured on the current hospital visit compared to the first value measured on 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 (SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-59552' AND patient.hospitaldischargetime IS NULL) AND NOT patient.admissionweight IS NULL ORDER BY patient.unitadmittime LIMIT 1 OFFSET 1) ...
Name the format for 12cm note and catalog of alca-9198
CREATE TABLE table_66875 ("Region" text,"Date" text,"Label" text,"Format" text,"Catalog" text,"Note" text)
SELECT "Format" FROM table_66875 WHERE "Note" = '12cm' AND "Catalog" = 'alca-9198'
What was the sum of the rounds for the player who had a position of LS and an overall draft pick bigger than 230?
CREATE TABLE table_46453 ("Round" real,"Pick" real,"Overall" real,"Name" text,"Position" text,"College" text)
SELECT SUM("Round") FROM table_46453 WHERE "Position" = 'ls' AND "Overall" > '230'
Name the team for arco arena 13,685
CREATE TABLE table_21295 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT "Team" FROM table_21295 WHERE "Location Attendance" = 'ARCO Arena 13,685'
The PreMajor classes are ?
CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE jobs (job_id int,job_title varchar,description varchar,requirement varchar,city varchar,state varchar,country varchar,zip int)CREATE TABLE student (student_id int,lastname va...
SELECT DISTINCT course.department, course.name, course.number FROM course, program, program_course WHERE program_course.category LIKE '%PreMajor%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_id = program_course.program_id
Top 100 users in a given tag (TeX version). This query fetches the top 100 users on a given tag name. The original query is available here: data.stackexchange.com/stackoverflow/s/1791
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 u.Id AS "user_link", COUNT(*) AS UpVotes FROM Tags AS t WITH (nolock) INNER JOIN PostTags AS pt WITH (nolock) ON pt.TagId = t.Id INNER JOIN Posts AS p WITH (nolock) ON p.ParentId = pt.PostId INNER JOIN Votes AS v WITH (nolock) ON v.PostId = p.Id AND v.VoteTypeId = 2 INNER JOIN Users AS u WITH (nolock) ON u.Id = ...
Show the number of documents for different document name in a bar chart, order bar in asc order.
CREATE TABLE Ref_Budget_Codes (Budget_Type_Code CHAR(15),Budget_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 VARCHAR(255))CREATE TABLE Accounts (A...
SELECT Document_Name, COUNT(Document_Name) FROM Documents GROUP BY Document_Name ORDER BY Document_Name
What french open tournament happened in 2010 and has a 2004 1r?
CREATE TABLE table_name_58 (tournament VARCHAR)
SELECT 2010 FROM table_name_58 WHERE 2004 = "1r" AND tournament = "french open"
What is the locomotive with a standard gauge and a serial number of 83-1015?
CREATE TABLE table_55814 ("Locomotive" text,"Serial No" text,"Entered service" text,"Gauge" text,"Livery" text)
SELECT "Locomotive" FROM table_55814 WHERE "Gauge" = 'standard' AND "Serial No" = '83-1015'
Return a bar chart on how many regions were affected by each storm?, list in descending by the names please.
CREATE TABLE storm (Storm_ID int,Name text,Dates_active text,Max_speed int,Damage_millions_USD real,Number_Deaths int)CREATE TABLE affected_region (Region_id int,Storm_ID int,Number_city_affected real)CREATE TABLE region (Region_id int,Region_code text,Region_name text)
SELECT Name, COUNT(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.Storm_ID = T2.Storm_ID GROUP BY T1.Storm_ID ORDER BY Name DESC
What's the place of 1989 with a comp of ECH?
CREATE TABLE table_name_94 (place VARCHAR,comp VARCHAR,date VARCHAR)
SELECT place FROM table_name_94 WHERE comp = "ech" AND date = "1989"
What is John Oxendine at in the poll where Karen Handel is at 38%?
CREATE TABLE table_name_75 (john_oxendine VARCHAR,karen_handel VARCHAR)
SELECT john_oxendine FROM table_name_75 WHERE karen_handel = "38%"
What is the highest number of laps when the Time/Retired is differential?
CREATE TABLE table_57118 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT MAX("Laps") FROM table_57118 WHERE "Time/Retired" = 'differential'
What was the score for the 1st ranked team?
CREATE TABLE table_3122 ("Rank" text,"Player" text,"Nationality" text,"Team" text,"Opponent" text,"Score" text,"Competition" text,"Vote percentage" text)
SELECT "Score" FROM table_3122 WHERE "Rank" = '1st'
What is the rnag for lyric fm 98.7?
CREATE TABLE table_18475946_2 (rnag__mhz_ VARCHAR,lyric_fm__mhz_ VARCHAR)
SELECT rnag__mhz_ FROM table_18475946_2 WHERE lyric_fm__mhz_ = "98.7"
What is the week 3, prior to the when the week 4 was Laura Nicole?
CREATE TABLE table_60707 ("Week 1" text,"Week 2" text,"Week 3" text,"Week 4" text,"Week 5" text)
SELECT "Week 4" FROM table_60707 WHERE "Week 3" = 'laura nicole'
fibrinogen < 1.5 g / l )
CREATE TABLE table_train_118 ("id" int,"hypocalcemia" bool,"heart_disease" bool,"renal_disease" bool,"fibrinogen" float,"diastolic_blood_pressure_dbp" int,"symptomatic_hypotension" bool,"serum_creatinine" float,"ca" float,"hypertension" bool,"NOUSE" float)
SELECT * FROM table_train_118 WHERE fibrinogen < 1.5
When the Home team was north melbourne what was the Date of the game?
CREATE TABLE table_name_49 (date VARCHAR,home_team VARCHAR)
SELECT date FROM table_name_49 WHERE home_team = "north melbourne"
What is the lowest to par of a player from australia with a score of 76-70-75-72=293?
CREATE TABLE table_name_96 (to_par INTEGER,country VARCHAR,score VARCHAR)
SELECT MIN(to_par) FROM table_name_96 WHERE country = "australia" AND score = 76 - 70 - 75 - 72 = 293
age 18 or older
CREATE TABLE table_train_269 ("id" int,"pregnancy_or_lactation" bool,"hemoglobin_a1c_hba1c" float,"diabetic" string,"hba1c" float,"prisoners" bool,"age" float,"NOUSE" float)
SELECT * FROM table_train_269 WHERE age >= 18
what is religion of subject name paul edwards?
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 demographic.religion FROM demographic WHERE demographic.name = "Paul Edwards"
how many albums are more than 3:30 long ?
CREATE TABLE table_204_631 (id number,"#" number,"title" text,"english translation" text,"original album" text,"length" text)
SELECT COUNT("title") FROM table_204_631 WHERE "length" > '3:30'
Which Event has a Record of 19-9?
CREATE TABLE table_48088 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" text)
SELECT "Event" FROM table_48088 WHERE "Record" = '19-9'
What is the Icelandic word for the English word bride?
CREATE TABLE table_42487 ("English" text,"German" text,"Dutch" text,"Icelandic" text,"Latin" text,"Greek" text,"Russian" text)
SELECT "Icelandic" FROM table_42487 WHERE "English" = 'bride'
What is the venue of the game with Man of the Match Vaclav Zavoral?
CREATE TABLE table_17120964_8 (venue VARCHAR,man_of_the_match VARCHAR)
SELECT venue FROM table_17120964_8 WHERE man_of_the_match = "Vaclav Zavoral"
Which Year has a Date of 14 February?
CREATE TABLE table_name_11 (year INTEGER,date VARCHAR)
SELECT MIN(year) FROM table_name_11 WHERE date = "14 february"
What is the measurement where the estimated function % is less than 20?
CREATE TABLE table_name_21 (measurement VARCHAR,estimated_function__percentage INTEGER)
SELECT measurement FROM table_name_21 WHERE estimated_function__percentage < 20
Show all book categories and the number of books in each category in a pie chart.
CREATE TABLE culture_company (Company_name text,Type text,Incorporated_in text,Group_Equity_Shareholding real,book_club_id text,movie_id text)CREATE TABLE movie (movie_id int,Title text,Year int,Director text,Budget_million real,Gross_worldwide int)CREATE TABLE book_club (book_club_id int,Year int,Author_or_Editor text...
SELECT Category, COUNT(*) FROM book_club GROUP BY Category
count the number of patients whose diagnoses icd9 code is 40391 and lab test category is chemistry?
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 INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "40391" AND lab."CATEGORY" = "Chemistry"
provide the number of patients whose admission type is elective and admission location is trsf within this facility.
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 WHERE demographic.admission_type = "ELECTIVE" AND demographic.admission_location = "TRSF WITHIN THIS FACILITY"
On what date was the game 1 played at Portland?
CREATE TABLE table_name_73 (date VARCHAR,home_team VARCHAR,game VARCHAR)
SELECT date FROM table_name_73 WHERE home_team = "portland" AND game = "game 1"
What is the total number of roll for Te Hapua school?
CREATE TABLE table_name_12 (roll VARCHAR,name VARCHAR)
SELECT COUNT(roll) FROM table_name_12 WHERE name = "te hapua school"
what was the first olympic games in which indrek kaseorg competed ?
CREATE TABLE table_204_202 (id number,"year" number,"tournament" text,"venue" text,"result" text,"rank" text,"event" text)
SELECT MIN("year") FROM table_204_202 WHERE "tournament" = 'olympic games'
What is the sum number of bronzes when the rank is less than 2 and the gold is less than 1?
CREATE TABLE table_11647 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT COUNT("Bronze") FROM table_11647 WHERE "Rank" < '2' AND "Gold" < '1'
What was the tie number of the away game for Ashford Town (Middx)?
CREATE TABLE table_name_79 (tie_no VARCHAR,away_team VARCHAR)
SELECT tie_no FROM table_name_79 WHERE away_team = "ashford town (middx)"
What is the smallest season for a tv series with a yes and human was the species?
CREATE TABLE table_name_58 (tv_seasons INTEGER,tv_series VARCHAR,species VARCHAR)
SELECT MIN(tv_seasons) FROM table_name_58 WHERE tv_series = "yes" AND species = "human"