instruction
stringlengths 53
549
| output
stringlengths 30
2.33k
|
---|---|
### Instruction:
A bar chart for what are the number of the names of catalog entries with level number 8?
### Response:
| SELECT catalog_entry_name, COUNT(catalog_entry_name) FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = "8" GROUP BY catalog_entry_name |
### Instruction:
give me the number of patients whose age is less than 50 and diagnoses icd9 code is 32723?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "50" AND diagnoses.icd9_code = "32723" |
### Instruction:
how many single patients are diagnosed with migrne unsp wo ntrc mgrn?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "SINGLE" AND diagnoses.short_title = "Migrne unsp wo ntrc mgrn" |
### Instruction:
What is the date of the zolder circuit, which had a.z.k./roc-comp tition a.z.k./roc-comp tition as the winning team?
### Response:
| SELECT "Date" FROM table_79110 WHERE "Winning team" = 'a.z.k./roc-compétition a.z.k./roc-compétition' AND "Circuit" = 'zolder' |
### Instruction:
how many days has it been since the admission of patient 022-199074 to the hospital?
### Response:
| SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.hospitaladmittime)) FROM patient WHERE patient.uniquepid = '022-199074' AND patient.hospitaldischargetime IS NULL |
### Instruction:
Among patients admitted before the year 2146, calculate the number of those who had icd9 code 8852
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2146" AND procedures.icd9_code = "8852" |
### Instruction:
count the number of patients whose insurance is medicare and diagnosis short title is chronic diastolic heart failure.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicare" AND diagnoses.short_title = "Chr diastolic hrt fail" |
### Instruction:
provide the number of patients whose admission location is emergency room admit and procedure icd9 code is 14?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND procedures.icd9_code = "14" |
### Instruction:
among patients who had unspecified congestive heart failure, how many of them were unmarried?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "SINGLE" AND diagnoses.long_title = "Congestive heart failure, unspecified" |
### Instruction:
give me the number of patients whose procedure long title is automatic implantable cardioverter/defibrillator (aicd) check?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.long_title = "Automatic implantable cardioverter/defibrillator (AICD) check" |
### Instruction:
What is the Week when anke huber chanda rubin shows for Semi finalists, and the Runner-up is meredith mcgrath larisa savchenko?
### Response:
| SELECT "Week of" FROM table_40285 WHERE "Semi finalists" = 'anke huber chanda rubin' AND "Runner-up" = 'meredith mcgrath larisa savchenko' |
### Instruction:
What is the average money ( ) that has +8 as the to par, with 73-72-72-71=288 as the score?
### Response:
| SELECT AVG("Money ( \u00a3 )") FROM table_59187 WHERE "To par" = '+8' AND "Score" = '73-72-72-71=288' |
### Instruction:
Number of >=3 score posts per month. Android questions per day in 2011
### Response:
| SELECT YEAR(CreationDate) AS Year, MONTH(CreationDate) AS Month, COUNT(CreationDate) AS Count FROM Posts WHERE Score >= 3 GROUP BY MONTH(CreationDate), YEAR(CreationDate) ORDER BY YEAR(CreationDate), MONTH(CreationDate) |
### Instruction:
how many patients with an emergency admission type had the diagnosis icd9 code 2763?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.icd9_code = "2763" |
### Instruction:
hyperosmolar hyperglycemic state ( blood glucose > 200 mg / dl, serum osmolarity > 320 mosm / kg )
### Response:
| SELECT * FROM table_dev_44 WHERE hyperosmolar_hyperglycemic_state = 1 OR (blood_glucose > 200 AND serum_osmolarity > 320) |
### Instruction:
What are the enrollment dates of all the tests that have result 'Pass', and count them by a bar chart
### Response:
| SELECT date_of_enrolment, COUNT(date_of_enrolment) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Pass" |
### Instruction:
Top 20 stackoverflow Tunisian users. This query returns the list of Top 20 Tunisian Stackoverflow Users
### Response:
| SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%tunisia%' OR LOWER(Location) LIKE '%tunisie%' ORDER BY Reputation DESC LIMIT 200 |
### Instruction:
what is the number of patients whose admission type is urgent and drug name is estrogens conjugated?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "URGENT" AND prescriptions.drug = "Estrogens Conjugated" |
### Instruction:
report the number of patients with procedure icd9 code 5781 who were admitted in hospital before 2138.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2138" AND procedures.icd9_code = "5781" |
### Instruction:
where can i eat some good arabic food on buchanan in san francisco ?
### Response:
| SELECT location.house_number, restaurant.name FROM location, restaurant WHERE location.city_name = 'san francisco' AND location.street_name = 'buchanan' AND restaurant.food_type = 'arabic' AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5 |
### Instruction:
what kind of Giro di Lombardiahas a Tour of Flanders of tom boonen ( bel ), and a Paris Roubaix of fabian cancellara ( sui )?
### Response:
| SELECT giro_di_lombardia FROM table_name_22 WHERE tour_of_flanders = "tom boonen ( bel )" AND paris_roubaix = "fabian cancellara ( sui )" |
### Instruction:
Calculate the number of patients with item id 51098 who died in or before the year 2165.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2165.0" AND lab.itemid = "51098" |
### Instruction:
For those records from the products and each product's manufacturer, return a bar chart about the distribution of name and price , and group by attribute founder, sort by the Y from low to high.
### Response:
| SELECT T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder, T1.Name ORDER BY T1.Price |
### Instruction:
tell me the number of male patients with hyposmolality and/or hyponatremia diagnoses.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.long_title = "Hyposmolality and/or hyponatremia" |
### Instruction:
give me the number of patients whose ethnicity is hispanic/latino - puerto rican and days of hospital stay is greater than 23?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND demographic.days_stay > "23" |
### Instruction:
Provide the number of patients who stayed in the hospital for more than 7 days and have procedure icd9 code as 4576.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "7" AND procedures.icd9_code = "4576" |
### Instruction:
calculate the total number of patients belonging to white-russian ethnic origin amongst those who had radical cystectomy
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND procedures.long_title = "Radical cystectomy" |
### Instruction:
provide the number of patients whose age is less than 55 and drug code is syr60ml?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "55" AND prescriptions.formulary_drug_cd = "SYR60ML" |
### Instruction:
Is it true that geoffrey e. hinton has more citations than yann lecun ?
### Response:
| SELECT DISTINCT author.authorname, COUNT(writes.paperid) FROM author, writes WHERE author.authorname IN ('geoffrey e. hinton', 'yann lecun') AND writes.authorid = author.authorid GROUP BY author.authorname ORDER BY COUNT(writes.paperid) DESC |
### Instruction:
How many are there in 2003 that have 0 in 2001, more than 0 in 2009 and fewer than 0 in 1999?
### Response:
| SELECT SUM("2003") FROM table_41807 WHERE "2001" = '0' AND "2009" > '0' AND "1999" < '0' |
### Instruction:
Votes on which day after posting.
### Response:
| SELECT DATEDIFF(day, p.CreationDate, CreationDate) AS Days, COUNT(v.Id) AS Count FROM Votes AS v INNER JOIN Posts AS p ON v.PostId = p.Id GROUP BY DATEDIFF(day, p.CreationDate, CreationDate) ORDER BY DATEDIFF(day, p.CreationDate, CreationDate) |
### Instruction:
provide the number of patients whose days of hospital stay is greater than 29 and drug name is lorazepam?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "29" AND prescriptions.drug = "Lorazepam" |
### Instruction:
Give the number of patients whose admission type is newborn and diagnosis long title is other specified disorders of skin.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "NEWBORN" AND diagnoses.long_title = "Other specified disorders of skin" |
### Instruction:
how many patients are with discharge location short term hospital and with procedure icd9 code 17?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "SHORT TERM HOSPITAL" AND procedures.icd9_code = "17" |
### Instruction:
what is the lowest apparent magnitude when the object type is spiral galaxy, the constellation is leo minor and the ngc number is more than 3021?
### Response:
| SELECT MIN("Apparent magnitude") FROM table_55924 WHERE "Object type" = 'spiral galaxy' AND "Constellation" = 'leo minor' AND "NGC number" > '3021' |
### Instruction:
count the number of times patient 1114 had been prescribed 1/2 ns on their current hospital visit.
### Response:
| SELECT COUNT(*) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1114 AND admissions.dischtime IS NULL) AND prescriptions.drug = '1/2 ns' |
### Instruction:
what is the number of patients whose discharge location is snf and lab test name is reticulocyte count, automated?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.discharge_location = "SNF" AND lab.label = "Reticulocyte Count, Automated" |
### Instruction:
provide the number of patients whose primary disease is overdose and procedure short title is contr cerebr arteriogram?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "OVERDOSE" AND procedures.short_title = "Contr cerebr arteriogram" |
### Instruction:
since 2105 what is the first hospital admission type of patient 022-134034?
### Response:
| SELECT patient.hospitaladmitsource FROM patient WHERE patient.uniquepid = '022-134034' AND STRFTIME('%y', patient.hospitaladmittime) >= '2105' ORDER BY patient.hospitaladmittime LIMIT 1 |
### Instruction:
get the number of black/african american ethnic background patients who had drug detoxification procedure.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND procedures.short_title = "Drug detoxification" |
### Instruction:
What is the sum FG Pct of the player with more than 3 asst, a def reb of 30, and a 3FG Pct greater than 36.1?
### Response:
| SELECT SUM("FG Pct") FROM table_7424 WHERE "Asst" > '3' AND "Def Reb" = '30' AND "3FG Pct" > '36.1' |
### Instruction:
find the number of medicaid patients who are diagnosed with acute on chronic systolic heart failure.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicaid" AND diagnoses.long_title = "Acute on chronic systolic heart failure" |
### Instruction:
give me the number of patients whose marital status is widowed and diagnoses short title is vascular hamartomas?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "WIDOWED" AND diagnoses.short_title = "Vascular hamartomas" |
### Instruction:
white blood count < 3000 ; platelet count < 100000 , and baseline hemoglobin < 10 g / dl
### Response:
| SELECT * FROM table_dev_29 WHERE white_blood_cell_count_wbc < 3000 AND platelet_count < 100000 AND baseline_hemoglobin_hgb < 10 |
### Instruction:
Questions with a deleted owner and an accepted answer with a deleted owner..
### Response:
| SELECT p.Id AS "post_link" FROM Posts AS p WHERE p.PostTypeId = 1 AND p.OwnerUserId IS NULL AND NOT p.AcceptedAnswerId IS NULL AND (SELECT p2.OwnerUserId FROM Posts AS p2 WHERE p2.Id = p.AcceptedAnswerId) IS NULL LIMIT 100 |
### Instruction:
Which Total has a Hereditary peer of , and a Lords spiritual of , and a Life peers of 2, and an Affiliation of plaid cymru?
### Response:
| SELECT COUNT(total) FROM table_name_17 WHERE hereditary_peers = "–" AND lords_spiritual = "–" AND life_peers = "2" AND affiliation = "plaid cymru" |
### Instruction:
how many patients whose procedure is titled int inser lead atri-vent left against medical advice?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "LEFT AGAINST MEDICAL ADVI" AND procedures.short_title = "Int inser lead atri-vent" |
### Instruction:
how many patients are admitted under elective type and use the drug sodium citrate 4%?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND prescriptions.drug = "Sodium CITRATE 4%" |
### Instruction:
What is the greatest height (cm) that has a 1983-1984 team of montreal canadiens, with a jersey less than 21?
### Response:
| SELECT MAX("Height (cm)") FROM table_7369 WHERE "1983\u20131984 Team" = 'montreal canadiens' AND "Jersey #" < '21' |
### Instruction:
Which species on R union island is part of the procellariiformes order and is part of the hydrobatidae family and has less than 21 species worldwide?
### Response:
| SELECT SUM("Species on R\u00e9union") FROM table_69851 WHERE "Order" = 'procellariiformes' AND "Family" = 'hydrobatidae' AND "Species worldwide" < '21' |
### Instruction:
For those records from the products and each product's manufacturer, give me the comparison about the average of revenue over the founder , and group by attribute founder by a bar chart, show by the x-axis in asc.
### Response:
| SELECT Founder, AVG(Revenue) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY Founder |
### Instruction:
What is the total number of # Of Prefectural Votes, when # Of Seats Won is greater than 69, and when Leader is Yasuhiro Nakasone?
### Response:
| SELECT COUNT(_number_of_prefectural_votes) FROM table_name_54 WHERE _number_of_seats_won > 69 AND leader = "yasuhiro nakasone" |
### Instruction:
Show the number of start dates of all the apartment bookings for each year with a bar chart, I want to show Y-axis in asc order please.
### Response:
| SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id ORDER BY COUNT(booking_start_date) |
### Instruction:
Which Points have a Visitor of montreal canadiens, and an Attendance larger than 18,568, and a Record of 2 0 1?
### Response:
| SELECT MAX("Points") FROM table_50041 WHERE "Visitor" = 'montreal canadiens' AND "Attendance" > '18,568' AND "Record" = '2–0–1' |
### Instruction:
what is the number of patients whose admission type is emergency and procedure icd9 code is 3512?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND procedures.icd9_code = "3512" |
### Instruction:
Who was appointed with the title of envoy extraordinary and minister plenipotentiary, and a termination of mission of march 16, 1905?
### Response:
| SELECT "Appointed by" FROM table_71304 WHERE "Title" = 'envoy extraordinary and minister plenipotentiary' AND "Termination of Mission" = 'march 16, 1905' |
### Instruction:
What is the Company Name, when the Accreditation Level is Joyn Hot Fixes, and when the Accreditation Status is Approved (Awarded 17.05.13)?
### Response:
| SELECT company_name FROM table_name_13 WHERE accreditation_level = "joyn hot fixes" AND accreditation_status = "approved (awarded 17.05.13)" |
### Instruction:
is patient 50480 prescribed medication until 1 year ago?
### Response:
| SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 50480) AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-1 year') |
### Instruction:
Questions with specific tag below question/answer score.
### Response:
| SELECT Q.Id FROM Posts AS Q WHERE Q.PostTypeId = 1 AND Q.Tags LIKE @Pattern AND (Q.Score < @QuestionScore OR (@Accepted = 1 AND Q.AcceptedAnswerId IS NULL) OR NOT EXISTS(SELECT * FROM Posts AS A WHERE A.ParentId = Q.Id AND A.Score >= @AnswerScore)) |
### Instruction:
when was patient 70267 prescribed a medication via im route for the first time?
### Response:
| SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 70267) AND prescriptions.route = 'im' ORDER BY prescriptions.startdate LIMIT 1 |
### Instruction:
What is the 1961 total of the Macedonian population with a 1971 number of 3325 and a 1991 value greater than 3177?
### Response:
| SELECT COUNT("1961") FROM table_45670 WHERE "Number 1971" = '3325' AND "1991" > '3177' |
### Instruction:
how did patient 64519 in the last year first visit the hospital?
### Response:
| SELECT admissions.admission_type FROM admissions WHERE admissions.subject_id = 64519 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY admissions.admittime LIMIT 1 |
### Instruction:
count the number of patients whose admission year is less than 2187 and lab test name is creatinine, urine?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2187" AND lab.label = "Creatinine, Urine" |
### Instruction:
give me the number of patients whose admission year is less than 2168 and procedure long title is procedure on two vessels?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2168" AND procedures.long_title = "Procedure on two vessels" |
### Instruction:
give me the number of patients whose admission year is less than 2125 and item id is 51009?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2125" AND lab.itemid = "51009" |
### Instruction:
Give me the descriptions of the service types that cost more than 100, and count them by a bar chart
### Response:
| SELECT Service_Type_Description, COUNT(Service_Type_Description) FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Price > 100 GROUP BY Service_Type_Description |
### Instruction:
did patient 11516 get a prescription for a drug until 2103?
### Response:
| SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 11516) AND STRFTIME('%y', prescriptions.startdate) <= '2103' |
### Instruction:
how many patients aged below 83 years had the drug code cipr200pm?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "83" AND prescriptions.formulary_drug_cd = "CIPR200PM" |
### Instruction:
how many patients of black/african american ethnicity use base drug type?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND prescriptions.drug_type = "BASE" |
### Instruction:
what is the number of patients whose admission year is less than 2120 and lab test name is albumin, urine?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2120" AND lab.label = "Albumin, Urine" |
### Instruction:
Return a bar chart on how many engineers did each staff contact? List both the contact staff name and number of engineers contacted, and show in descending by the X.
### Response:
| SELECT staff_name, COUNT(*) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id GROUP BY T1.staff_name ORDER BY staff_name DESC |
### Instruction:
Find the addresses of the course authors who teach the course with name 'operating system' or 'data structure'.
### Response:
| SELECT T1.address_line_1 FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T2.course_name = "operating system" OR T2.course_name = "data structure" |
### Instruction:
what is the number of patients whose year of birth is less than 2076 and lab test name is phosphate, urine?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2076" AND lab.label = "Phosphate, Urine" |
### Instruction:
For those records from the products and each product's manufacturer, show me about the distribution of name and the sum of code , and group by attribute name in a bar chart, rank bar in asc order.
### Response:
| SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Name |
### Instruction:
For those employees who was hired before 2002-06-21, show me the trend about salary over hire_date with a line chart, and show from high to low by the HIRE_DATE.
### Response:
| SELECT HIRE_DATE, SALARY FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY HIRE_DATE DESC |
### Instruction:
Which Year Left is the highest one that has a Location of east chicago, and a Year Joined of 1969, and a School of east chicago roosevelt?
### Response:
| SELECT MAX("Year Left") FROM table_5611 WHERE "Location" = 'east chicago' AND "Year Joined" = '1969' AND "School" = 'east chicago roosevelt' |
### Instruction:
For those records from the products and each product's manufacturer, a bar chart shows the distribution of name and the average of code , and group by attribute name, and show Y from low to high order.
### Response:
| SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Code |
### Instruction:
Questions with the highest number of answers.. Questions with the highest number of answers.
### Response:
| SELECT p.OwnerUserId AS "user_link", p.Id AS "post_link", p.AnswerCount AS "answers", Score AS "votes", ViewCount AS "views" FROM Posts AS p WHERE p.OwnerUserId = 64785 ORDER BY p.AnswerCount DESC LIMIT 100 |
### Instruction:
Show the first names and last names of all the guests that have apartment bookings with status code 'Confirmed'.
### Response:
| SELECT T2.guest_first_name, T2.guest_last_name FROM apartment_bookings AS T1 JOIN guests AS T2 ON T1.guest_id = T2.guest_id WHERE T1.booking_status_code = "Confirmed" |
### Instruction:
Which Fencing Victories (pts) has a Shooting Score (pts) of 187 (1180) and a Total smaller than 5640? Question 1
### Response:
| SELECT "Fencing Victories (pts)" FROM table_65454 WHERE "Shooting Score (pts)" = '187 (1180)' AND "Total" < '5640' |
### Instruction:
count the number of patients who have received a laboratory ca-125 test.
### Response:
| SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'ca-125')) |
### Instruction:
since 2103, when was the last hospital admission time of patient 021-69410?
### Response:
| SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '021-69410' AND STRFTIME('%y', patient.hospitaladmittime) >= '2103' ORDER BY patient.hospitaladmittime DESC LIMIT 1 |
### Instruction:
Which area 2006 km has a city of sopot, and an area 1996 km smaller than 17.31?
### Response:
| SELECT MAX("area 2006 km\u00b2") FROM table_5874 WHERE "city" = 'sopot' AND "area 1996 km\u00b2" < '17.31' |
### Instruction:
monte carlo simulation papers published after 2011
### Response:
| SELECT DISTINCT paper.paperid FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'monte carlo simulation' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND paper.year > 2011 |
### Instruction:
A bar chart for what are the number of the name of rooms booked by customers whose first name has 'ROY' in part?, could you display from high to low by the names?
### Response:
| SELECT roomName, COUNT(roomName) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE FirstName LIKE '%ROY%' GROUP BY roomName ORDER BY roomName DESC |
### Instruction:
How many patients are admitted in transfer within this facility and use the lab item id 51427?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND lab.itemid = "51427" |
### Instruction:
For each user, return the name and the average rating of reviews given by them Plot them as bar chart, and could you show by the y axis from high to low?
### Response:
| SELECT name, AVG(T2.rating) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id ORDER BY AVG(T2.rating) DESC |
### Instruction:
what's the time for the hospital admission of patient 031-17834 during this year?
### Response:
| SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '031-17834' AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') |
### Instruction:
find the number of patients born before 2156 who had endoscopic retrograde cholangiography.
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2156" AND procedures.short_title = "Endosc retro cholangiopa" |
### Instruction:
What is the number of start dates for incidents with incident type code 'NOISE'? Bin by year and return a bar chart, and I want to order in descending by the Y-axis.
### Response:
| SELECT date_incident_start, COUNT(date_incident_start) FROM Behavior_Incident WHERE incident_type_code = "NOISE" ORDER BY COUNT(date_incident_start) DESC |
### Instruction:
Visualize a scatter chart on what are the staff ids and genders of all staffs whose job title is Department Manager?
### Response:
| SELECT T1.staff_id, T1.staff_gender FROM Staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = "Department Manager" |
### Instruction:
What soap opera was on 1960 1965, 1965 1983, 1984 2010?
### Response:
| SELECT "Soap Opera" FROM table_62908 WHERE "Years" = '1960–1965, 1965–1983, 1984–2010' |
### Instruction:
please tell me which airline has the most departures from ATLANTA
### Response:
| SELECT DISTINCT COUNT(*), flight.airline_code FROM airport_service, city, flight WHERE city.city_code = airport_service.city_code AND city.city_name = 'ATLANTA' AND flight.from_airport = airport_service.airport_code GROUP BY flight.airline_code |
### Instruction:
what is the three most common lab test performed?
### Response:
| SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t1.itemid FROM (SELECT labevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM labevents GROUP BY labevents.itemid) AS t1 WHERE t1.c1 <= 3) |
### Instruction:
How many races that had any driver whose forename is Lewis? Show me a line chart, and sort by the X in descending please.
### Response:
| SELECT year, COUNT(year) FROM results AS T1 JOIN races AS T2 ON T1.raceId = T2.raceId JOIN drivers AS T3 ON T1.driverId = T3.driverId WHERE T3.forename = "Lewis" ORDER BY year DESC |
### Instruction:
what is the price of a drug named enoxaparin 40 mg/0.4 ml syr?
### Response:
| SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'enoxaparin 40 mg/0.4 ml syr') |
### Instruction:
What is the first name of each student enrolled in class ACCT-211?
### Response:
| SELECT T3.stu_fname FROM class AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211' |
### Instruction:
My \newcommand comments without \begingroup.
### Response:
| SELECT CONCAT('https://math.stackexchange.com/questions/', PostId), Score, Text, CreationDate FROM Comments WHERE UserId = 11994 AND Text LIKE '%\newcommand%' AND NOT Text LIKE '%\begingroup%' COLLATE Latin1_General_100_CI_AI_SC ORDER BY CreationDate DESC |
### Instruction:
Characters per Score (CpS) by user on answers +. How much net score and views does each character in your answers among various tags bring you? Find out with this query ;)
### Response:
| SELECT SUM(LENGTH(Body)) / SUM(Score) * 1.0 AS CharsPerUpvote FROM Posts WHERE OwnerUserId = '##UserId##' AND PostTypeId = 2 GROUP BY OwnerUserId |
### Instruction:
give me the number of patients whose admission year is less than 2180 and item id is 51362?
### Response:
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2180" AND lab.itemid = "51362" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.