instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
For Gem County, what was the Obama vote percentage?
CREATE TABLE table_20684390_1 (obama_percentage VARCHAR,county VARCHAR)
SELECT obama_percentage FROM table_20684390_1 WHERE county = "Gem"
how many patients have been prescribed the drug with code pred1?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "PRED1"
What was the time for the bout against Amanda Lavoy, which went under 3 rounds?
CREATE TABLE table_name_71 (time VARCHAR,round VARCHAR,opponent VARCHAR)
SELECT time FROM table_name_71 WHERE round < 3 AND opponent = "amanda lavoy"
Bin the hire date into Month interval, and then calculate the total salary of employees in each month for a bar chart, note that just select those employees without the letter M in their first name, and could you show by the Y-axis in descending please?
CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,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)...
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE NOT FIRST_NAME LIKE '%M%' ORDER BY SUM(SALARY) DESC
What are the release dates for songs in 2003?
CREATE TABLE table_12588029_3 (release_date VARCHAR,year VARCHAR)
SELECT release_date FROM table_12588029_3 WHERE year = 2003
the presence of at least 2 of the following criteria of sepsis according to accp / sccm ( 8 ) a ) body temperature > 38 degreesc or < 36 degreesc; b ) pulse rate > 90 / min; c ) breath rate > 20 / min or paco2 < 32 mmhg; and / or d ) leukocytosis ( white blood cell count > 12000 / ul ) or leukopenia ( white blood cell ...
CREATE TABLE table_train_66 ("id" int,"pregnancy_or_lactation" bool,"white_blood_cell_count_wbc" int,"acute_pyelonephritis" bool,"intrabdominal_infection" bool,"body_weight" float,"oxygen_therapy_by_face_mask" bool,"temperature" float,"heart_rate" int,"paco2" float,"band_form" int,"respiratory_rate" int,"bacteremia_by_...
SELECT * FROM table_train_66 WHERE (CASE WHEN temperature > 38 OR temperature < 36 THEN 1 ELSE 0 END + CASE WHEN heart_rate > 90 THEN 1 ELSE 0 END + CASE WHEN respiratory_rate > 20 OR paco2 < 32 THEN 1 ELSE 0 END + CASE WHEN white_blood_cell_count_wbc > 12000 OR white_blood_cell_count_wbc < 4000 OR band_form > 10 THEN ...
find the discharge location and procedure icd9 code of subject id 65759.
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 demographic.discharge_location, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "65759"
Name the landesliga nord for asv neumarkt
CREATE TABLE table_23594 ("Season" text,"Bayernliga" text,"Landesliga S\u00fcd" text,"Landesliga Mitte" text,"Landesliga Nord" text)
SELECT "Landesliga Nord" FROM table_23594 WHERE "Landesliga Mitte" = 'ASV Neumarkt'
What is the time in week 3?
CREATE TABLE table_name_29 (tv_time VARCHAR,week VARCHAR)
SELECT tv_time FROM table_name_29 WHERE week = 3
how many home discharged patients had operations on chordae tendineae?
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "HOME" AND procedures.short_title = "Chordae tendineae ops"
provide the number of patients whose insurance is medicare and diagnoses long title is unspecified peritonitis?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicare" AND diagnoses.long_title = "Unspecified peritonitis"
Which qual also has a finish total of 9?
CREATE TABLE table_name_75 (qual VARCHAR,finish VARCHAR)
SELECT qual FROM table_name_75 WHERE finish = "9"
find the birthdate and diagnosis of jerry deberry.
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 demographic.dob, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Jerry Deberry"
What is the sum of the weight of the race with a 1st pos'n and a 8f distance?
CREATE TABLE table_49381 ("Result" text,"Race" text,"Distance" text,"Weight" real,"Winner or 2nd" text,"Pos'n" text)
SELECT SUM("Weight") FROM table_49381 WHERE "Pos'n" = '1st' AND "Distance" = '8f'
What is the average nominated of the composition nominated by Taioseach with an Industrial and Commercial panel less than 9, an administrative panel greater than 0, a cultural and educational panel greater than 2, and a total less than 29?
CREATE TABLE table_75497 ("Administrative Panel" real,"Agricultural Panel" real,"Cultural and Educational Panel" real,"Industrial and Commercial Panel" real,"Labour Panel" real,"National University of Ireland" real,"Nominated by the Taoiseach" real,"Total" real)
SELECT AVG("Nominated by the Taoiseach") FROM table_75497 WHERE "Industrial and Commercial Panel" < '9' AND "Administrative Panel" > '0' AND "Cultural and Educational Panel" > '2' AND "Total" < '29'
Name the champion for christopher miles runner-up
CREATE TABLE table_69388 ("Year" text,"Champion" text,"Runner-Up" text,"3rd Place" text,"Location" text)
SELECT "Champion" FROM table_69388 WHERE "Runner-Up" = 'christopher miles'
specify the icd9 code of patient dona cole together with diagnosis long title
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 text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id tex...
SELECT diagnoses.icd9_code, diagnoses.long_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Dona Cole"
What are the investors that have invested in at least two entrepreneurs?
CREATE TABLE entrepreneur (entrepreneur_id number,people_id number,company text,money_requested number,investor text)CREATE TABLE people (people_id number,name text,height number,weight number,date_of_birth text)
SELECT investor FROM entrepreneur GROUP BY investor HAVING COUNT(*) >= 2
Who is the player from Arizona state with a round less than 7?
CREATE TABLE table_41040 ("Round" real,"Pick #" real,"Player" text,"Position" text,"College" text)
SELECT "Player" FROM table_41040 WHERE "Round" < '7' AND "College" = 'arizona state'
When the Away team of essendon was playing, what was the Home team's score?
CREATE TABLE table_name_62 (home_team VARCHAR,away_team VARCHAR)
SELECT home_team AS score FROM table_name_62 WHERE away_team = "essendon"
Count users who are Active and have reputation..
CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class number,TagBased boolean)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolea...
SELECT CASE WHEN (LastAccessDate > DATEADD(yy, -1, GETDATE())) THEN 'Yes' ELSE 'No' END AS ActiveThisYear, CASE WHEN (Reputation > 200) THEN 'Yes' ELSE 'No' END AS ReputationOver200, COUNT(*) AS Count FROM Users GROUP BY CASE WHEN (LastAccessDate > DATEADD(yy, -1, GETDATE())) THEN 'Yes' ELSE 'No' END, CASE WHEN (Reputa...
What was Australia's to par when the place was t9?
CREATE TABLE table_60319 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "To par" FROM table_60319 WHERE "Place" = 't9' AND "Country" = 'australia'
What is 1994, when 1996 is 'Grand Slams'?
CREATE TABLE table_44546 ("Tournament" text,"1990" text,"1991" text,"1992" text,"1993" text,"1994" text,"1995" text,"1996" text)
SELECT "1994" FROM table_44546 WHERE "1996" = 'grand slams'
What is the after for the player kevin streelman?
CREATE TABLE table_28498999_3 (after VARCHAR,player VARCHAR)
SELECT after FROM table_28498999_3 WHERE player = "Kevin Streelman"
what school is rudy gay from
CREATE TABLE table_10015132_7 (school_club_team VARCHAR,player VARCHAR)
SELECT school_club_team FROM table_10015132_7 WHERE player = "Rudy Gay"
What is Team, when Rank is greater than 2, and when Points are greater than 259?
CREATE TABLE table_name_12 (team VARCHAR,rank VARCHAR,points VARCHAR)
SELECT team FROM table_name_12 WHERE rank > 2 AND points > 259
When was a mintage of 1264 with more than 24.95 issued?
CREATE TABLE table_68917 ("Year" real,"Theme" text,"Artist" text,"Mintage" text,"Issue price" real,"Special notes" text)
SELECT MAX("Year") FROM table_68917 WHERE "Mintage" = '1264' AND "Issue price" > '24.95'
Who are all players from hometown of Carbondale, Illinois?
CREATE TABLE table_25378 ("No." real,"Player" text,"Hometown" text,"Class" text,"Position" text,"Height" text,"Weight" real)
SELECT "Player" FROM table_25378 WHERE "Hometown" = 'Carbondale, Illinois'
Selects all posts where the number of upvotes is greater than the number of downvotes, but where the number of downvotes is at least half the number of upvotes. The result is ordered by the number of upvotes (the highest on top).. Selects all posts where the number of upvotes is greater than the number of downvotes, bu...
CREATE TABLE Users (Id number,Reputation number,CreationDate time,DisplayName text,LastAccessDate time,WebsiteUrl text,Location text,AboutMe text,Views number,UpVotes number,DownVotes number,ProfileImageUrl text,EmailHash text,AccountId number)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPos...
SELECT CONCAT('https://stackoverflow.com/a/', PostId), Upvotes, Downvotes FROM (SELECT PostId, Upvotes, Downvotes, 2 * Downvotes / NULLIF(Upvotes, 0) AS Ratio FROM (SELECT PostId, Upvotes = SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END), Downvotes = SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) FROM Votes WHERE Vote...
Tell me the D 41 and R 51 of r 11
CREATE TABLE table_55695 ("D 41" text,"D 42" text,"D 43" text,"D 44" text,"D 45" text,"D 46" text,"D 47" text,"R 53" text,"R 52" text,"R 51" text)
SELECT "D 41" FROM table_55695 WHERE "R 51" = 'r 11'
What rank is associated with Germany?
CREATE TABLE table_14752049_1 (rank INTEGER,country VARCHAR)
SELECT MAX(rank) FROM table_14752049_1 WHERE country = "Germany"
Tell me who taught ANTHRBIO 369 in the past ?
CREATE TABLE course_tags_count (course_id int,clear_grading int,pop_quiz int,group_projects int,inspirational int,long_lectures int,extra_credit int,few_tests int,good_feedback int,tough_tests int,heavy_papers int,cares_for_students int,heavy_assignments int,respected int,participation int,heavy_reading int,tough_grade...
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN semester...
how many candidates received at least 100,000 votes ?
CREATE TABLE table_204_951 (id number,"candidate" text,"votes" number,"percentage" text,"counties" number,"delegates" number)
SELECT COUNT("candidate") FROM table_204_951 WHERE "votes" >= 100000
how many patients with sepsis diagnosis had csf lab test?
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 procedures (subject_id text,hadm_id text,icd9_code text,sho...
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 = "Sepsis" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of name and the amount of name , and group by attribute name.
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 T2.Name, COUNT(T2.Name) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name
What player has +21 as the to par?
CREATE TABLE table_name_36 (player VARCHAR,to_par VARCHAR)
SELECT player FROM table_name_36 WHERE to_par = "+21"
For each film, show the price and group them by cinema name in a stacked bar chart.
CREATE TABLE film (Film_ID int,Rank_in_series int,Number_in_season int,Title text,Directed_by text,Original_air_date text,Production_code text)CREATE TABLE cinema (Cinema_ID int,Name text,Openning_year int,Capacity int,Location text)CREATE TABLE schedule (Cinema_ID int,Film_ID int,Date text,Show_times_per_day int,Price...
SELECT Name, Price FROM schedule AS T1 JOIN film AS T2 ON T1.Film_ID = T2.Film_ID JOIN cinema AS T3 ON T1.Cinema_ID = T3.Cinema_ID GROUP BY Title, Name
when was first intake time of patient 1819 since 270 days ago?
CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE procedures_icd (row_id numbe...
SELECT inputevents_cv.charttime FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1819)) AND DATETIME(inputevents_cv.charttime) >= DATETIME(CURRENT_TIME(), '-270 day') ORDER ...
give me the number of patients whose admission location is phys referral/normal deli and primary disease is copd exacerbation?
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 WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND demographic.diagnosis = "COPD EXACERBATION"
what is the name of the medication that was prescribed to patient 25814 in the same hospital encounter after receiving a entral infus nutrit sub procedure since 08/2105?
CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE microbio...
SELECT t2.drug FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 25814 AND procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_proce...
Calculate the minimum age of patients who have posterior communicating aneurysm/sda and were discharged home.
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 lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid ...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.discharge_location = "HOME" AND demographic.diagnosis = "POSTERIOR COMMUNICATING ANEURYSM/SDA"
What player goes to Torrey Pines High School?
CREATE TABLE table_11677100_3 (player VARCHAR,school VARCHAR)
SELECT player FROM table_11677100_3 WHERE school = "Torrey Pines High school"
what is the three most common lab testing done this year?
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE patient (uniquepid text,patienthealthsystemsta...
SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE DATETIME(lab.labresulttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 3
What are the names of wines that are more expensive then all wines made in the year 2006?
CREATE TABLE WINE (Name VARCHAR,Price INTEGER,YEAR VARCHAR)
SELECT Name FROM WINE WHERE Price > (SELECT MAX(Price) FROM WINE WHERE YEAR = 2006)
give me the number of patients on allopurinol prescription who were admitted in hospital before 2174.
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 prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2174" AND prescriptions.drug = "Allopurinol"
Which Club has a League Cup goals of 0, and a League goals of 11, and a Scorer of joe laidlaw?
CREATE TABLE table_name_74 (club VARCHAR,scorer VARCHAR,league_cup_goals VARCHAR,league_goals VARCHAR)
SELECT club FROM table_name_74 WHERE league_cup_goals = 0 AND league_goals = "11" AND scorer = "joe laidlaw"
Where does Geelong play their home game?
CREATE TABLE table_11425 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Venue" FROM table_11425 WHERE "Home team" = 'geelong'
What country has an Elevation less than 1833 and an Isolation (km) larger than 18, and a Peak of store lenangstind?
CREATE TABLE table_67727 ("Peak" text,"Elevation (m)" real,"Prominence (m)" real,"Isolation (km)" real,"Municipality" text,"County" text)
SELECT "County" FROM table_67727 WHERE "Elevation (m)" < '1833' AND "Isolation (km)" > '18' AND "Peak" = 'store lenangstind'
What Country has a Career of 1989 2004?
CREATE TABLE table_name_26 (country VARCHAR,career VARCHAR)
SELECT country FROM table_name_26 WHERE career = "1989–2004"
tell me the last procedure patient 029-30149 had in 2105?
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 treatment.treatmentname FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-30149')) AND STRFTIME('%y', treatment.treatmenttime) = '2105'...
Which Episodes have a TV Station of tbs, and a Japanese Title of ?
CREATE TABLE table_65178 ("Japanese Title" text,"Romaji Title" text,"TV Station" text,"Episodes" real,"Average Ratings" text)
SELECT MAX("Episodes") FROM table_65178 WHERE "TV Station" = 'tbs' AND "Japanese Title" = '今夜ひとりのベッドで'
Name the bocas for chironius multiventris septentrionalis
CREATE TABLE table_1850282_7 (bocas_is VARCHAR,species VARCHAR)
SELECT bocas_is FROM table_1850282_7 WHERE species = "Chironius multiventris septentrionalis"
What year did the team who played at the Scottrade Center leave the city?
CREATE TABLE table_24469 ("Team" text,"Sport" text,"League" text,"Established" real,"Began in St. Louis" real,"Venue" text,"Championships in St. Louis" text,"Left St. Louis" real)
SELECT MIN("Left St. Louis") FROM table_24469 WHERE "Venue" = 'Scottrade Center'
What is the email of the student with first name 'Emma' and last name 'Rohan'?
CREATE TABLE behavior_incident (incident_id number,incident_type_code text,student_id number,date_incident_start time,date_incident_end time,incident_summary text,recommendations text,other_details text)CREATE TABLE addresses (address_id number,line_1 text,line_2 text,line_3 text,city text,zip_postcode text,state_provi...
SELECT email_address FROM students WHERE first_name = "Emma" AND last_name = "Rohan"
provide the number of patients whose diagnoses icd9 code is 7454 and lab test category is chemistry?
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 text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id te...
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 = "7454" AND lab."CATEGORY" = "Chemistry"
Posts containing BIG-O Notation requiring MathJax Formatting.
CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE Posts (Id number,PostTypeId number,Accepted...
SELECT p.Title, 'https://codereview.stackexchange.com/questions/' + CAST(p.Id AS TEXT) AS URL, p.CreationDate FROM Posts AS p WHERE 1 = 1 AND NOT p.Title IS NULL AND p.ClosedDate IS NULL AND p.DeletionDate IS NULL AND LOWER(p.Body) LIKE '%o(n%' AND NOT LOWER(p.Body) LIKE '%\$o(n%' ORDER BY p.CreationDate DESC LIMIT 3
What did Ku Hyo-Jin rank?
CREATE TABLE table_name_46 (rank VARCHAR,name VARCHAR)
SELECT COUNT(rank) FROM table_name_46 WHERE name = "ku hyo-jin"
What is the Winner of the Event in Punta del Este?
CREATE TABLE table_9713 ("Date" text,"City" text,"Event" text,"Winner" text,"Prize" text)
SELECT "Winner" FROM table_9713 WHERE "City" = 'punta del este'
provide the number of patients whose religion is jewish and diagnoses short title is dmii wo cmp nt st uncntr?
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.religion = "JEWISH" AND diagnoses.short_title = "DMII wo cmp nt st uncntr"
What are the average wins that have great britain as the team?
CREATE TABLE table_42435 ("Pos." real,"Team" text,"Wins" real,"Ties" real,"Losses" real,"Goals" text,"Diff." text,"Points" text)
SELECT AVG("Wins") FROM table_42435 WHERE "Team" = 'great britain'
How many goals were scored with a pos larger than 4 and active in 2001-?
CREATE TABLE table_10761 ("Pos." real,"Player" text,"Goals Scored" text,"Games Played" text,"Years Active" text)
SELECT "Goals Scored" FROM table_10761 WHERE "Pos." > '4' AND "Years Active" = '2001-'
Show the party and the number of drivers in each party. Visualize by pie chart.
CREATE TABLE school (School_ID int,Grade text,School text,Location text,Type text)CREATE TABLE driver (Driver_ID int,Name text,Party text,Home_city text,Age int)CREATE TABLE school_bus (School_ID int,Driver_ID int,Years_Working int,If_full_time bool)
SELECT Party, COUNT(*) FROM driver GROUP BY Party
what is the number of patients whose procedure icd9 code is 9465 and drug route is sl?
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 text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE procedures.icd9_code = "9465" AND prescriptions.route = "SL"
Bar graph to show the average of amount payment from different payment method code, could you list the average of amount payment from high to low order?
CREATE TABLE Customers (Customer_ID INTEGER,Customer_Details VARCHAR(255))CREATE TABLE Claims (Claim_ID INTEGER,Policy_ID INTEGER,Date_Claim_Made DATE,Date_Claim_Settled DATE,Amount_Claimed INTEGER,Amount_Settled INTEGER)CREATE TABLE Settlements (Settlement_ID INTEGER,Claim_ID INTEGER,Date_Claim_Made DATE,Date_Claim_Se...
SELECT Payment_Method_Code, AVG(Amount_Payment) FROM Payments GROUP BY Payment_Method_Code ORDER BY AVG(Amount_Payment) DESC
Who's the Winning driver with a Pole position of bryan herta?
CREATE TABLE table_49886 ("Race Name" text,"Circuit" text,"City/Location" text,"Date" text,"Pole position" text,"Fastest lap" text,"Winning driver" text,"Winning team" text,"Report" text)
SELECT "Winning driver" FROM table_49886 WHERE "Pole position" = 'bryan herta'
Give me a bar chart that the X-axis is the date_moved_in and the Y-axis is Count them, please bin X-axis into Year interval, rank by the y axis from high to low please.
CREATE TABLE Residents_Services (resident_id INTEGER,service_id INTEGER,date_moved_in DATETIME,property_id INTEGER,date_requested DATETIME,date_provided DATETIME,other_details VARCHAR(255))CREATE TABLE Timed_Locations_of_Things (thing_id INTEGER,Date_and_Time DATETIME,Location_Code CHAR(15))CREATE TABLE Things (thing_i...
SELECT date_moved_in, COUNT(date_moved_in) FROM Customer_Events ORDER BY COUNT(date_moved_in) DESC
What is the total for New York's game?
CREATE TABLE table_name_39 (game INTEGER,team VARCHAR)
SELECT SUM(game) FROM table_name_39 WHERE team = "new york"
in this year had patient 030-10559 been prescribed potassium chloride 20 meq tr tab, d50 or dexamethasone?
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 medication (medicationid number,patientunitstayid number,drugname text,dos...
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-10559')) AND medication.drugname IN ('potassium chloride 20 meq tr tab...
what was the four most frequent laboratory test ordered during this year?
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 t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE DATETIME(lab.labresulttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 4
Which Home team has a Score of 1 1, and an Away team of tottenham hotspur?
CREATE TABLE table_name_68 (home_team VARCHAR,score VARCHAR,away_team VARCHAR)
SELECT home_team FROM table_name_68 WHERE score = "1–1" AND away_team = "tottenham hotspur"
How many teams are in Bridgewater, NJ, USA?
CREATE TABLE table_1283 ("Year / Theme" text,"Award name" text,"Team name" text,"Team number" real,"City,State/Country" text)
SELECT COUNT("Team name") FROM table_1283 WHERE "City, State/Country" = 'Bridgewater, NJ, USA'
WHAT IS THE 2009 PERFORMANCE WITH A 2012 OF 2R, 2001 OF 1R, 2007 OF A, AND 2008 OF A?
CREATE TABLE table_name_77 (Id VARCHAR)
SELECT 2009 FROM table_name_77 WHERE 2012 = "2r" AND 2011 = "1r" AND 2007 = "a" AND 2008 = "a"
What was lost against 383 points?
CREATE TABLE table_name_59 (lost VARCHAR,points_against VARCHAR)
SELECT lost FROM table_name_59 WHERE points_against = "383"
What is the nationality of Duke?
CREATE TABLE table_50098 ("Player" text,"Nationality" text,"Position" text,"Years for Grizzlies" text,"School/Club Team" text)
SELECT "Nationality" FROM table_50098 WHERE "School/Club Team" = 'duke'
What is the share of votes in the 2000 (2nd) election?
CREATE TABLE table_name_20 (share_of_votes VARCHAR,election VARCHAR)
SELECT share_of_votes FROM table_name_20 WHERE election = "2000 (2nd)"
Find dept_name and the amount of dept_name , and group by attribute dept_name, and visualize them by a bar chart.
CREATE TABLE section (course_id varchar(8),sec_id varchar(8),semester varchar(6),year numeric(4,0),building varchar(15),room_number varchar(7),time_slot_id varchar(4))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 (b...
SELECT dept_name, COUNT(dept_name) FROM instructor GROUP BY dept_name ORDER BY salary
New Android Testing by Year.
CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance t...
SELECT COUNT(P.Title), YEAR(P.CreationDate) FROM Posts AS P WHERE (P.Tags LIKE '%android-testing%') OR (P.Tags LIKE '%robotium%') OR (P.Tags LIKE '%androidviewclient%') OR (P.Tags LIKE '%monkeyrunner%') OR (P.Tags LIKE '%robolectric%') OR (P.Tags LIKE '%android-espresso%') OR (P.Tags LIKE '%android%' AND P.Tags LIKE '%...
which film came out in 2002 and also had the role of vindici ?
CREATE TABLE table_201_21 (id number,"year" number,"title" text,"role" text,"notes" text)
SELECT "title" FROM table_201_21 WHERE "year" = 2002 AND "role" = 'vindici'
how many points did germany have ?
CREATE TABLE table_204_954 (id number,"no." number,"country" text,"2009 winter\nuniversiade" number,"2007 wjcc" number,"2007 wwcc" number,"2008 wjcc" number,"2008 wwcc" number,"points" number)
SELECT "points" FROM table_204_954 WHERE "country" = 'germany'
What is Date, when Tournament, is Greenbrier Classic?
CREATE TABLE table_45100 ("Date" text,"Tournament" text,"Winning score" text,"Margin of victory" text,"Runner(s)-up" text)
SELECT "Date" FROM table_45100 WHERE "Tournament" = 'greenbrier classic'
What is the enrollment at Lanesville?
CREATE TABLE table_14181 ("School" text,"Location" text,"Mascot" text,"Enrollment" real,"IHSAA Class" text,"County" text)
SELECT AVG("Enrollment") FROM table_14181 WHERE "School" = 'lanesville'
What is the date of the match in Vilnius, Lithuania?
CREATE TABLE table_name_60 (date VARCHAR,location VARCHAR)
SELECT date FROM table_name_60 WHERE location = "vilnius, lithuania"
what 's the next smallest plane after a TURBOPROP
CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE ground_service (city_code text,airport_code text,transport_type text,ground_fare int)CREATE TABLE class_of_servi...
SELECT DISTINCT aircraft_code FROM aircraft WHERE capacity = (SELECT MIN(AIRCRAFTalias1.capacity) FROM aircraft AS AIRCRAFTalias1 WHERE AIRCRAFTalias1.capacity > ALL (SELECT DISTINCT AIRCRAFTalias2.capacity FROM aircraft AS AIRCRAFTalias2 WHERE AIRCRAFTalias1.propulsion = 'TURBOPROP')) AND capacity > ALL (SELECT DISTIN...
What week that shows a game record of 0 1?
CREATE TABLE table_name_94 (week INTEGER,record VARCHAR)
SELECT AVG(week) FROM table_name_94 WHERE record = "0–1"
Who were the semifinalists in the Rome tournament?
CREATE TABLE table_76481 ("Tournament" text,"Surface" text,"Week" text,"Winner" text,"Finalist" text,"Semifinalists" text)
SELECT "Semifinalists" FROM table_76481 WHERE "Tournament" = 'rome'
What is Tie No, when Score is 'Marlow United won 4 2 on penalties'?
CREATE TABLE table_12333 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Attendance" text)
SELECT "Tie no" FROM table_12333 WHERE "Score" = 'marlow united won 4–2 on penalties'
How many people attended the match when Manchester United played against the Hearts?
CREATE TABLE table_name_95 (attendance INTEGER,opponents VARCHAR)
SELECT SUM(attendance) FROM table_name_95 WHERE opponents = "hearts"
find the number of patients who prefer haitian language.
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.language = "HAIT"
What year had a Ford engine and 13 points?
CREATE TABLE table_name_16 (year VARCHAR,engine VARCHAR,pts VARCHAR)
SELECT year FROM table_name_16 WHERE engine = "ford" AND pts = 13
Name the sum of year for connaught engineering and points less than 0
CREATE TABLE table_name_49 (year INTEGER,entrant VARCHAR,points VARCHAR)
SELECT SUM(year) FROM table_name_49 WHERE entrant = "connaught engineering" AND points < 0
What is the first name, gpa and phone number of the top 5 students with highest gpa?
CREATE TABLE student (stu_gpa VARCHAR,stu_phone VARCHAR,stu_fname VARCHAR)
SELECT stu_gpa, stu_phone, stu_fname FROM student ORDER BY stu_gpa DESC LIMIT 5
Bar chart x axis booking end date y axis the number of booking end date
CREATE TABLE Apartment_Facilities (apt_id INTEGER,facility_code CHAR(15))CREATE TABLE Apartments (apt_id INTEGER,building_id INTEGER,apt_type_code CHAR(15),apt_number CHAR(10),bathroom_count INTEGER,bedroom_count INTEGER,room_count CHAR(5))CREATE TABLE Guests (guest_id INTEGER,gender_code CHAR(1),guest_first_name VARCH...
SELECT booking_end_date, COUNT(booking_end_date) FROM Apartment_Bookings
What is the highest overall number for a player from Kentucky State?
CREATE TABLE table_4598 ("Round" real,"Overall" real,"Player" text,"Position" text,"College" text)
SELECT MAX("Overall") FROM table_4598 WHERE "College" = 'kentucky state'
what is the minimum hospital cost for a patient suffering from acute pain due to trauma until 2 years ago?
CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_items (row...
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'acute pain due to trauma')) AND DATETIME(cost.chargetime) <= DA...
What is the sum of laps of the honda cbr1000rr bike, which has a time of +16.569?
CREATE TABLE table_name_33 (laps INTEGER,bike VARCHAR,time VARCHAR)
SELECT SUM(laps) FROM table_name_33 WHERE bike = "honda cbr1000rr" AND time = "+16.569"
Most recent 100 HNQ (Hot Network Questions).
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,R...
SELECT PostId AS "post_link", CreationDate AS "entering_the_list_on" FROM PostHistory WHERE PostHistoryTypeId = 52 ORDER BY CreationDate DESC LIMIT 100
How many T-260 EU aircrafts are currently in service?
CREATE TABLE table_31638 ("Aircraft" text,"Origin" text,"Type" text,"Versions" text,"In service" text)
SELECT "In service" FROM table_31638 WHERE "Versions" = 't-260 eu'
When Manuel Simon took ASIANLAN 551 , who taught the class ?
CREATE TABLE instructor (instructor_id int,name varchar,uniqname varchar)CREATE TABLE course (course_id int,name varchar,department varchar,number varchar,credits varchar,advisory_requirement varchar,enforced_requirement varchar,description varchar,num_semesters int,num_enrolled int,has_discussion varchar,has_lab varch...
SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN student_record ON student_record.offering_id = offering_instructor.offering_id INNER JOIN student ON student.student_id = student_record.student_id INNER JOIN course_...
Compare the smallest enrollment of schools in each state using a bar chart, and order cName in desc order.
CREATE TABLE Tryout (pID numeric(5,0),cName varchar(20),pPos varchar(8),decision varchar(3))CREATE TABLE College (cName varchar(20),state varchar(2),enr numeric(5,0))CREATE TABLE Player (pID numeric(5,0),pName varchar(20),yCard varchar(3),HS numeric(5,0))
SELECT cName, MIN(enr) FROM College GROUP BY state ORDER BY cName DESC
what is the name of the station where the metlink code is mata?
CREATE TABLE table_31457 ("Station" text,"Metlink code" text,"Line(s)" text,"Service(s)" text,"Serves" text,"km from Wellington" text,"Fare zone(s)" text,"Opened" text)
SELECT "Station" FROM table_31457 WHERE "Metlink code" = 'MATA'