instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
What is the Score with a Home with hornets? | CREATE TABLE table_name_54 (score VARCHAR,home VARCHAR) | SELECT score FROM table_name_54 WHERE home = "hornets" |
what is the number of patients whose diagnoses long title is surgical operation with anastomosis, bypass, or graft, with natural or artificial tissues used as implant causing abnormal patient reaction, or later complication, without mention of misadventure at time of operation and drug type is base? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id tex... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Surgical operation with anastomosis, bypass, or graft, with natural or artificial tissues u... |
Which team classification has malaysian team classification of mncf continental team? | CREATE TABLE table_2615 ("Stage" real,"Stage winner" text,"General classification" text,"Points classification" text,"Mountains classification" text,"Malaysian rider classification" text,"Team classification" text,"Malaysian team classification" text) | SELECT "Team classification" FROM table_2615 WHERE "Malaysian team classification" = 'MNCF Continental Team' |
How many cuts were made when there weren't any wins but had a top-5 of 1 and a top 10 larger than 4? | CREATE TABLE table_name_62 (cuts_made INTEGER,top_10 VARCHAR,wins VARCHAR,top_5 VARCHAR) | SELECT SUM(cuts_made) FROM table_name_62 WHERE wins < 1 AND top_5 = 1 AND top_10 > 4 |
Give me a histogram, that simply displays the last name of the employee and the corresponding manager id, could you show by the x-axis in asc? | CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal... | SELECT LAST_NAME, MANAGER_ID FROM employees ORDER BY LAST_NAME |
Which Wins has Podiums of 0, and a Series of masters of formula 3? | CREATE TABLE table_name_40 (wins VARCHAR,podiums VARCHAR,series VARCHAR) | SELECT wins FROM table_name_40 WHERE podiums = "0" AND series = "masters of formula 3" |
What team picked 80? | CREATE TABLE table_name_94 (team VARCHAR,pick VARCHAR) | SELECT team FROM table_name_94 WHERE pick = 80 |
what are the three most frequent drugs that were prescribed to female patients of the 50s within 2 months after having been diagnosed with drug-induced delirium? | CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE procedures_icd (... | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ... |
Who directed the episode with production code 177605? | CREATE TABLE table_73969 ("No." real,"#" real,"Title" text,"Directed by" text,"Written by" text,"Patient Portrayer" text,"Original air date" text,"Production code" real) | SELECT "Directed by" FROM table_73969 WHERE "Production code" = '177605' |
How many enrolment students in each month? Return a bar chart binning date of enrolment by month interval, and I want to order in asc by the y-axis. | CREATE TABLE Student_Course_Enrolment (registration_id INTEGER,student_id INTEGER,course_id INTEGER,date_of_enrolment DATETIME,date_of_completion DATETIME)CREATE TABLE Course_Authors_and_Tutors (author_id INTEGER,author_tutor_ATB VARCHAR(3),login_name VARCHAR(40),password VARCHAR(40),personal_name VARCHAR(80),middle_na... | SELECT date_of_enrolment, COUNT(date_of_enrolment) FROM Student_Course_Enrolment ORDER BY COUNT(date_of_enrolment) |
how much does norepinephrine 4 mg/250 ml ns cost to take? | CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,syst... | SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'norepinephrine 4 mg/250 ml ns') |
give me the number of patients whose primary disease is liver transplant and days of hospital stay is greater than 8? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "LIVER TRANSPLANT" AND demographic.days_stay > "8" |
R/A Flags Before and After HNQ. | CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByReviewTaskId... | SELECT COUNT(*) FROM Votes WHERE VoteTypeId = 4 AND CreationDate > '2018-10-18 00:00:00.000' |
What was the margin of victory for the Mississippi Gulf Resort Classic? | CREATE TABLE table_68002 ("Date" text,"Tournament" text,"Winning score" text,"Margin of victory" text,"Runner(s)-up" text) | SELECT "Margin of victory" FROM table_68002 WHERE "Tournament" = 'mississippi gulf resort classic' |
who was the last ranked competitor in group a ? | CREATE TABLE table_204_741 (id number,"rank" number,"name" text,"nationality" text,"1,62" text,"1,67" text,"1,72" text,"1,75" text,"notes" text) | SELECT "name" FROM table_204_741 ORDER BY "rank" DESC LIMIT 1 |
How many events resulted in a top-25 less than 2? | CREATE TABLE table_38401 ("Tournament" text,"Wins" real,"Top-5" real,"Top-10" real,"Top-25" real,"Events" real,"Cuts made" real) | SELECT COUNT("Events") FROM table_38401 WHERE "Top-25" < '2' |
What are the names of all genres in alphabetical order, combined with its ratings? | CREATE TABLE files (f_id number,artist_name text,file_size text,duration text,formats text)CREATE TABLE genre (g_name text,rating text,most_popular_in text)CREATE TABLE song (song_name text,artist_name text,country text,f_id number,genre_is text,rating number,languages text,releasedate time,resolution number)CREATE TAB... | SELECT g_name, rating FROM genre ORDER BY g_name |
What is the name of the driver in 1955? | CREATE TABLE table_57940 ("Year" text,"Driver" text,"Constructor" text,"Category" text,"Location" text,"Report" text) | SELECT "Driver" FROM table_57940 WHERE "Year" = '1955' |
until 09/2103 has patient 3118 had any drain out #1 jackson pratt output? | 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 inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE admissions (row_id n... | SELECT COUNT(*) > 0 FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3118)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'drain out #1 ja... |
what was the last baekje temple ? | CREATE TABLE table_204_465 (id number,"#" number,"temple name" text,"hangul" text,"hanja" text,"period of reign" text,"personal name" text,"relationship" text,"note" text) | SELECT "temple name" FROM table_204_465 ORDER BY "period of reign" DESC LIMIT 1 |
What was the record in the game against Eskimos? | CREATE TABLE table_23685152_2 (record VARCHAR,opponent VARCHAR) | SELECT record FROM table_23685152_2 WHERE opponent = "Eskimos" |
What courses I am required to take before MUSED 370 ? | CREATE TABLE area (course_id int,area varchar)CREATE TABLE ta (campus_job_id int,student_id int,location 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 ... | SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT... |
what is the date when the opponent# is iowa? | CREATE TABLE table_name_42 (date VARCHAR,opponent_number VARCHAR) | SELECT date FROM table_name_42 WHERE opponent_number = "iowa" |
Return a bar chart on how many hours do the students spend studying in each department?, could you sort in descending by the sum stu hrs please? | CREATE TABLE CLASS (CLASS_CODE varchar(5),CRS_CODE varchar(10),CLASS_SECTION varchar(2),CLASS_TIME varchar(20),CLASS_ROOM varchar(8),PROF_NUM int)CREATE TABLE PROFESSOR (EMP_NUM int,DEPT_CODE varchar(10),PROF_OFFICE varchar(50),PROF_EXTENSION varchar(4),PROF_HIGH_DEGREE varchar(5))CREATE TABLE ENROLL (CLASS_CODE varcha... | SELECT DEPT_CODE, SUM(STU_HRS) FROM STUDENT GROUP BY DEPT_CODE ORDER BY SUM(STU_HRS) DESC |
Show id from each meter 400, and sort y-axis in ascending order. | CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time text)CREATE TABLE event (ID int,Name text,Stadium_ID int,Year text)CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE stadiu... | SELECT meter_400, ID FROM swimmer ORDER BY ID |
What class in the word with part 4 'giheizan'? | CREATE TABLE table_1745843_8 (class VARCHAR,part_4 VARCHAR) | SELECT class FROM table_1745843_8 WHERE part_4 = "giheizan" |
What was the score with the opponent being New Zealand Warriors? | CREATE TABLE table_name_67 (score VARCHAR,opponent VARCHAR) | SELECT score FROM table_name_67 WHERE opponent = "new zealand warriors" |
What shooter has wc munich as the event, and 8 as the rank points? | CREATE TABLE table_name_43 (shooter VARCHAR,event VARCHAR,rank_points VARCHAR) | SELECT shooter FROM table_name_43 WHERE event = "wc munich" AND rank_points = "8" |
What was the percentage for T. Papadopoulos when I. Kasoulidis was 27.1%? | CREATE TABLE table_69604 ("Polling Firm" text,"Date Published" text,"T. Papadopoulos" text,"D. Christofias" text,"I. Kasoulidis" text,"K. Themistokleous" text) | SELECT "T. Papadopoulos" FROM table_69604 WHERE "I. Kasoulidis" = '27.1%' |
Give the maximum product price for each product type in a pie chart. | CREATE TABLE Supplier_Addresses (supplier_id INTEGER,address_id INTEGER,date_from DATETIME,date_to DATETIME)CREATE TABLE Staff_Department_Assignments (staff_id INTEGER,department_id INTEGER,date_assigned_from DATETIME,job_title_code VARCHAR(10),date_assigned_to DATETIME)CREATE TABLE Addresses (address_id INTEGER,addres... | SELECT product_type_code, MAX(product_price) FROM Products GROUP BY product_type_code |
What is the average top-25 value for majors that have more than 0 wins? | CREATE TABLE table_51787 ("Tournament" text,"Wins" real,"Top-5" real,"Top-10" real,"Top-25" real,"Events" real,"Cuts made" real) | SELECT AVG("Top-25") FROM table_51787 WHERE "Wins" > '0' |
were patient 018-47575 in the emergency room? | CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime ti... | SELECT COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '018-47575' AND patient.hospitaladmitsource = 'emergency department' |
What team played in front of 28,536 at an away stadium? | CREATE TABLE table_name_34 (away_team VARCHAR,crowd INTEGER) | SELECT away_team AS score FROM table_name_34 WHERE crowd > 28 OFFSET 536 |
which nationality is top on the chart | CREATE TABLE table_204_866 (id number,"name" text,"lifetime" text,"nationality" text,"notable as" text,"notes" text) | SELECT "nationality" FROM table_204_866 WHERE id = 1 |
What is the number of bronze when the total is smaller than 1? | CREATE TABLE table_name_58 (bronze INTEGER,total INTEGER) | SELECT AVG(bronze) FROM table_name_58 WHERE total < 1 |
which club had a total of only four wins ? | CREATE TABLE table_204_135 (id number,"position" number,"club" text,"played" number,"points" number,"wins" number,"draws" number,"losses" number,"goals for" number,"goals against" number,"goal difference" number) | SELECT "club" FROM table_204_135 WHERE "wins" = 4 |
What is the average cap number in scotland in 1986 1998 leass than 69? | CREATE TABLE table_54656 ("Name" text,"Scotland career" text,"Caps" real,"Goals" real,"Average" real) | SELECT COUNT("Average") FROM table_54656 WHERE "Caps" < '69' AND "Scotland career" = '1986–1998' |
What school has rebels as their mascot? | CREATE TABLE table_name_8 (school VARCHAR,mascot VARCHAR) | SELECT school FROM table_name_8 WHERE mascot = "rebels" |
Stacked bar of date in locaton to and the number of date in locaton to colored by Location_Code, order by the Y in ascending. | CREATE TABLE Employees (Employee_ID INTEGER,Role_Code CHAR(15),Employee_Name VARCHAR(255),Gender_MFU CHAR(1),Date_of_Birth DATETIME,Other_Details VARCHAR(255))CREATE TABLE Ref_Locations (Location_Code CHAR(15),Location_Name VARCHAR(255),Location_Description VARCHAR(255))CREATE TABLE Ref_Document_Types (Document_Type_Co... | SELECT Date_in_Locaton_To, COUNT(Date_in_Locaton_To) FROM Document_Locations GROUP BY Location_Code ORDER BY COUNT(Date_in_Locaton_To) |
Gold of 0, and a Bronze smaller than 0 and what is the sum of the silver? | CREATE TABLE table_name_69 (silver INTEGER,gold VARCHAR,bronze VARCHAR) | SELECT SUM(silver) FROM table_name_69 WHERE gold = 0 AND bronze < 0 |
Who is the candidate that had 10 fired in week 2 (1-27-2005)? | CREATE TABLE table_name_45 (candidate VARCHAR,result VARCHAR) | SELECT candidate FROM table_name_45 WHERE result = "10 fired in week 2 (1-27-2005)" |
List the last name of the students who do not have any food type allergy and count them in a bart chart. | CREATE TABLE Allergy_Type (Allergy VARCHAR(20),AllergyType VARCHAR(20))CREATE TABLE Has_Allergy (StuID INTEGER,Allergy VARCHAR(20))CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTEGER,city_code VARCHAR(3)) | SELECT LName, COUNT(LName) FROM Student WHERE NOT StuID IN (SELECT T1.StuID FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.AllergyType = "food") GROUP BY LName |
provide the number of patients who died primarily due to fall on stair/step nec. | 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "1" AND diagnoses.short_title = "Fall on stair/step NEC" |
Bronze smaller than 5, and a Silver larger than 0 is which nation? | CREATE TABLE table_name_66 (nation VARCHAR,bronze VARCHAR,silver VARCHAR) | SELECT nation FROM table_name_66 WHERE bronze < 5 AND silver > 0 |
Who was the constructor when Eugenio Castellotti was the pole position and the race had a C tyre? | CREATE TABLE table_57592 ("Race" text,"Circuit" text,"Date" text,"Pole position" text,"Fastest lap" text,"Winning driver" text,"Constructor" text,"Tyre" text,"Report" text) | SELECT "Constructor" FROM table_57592 WHERE "Tyre" = 'c' AND "Pole position" = 'eugenio castellotti' |
tell me the price of a procedure called agent specific therapy - calcium channel blockers overdose? | CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number... | SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'treatment' AND cost.eventid IN (SELECT treatment.treatmentid FROM treatment WHERE treatment.treatmentname = 'agent specific therapy - calcium channel blockers overdose') |
Which years had a jersey number 55 | CREATE TABLE table_17156 ("Player" text,"No.(s)" text,"Height in Ft." text,"Position" text,"Years for Rockets" text,"School/Club Team/Country" text) | SELECT "Years for Rockets" FROM table_17156 WHERE "No.(s)" = '55' |
What is the earliest year with less than 3 points and Parmalat Forti Ford was the entrant? | CREATE TABLE table_name_40 (year INTEGER,points VARCHAR,entrant VARCHAR) | SELECT MIN(year) FROM table_name_40 WHERE points < 3 AND entrant = "parmalat forti ford" |
out of all their times , which one was fastest ? | CREATE TABLE table_204_547 (id number,"rank" number,"lane" number,"name" text,"nationality" text,"time" number,"notes" text) | SELECT "time" FROM table_204_547 ORDER BY "time" LIMIT 1 |
Which flight had an aircraft of vickers viscount type 794? | CREATE TABLE table_47704 ("Date" text,"Flight" text,"Aircraft" text,"Registration" text,"Location" text,"Fatalities" real) | SELECT "Flight" FROM table_47704 WHERE "Aircraft" = 'vickers viscount type 794' |
Who held the Communications Rep position in 2011? | CREATE TABLE table_name_65 (position VARCHAR) | SELECT 2011 FROM table_name_65 WHERE position = "communications rep" |
What is the latitude that has a sqmi smaller than 34.401, a Geo ID smaller than 3807157722, and a Longitude of -98.475995? | CREATE TABLE table_64769 ("Township" text,"County" text,"Pop. (2010)" real,"Land (sqmi)" real,"Water (sqmi)" real,"Latitude" real,"Longitude" real,"GEO ID" real,"ANSI code" real) | SELECT "Latitude" FROM table_64769 WHERE "Land ( sqmi )" < '34.401' AND "GEO ID" < '3807157722' AND "Longitude" = '-98.475995' |
For those records from the products and each product's manufacturer, give me the comparison about the sum of code over the headquarter , and group by attribute headquarter, display y axis from high to low order. | 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.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T1.Code DESC |
Who was the runner up the season that Sagawa Express came in fourth? | CREATE TABLE table_31143 ("Season" real,"Winner" text,"Runner-up" text,"Third place" text,"Fourth place" text) | SELECT "Runner-up" FROM table_31143 WHERE "Fourth place" = 'Sagawa Express' |
when is the first time that patient 002-52932 has had a heartrate measured until 03/10/2100? | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatment... | SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-52932')) AND NOT vitalperiodic.heartrate IS NUL... |
Name the women's doubles for frederik kj rholm elsner | CREATE TABLE table_15026 ("Year" real,"Men's singles" text,"Women's singles" text,"Men's doubles" text,"Women's doubles" text,"Mixed doubles" text) | SELECT "Women's doubles" FROM table_15026 WHERE "Men's singles" = 'frederik kjærholm elsner' |
On February 26, who was the leading scorer? | CREATE TABLE table_56464 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Leading scorer" text,"Record" text) | SELECT "Leading scorer" FROM table_56464 WHERE "Date" = 'february 26' |
how many patients are below 49 years of age and admitted under the year 2198? | 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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "49" AND demographic.admityear < "2198" |
What's the sum of Top-10 that has Events that's larger than 16, and has a Top-5 that's also larger than 5? | CREATE TABLE table_name_87 (top_10 VARCHAR,events VARCHAR,top_5 VARCHAR) | SELECT COUNT(top_10) FROM table_name_87 WHERE events > 16 AND top_5 > 5 |
give me the number of patients whose days of hospital stay is greater than 26 and diagnoses short title is joint replaced knee? | 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 INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "26" AND diagnoses.short_title = "Joint replaced knee" |
In the election earlier than 2012 how many Inhabitants had a Party of five star movement? | CREATE TABLE table_name_57 (inhabitants INTEGER,party VARCHAR,election VARCHAR) | SELECT SUM(inhabitants) FROM table_name_57 WHERE party = "five star movement" AND election < 2012 |
In what Distance has a Venue of sale? | CREATE TABLE table_name_36 (distance VARCHAR,venue VARCHAR) | SELECT distance FROM table_name_36 WHERE venue = "sale" |
List the number of the phone numbers of all employees. | CREATE TABLE Playlist (PlaylistId integer,Name varchar(120))CREATE TABLE Artist (ArtistId integer,Name varchar(120))CREATE TABLE MediaType (MediaTypeId integer,Name varchar(120))CREATE TABLE Invoice (InvoiceId integer,CustomerId integer,InvoiceDate datetime,BillingAddress varchar(70),BillingCity varchar(40),BillingStat... | SELECT Phone, COUNT(Phone) FROM Employee GROUP BY Phone |
what is the difference in percentage of lead shot at 25 yards between cylinder and skeet 1 barrels ? | CREATE TABLE table_203_112 (id number,"choke" text,"constriction (inch)" number,"percentage of lead shot in 30-inch circle at 40 yards" text,"identification (notches)" number,"identification (stars)\n(spanish shotguns)" number) | SELECT ABS((SELECT "percentage of lead shot in 30-inch circle at 40 yards" FROM table_203_112 WHERE "choke" = 'cylinder') - (SELECT "percentage of lead shot in 30-inch circle at 40 yards" FROM table_203_112 WHERE "choke" = 'skeet 1')) |
What is the record of game 42, which had a clemmensen decision? | CREATE TABLE table_44824 ("Game" real,"Date" real,"Opponent" text,"Score" text,"Decision" text,"Location/Attendance" text,"Record" text) | SELECT "Record" FROM table_44824 WHERE "Decision" = 'clemmensen' AND "Game" = '42' |
give me the number of patients whose ethnicity is asian and age is less than 80? | 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,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "ASIAN" AND demographic.age < "80" |
Find the enrollment date for all the tests that have 'Pass' result, and count them by a bar chart, sort by the Y from low to high please. | CREATE TABLE Students (student_id INTEGER,date_of_registration DATETIME,date_of_latest_logon DATETIME,login_name VARCHAR(40),password VARCHAR(10),personal_name VARCHAR(40),middle_name VARCHAR(40),family_name VARCHAR(40))CREATE TABLE Courses (course_id INTEGER,author_id INTEGER,subject_id INTEGER,course_name VARCHAR(120... | 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" ORDER BY COUNT(date_of_enrolment) |
What is the description and code of the type of service that is performed the most often? | CREATE TABLE products (product_id text,product_name text,product_price number,product_description text,other_product_service_details text)CREATE TABLE performers_in_bookings (order_id number,performer_id number)CREATE TABLE clients (client_id number,address_id number,customer_email_address text,customer_name text,custo... | SELECT T1.service_type_description, T1.service_type_code FROM ref_service_types AS T1 JOIN services AS T2 ON T1.service_type_code = T2.service_type_code GROUP BY T1.service_type_code ORDER BY COUNT(*) DESC LIMIT 1 |
What is the Attendance of New Zealand Scores in bold? | CREATE TABLE table_65097 ("Date" text,"Opponent" text,"Score" text,"Venue" text,"Attendance" text) | SELECT "Attendance" FROM table_65097 WHERE "Date" = 'new zealand scores in bold' |
What code is used to represent the currency of Croatian Kuna? | CREATE TABLE table_name_34 (code VARCHAR,currency VARCHAR) | SELECT code FROM table_name_34 WHERE currency = "croatian kuna" |
Give me a bar chart for mean max(score) of each year, and sort by the y-axis in ascending. | CREATE TABLE appellations (No INTEGER,Appelation TEXT,County TEXT,State TEXT,Area TEXT,isAVA TEXT)CREATE TABLE grapes (ID INTEGER,Grape TEXT,Color TEXT)CREATE TABLE wine (No INTEGER,Grape TEXT,Winery TEXT,Appelation TEXT,State TEXT,Name TEXT,Year INTEGER,Price INTEGER,Score INTEGER,Cases INTEGER,Drink TEXT) | SELECT Year, AVG(MAX(Score)) FROM wine ORDER BY AVG(MAX(Score)) |
what is the name of a procedure that patient 73713 has been given for two times since 70 months ago? | CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE d_icd_procedur... | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 737... |
What is the number of tries for that has 30 tries against? | CREATE TABLE table_69514 ("Club" text,"Played" text,"Drawn" text,"Lost" text,"Points for" text,"Points against" text,"Tries for" text,"Tries against" text,"Try bonus" text,"Losing bonus" text,"Points" text) | SELECT "Tries for" FROM table_69514 WHERE "Tries against" = '30' |
Who is the player who had more than 1,052 points? | CREATE TABLE table_34511 ("Rank" text,"Player" text,"Position" text,"Career" text,"Points" real) | SELECT "Player" FROM table_34511 WHERE "Points" > '1,052' |
how long did it take the german team to finish the race ? | CREATE TABLE table_203_160 (id number,"rank" number,"heat" number,"nation" text,"competitors" text,"time" text,"notes" text) | SELECT "time" FROM table_203_160 WHERE "nation" = 'germany' |
When Connie Shaw took GREEK 695 , who was the teacher ? | CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE course_offering (offering_id int,course_id int,semester int,section_number int,start_time time,end_time time,monday varchar,tuesday varchar,wednesday var... | 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_... |
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, visualize a bar chart about the distribution of job_id and the sum of salary , and group by attribute job_id, and rank sum salary from high to low order. | CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,J... | SELECT JOB_ID, SUM(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY SUM(SALARY) DESC |
what is the game when on november 27? | CREATE TABLE table_77372 ("Game" real,"November" real,"Opponent" text,"Score" text,"Record" text) | SELECT SUM("Game") FROM table_77372 WHERE "November" = '27' |
What is the proportion of the number of schools in different counties? | CREATE TABLE endowment (endowment_id int,School_id int,donator_name text,amount real)CREATE TABLE School (School_id text,School_name text,Location text,Mascot text,Enrollment int,IHSAA_Class text,IHSAA_Football_Class text,County text)CREATE TABLE budget (School_id int,Year int,Budgeted int,total_budget_percent_budgeted... | SELECT County, COUNT(*) FROM School GROUP BY County |
provide the number of patients whose gender is f and drug name is phenytoin sodium? | 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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "F" AND prescriptions.drug = "Phenytoin Sodium" |
what was year was the first arizona license plate made ? | CREATE TABLE table_203_82 (id number,"first issued" number,"design" text,"slogan" text,"serial format" text,"serials issued" text,"notes" text) | SELECT MIN("first issued") FROM table_203_82 |
Which Lead has a Nation of switzerland? | CREATE TABLE table_name_15 (lead VARCHAR,nation VARCHAR) | SELECT lead FROM table_name_15 WHERE nation = "switzerland" |
What is the smallest draws for a player larger than 2 with a 100% wins? | CREATE TABLE table_name_83 (drawn INTEGER,played VARCHAR,_percentage_won VARCHAR) | SELECT MIN(drawn) FROM table_name_83 WHERE played > 2 AND _percentage_won > 100 |
How many students that has a GPA lower than average? Show me a pie chart grouping by student's first name. | CREATE TABLE CLASS (CLASS_CODE varchar(5),CRS_CODE varchar(10),CLASS_SECTION varchar(2),CLASS_TIME varchar(20),CLASS_ROOM varchar(8),PROF_NUM int)CREATE TABLE COURSE (CRS_CODE varchar(10),DEPT_CODE varchar(10),CRS_DESCRIPTION varchar(35),CRS_CREDIT float(8))CREATE TABLE ENROLL (CLASS_CODE varchar(5),STU_NUM int,ENROLL_... | SELECT STU_FNAME, COUNT(STU_FNAME) FROM STUDENT WHERE STU_GPA < (SELECT AVG(STU_GPA) FROM STUDENT) GROUP BY STU_FNAME |
Find the claimed amount in the claim with the least amount settled. Show both the settlement amount and claim amount. | CREATE TABLE customers (customer_id number,customer_details text)CREATE TABLE settlements (settlement_id number,claim_id number,date_claim_made time,date_claim_settled time,amount_claimed number,amount_settled number,customer_policy_id number)CREATE TABLE payments (payment_id number,settlement_id number,payment_method_... | SELECT amount_settled, amount_claimed FROM claims ORDER BY amount_settled LIMIT 1 |
What machine has 5 as the place? | CREATE TABLE table_40931 ("Place" real,"Rider" text,"Country" text,"Machine" text,"Speed" text,"Time" text,"Points" real) | SELECT "Machine" FROM table_40931 WHERE "Place" = '5' |
How many students participated in tryouts for each college by descennding count? | CREATE TABLE player (pid number,pname text,ycard text,hs number)CREATE TABLE tryout (pid number,cname text,ppos text,decision text)CREATE TABLE college (cname text,state text,enr number) | SELECT COUNT(*), cname FROM tryout GROUP BY cname ORDER BY COUNT(*) DESC |
When momoiro clover z is the vocalist how many japanese titles are there? | CREATE TABLE table_2460 ("#" real,"Japanese title" text,"R\u014dmaji" text,"Japanese translation" text,"Vocalist" text,"Episodes used" text) | SELECT COUNT("Japanese title") FROM table_2460 WHERE "Vocalist" = 'Momoiro Clover Z' |
What was the attendance at war memorial stadium? | CREATE TABLE table_4855 ("Week" real,"Opponent" text,"Result" text,"Stadium" text,"Record" text,"Attenmdance" text) | SELECT "Attenmdance" FROM table_4855 WHERE "Stadium" = 'war memorial stadium' |
What's the total amount of USSR that has more than 0 gold, less than 85 silver and more than 6 bronze? | CREATE TABLE table_14012 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT MIN("Total") FROM table_14012 WHERE "Gold" > '0' AND "Bronze" > '6' AND "Nation" = 'ussr' AND "Silver" < '85' |
What is the position of the team that played at the venue, Central, Gomel? | CREATE TABLE table_name_71 (position_in_1999 VARCHAR,venue VARCHAR) | SELECT position_in_1999 FROM table_name_71 WHERE venue = "central, gomel" |
Which player had a total of 152? | CREATE TABLE table_name_60 (player VARCHAR,total VARCHAR) | SELECT player FROM table_name_60 WHERE total = "152" |
For patient Kurt Buczek, specify the location he was admitted to and his death status | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag... | SELECT demographic.expire_flag, demographic.admission_location FROM demographic WHERE demographic.name = "Kurt Buczek" |
Who had the fastest lap when the winning driver was kristian ghedina? | CREATE TABLE table_26920192_5 (fastest_lap VARCHAR,winning_driver VARCHAR) | SELECT fastest_lap FROM table_26920192_5 WHERE winning_driver = "Kristian Ghedina" |
In what district was the successor seated August 31, 1943? | CREATE TABLE table_24498 ("District" text,"Vacator" text,"Reason for change" text,"Successor" text,"Date successor seated" text) | SELECT "District" FROM table_24498 WHERE "Date successor seated" = 'August 31, 1943' |
How many silvers have a gold greater than 2, a bronze less than 35, china as the nation, with a total greater than 26? | CREATE TABLE table_42700 ("Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT COUNT("Silver") FROM table_42700 WHERE "Gold" > '2' AND "Bronze" < '35' AND "Nation" = 'china' AND "Total" > '26' |
What are all the distinct payment types? | CREATE TABLE products_for_hire (product_id number,product_type_code text,daily_hire_cost number,product_name text,product_description text)CREATE TABLE customers (customer_id number,coupon_id number,good_or_bad_customer text,first_name text,last_name text,gender_mf text,date_became_customer time,date_last_hire time)CRE... | SELECT DISTINCT payment_type_code FROM payments |
what is the name of the drug which patient 012-4131 was prescribed during the same day after having received a therapeutic antibacterials - third generation cephalosporin procedure until 08/2105? | CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labres... | SELECT t2.drugname FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-4131') AND treatment.treatmen... |
What year was the 4th Place Team of the Wyoming Angus, Johnstown, Co? | CREATE TABLE table_64334 ("Year" real,"1st Place Team" text,"2nd Place Team" text,"3rd Place Team" text,"4th Place Team" text,"Host Location" text) | SELECT COUNT("Year") FROM table_64334 WHERE "4th Place Team" = 'wyoming angus, johnstown, co' |
TOP 50 users from Bangladesh. Lists the top 50 users (ranked by reputation) that are located in Calicut/Kozhikode, Kerala, India according to their profile information.
Thanks to http://data.stackexchange.com/stackoverflow/qe/1157/top-100-users-from-greece | 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 CloseReasonTypes (Id number,Name text,Description text)CREATE T... | SELECT Id, DisplayName, Reputation, WebsiteUrl, Location, LastAccessDate FROM Users WHERE Location LIKE '%Bangladesh%' ORDER BY Reputation DESC LIMIT 150 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.