instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
How many accounts are opened in each day? Bin the account open day by weekday in a bar chart, and sort by the Y-axis in asc.
CREATE TABLE Order_Items (order_item_id INTEGER,order_id INTEGER,product_id INTEGER,product_quantity VARCHAR(50),other_order_item_details VARCHAR(255))CREATE TABLE Accounts (account_id INTEGER,customer_id INTEGER,date_account_opened DATETIME,account_name VARCHAR(50),other_account_details VARCHAR(255))CREATE TABLE Finan...
SELECT date_account_opened, COUNT(date_account_opened) FROM Accounts ORDER BY COUNT(date_account_opened)
What Label released on October 25, 1984, in the format of Stereo LP?
CREATE TABLE table_name_79 (label VARCHAR,date VARCHAR,format VARCHAR)
SELECT label FROM table_name_79 WHERE date = "october 25, 1984" AND format = "stereo lp"
give me the number of patients whose language is ptun and year of death is less than or equal to 2132?
CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.language = "PTUN" AND demographic.dod_year <= "2132.0"
What ship type was from SE?
CREATE TABLE table_name_86 (ship_type VARCHAR,nat VARCHAR)
SELECT ship_type FROM table_name_86 WHERE nat = "se"
count the number of patients who had the intake of capd dialysate since 6 years ago.
CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,insurance text,language text,marital_status text,ethnicity text,age number)CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icus...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT icustays.hadm_id FROM icustays WHERE icustays.icustay_id IN (SELECT inputevents_cv.icustay_id FROM inputevents_cv WHERE inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'capd dialysate' AND...
what were the four most frequently given microbiology tests for patients who had received cultures earlier during the same hospital visit in 2105?
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissio...
SELECT t3.culturesite FROM (SELECT t2.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'cultures'...
give me the long title of procedure for procedure icd9 code 3613.
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 procedures.long_title FROM procedures WHERE procedures.icd9_code = "3613"
What is the average rating for each movie that has never been reviewed by Brittany Harris.
CREATE TABLE Reviewer (rID int,name text)CREATE TABLE Rating (rID int,mID int,stars int,ratingDate date)CREATE TABLE Movie (mID int,title text,year int,director text)
SELECT mID, AVG(stars) FROM Rating WHERE NOT mID IN (SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = "Brittany Harris") GROUP BY mID
Name the name for norway nationality
CREATE TABLE table_28140 ("Position" text,"Name" text,"Nationality" text,"Event 1 Super Yoke" text,"Event 2 Power Stairs" text,"Event 3 Car Lift" text,"Event 4 Farmers Walk" text,"Event 5 Truck Pull" text,"Event 6 Fingals Fingers" text,"Event 7 Atlas Stones" text)
SELECT "Name" FROM table_28140 WHERE "Nationality" = 'Norway'
Which Pre-1009 province has a Post-1009 province of donggye?
CREATE TABLE table_7761 ("Province of Silla" text,"Administrative district" text,"Pre-1009 province" text,"Post-1009 province" text,"Modern equivalent" text)
SELECT "Pre-1009 province" FROM table_7761 WHERE "Post-1009 province" = 'donggye'
in 2007, what is the avg finish that had a start less than 1?
CREATE TABLE table_49206 ("Year" real,"Starts" real,"Wins" real,"Top 5" real,"Top 10" real,"Poles" real,"Avg. Start" real,"Avg. Finish" real,"Winnings" text,"Position" text)
SELECT SUM("Avg. Finish") FROM table_49206 WHERE "Year" = '2007' AND "Starts" < '1'
Album of les mots had what lowest year?
CREATE TABLE table_name_18 (year INTEGER,album VARCHAR)
SELECT MIN(year) FROM table_name_18 WHERE album = "les mots"
List each donator name and the amount of endowment in descending order of the amount of endowment.
CREATE TABLE school (school_id text,school_name text,location text,mascot text,enrollment number,ihsaa_class text,ihsaa_football_class text,county text)CREATE TABLE endowment (endowment_id number,school_id number,donator_name text,amount number)CREATE TABLE budget (school_id number,year number,budgeted number,total_bud...
SELECT donator_name, SUM(amount) FROM endowment GROUP BY donator_name ORDER BY SUM(amount) DESC
Maxium reputation without a gold badge.
CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE Comments (Id number,PostId number,Sc...
SELECT u.Id AS "user_link", u.Reputation FROM Users AS u WHERE u.Id NOT IN (SELECT b.UserId FROM Badges AS b INNER JOIN Tags AS t ON t.TagName = b.Name GROUP BY b.UserId, t.Id HAVING COUNT(*) = 3) ORDER BY u.Reputation DESC
provide the number of patients whose admission type is emergency and lab test name is troponin i?
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND lab.label = "Troponin I"
What is the result of nominee, Patricia McGourty, for the drama desk award?
CREATE TABLE table_name_17 (result VARCHAR,award VARCHAR,nominee VARCHAR)
SELECT result FROM table_name_17 WHERE award = "drama desk award" AND nominee = "patricia mcgourty"
Name the listen owners for repairone
CREATE TABLE table_24664 ("Team" text,"Truck(s)" text,"#" real,"Driver(s)" text,"Primary Sponsor(s)" text,"Listed Owner(s)" text,"Crew Chief" text)
SELECT "Listed Owner(s)" FROM table_24664 WHERE "Primary Sponsor(s)" = 'RepairOne'
what constituency comes immediately before palanpur ?
CREATE TABLE table_204_683 (id number,"no." number,"constituency" text,"winner candidate" text,"party" text,"votes" number,"margin" number)
SELECT "constituency" FROM table_204_683 WHERE "no." = (SELECT "no." FROM table_204_683 WHERE "constituency" = 'palanpur') - 1
What is the class number of the Thin Films course ?
CREATE TABLE student_record (student_id int,course_id int,semester int,grade varchar,how varchar,transfer_source varchar,earn_credit varchar,repeat_term varchar,test_id varchar)CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE course (course_id int,name varchar,...
SELECT DISTINCT number FROM course WHERE (description LIKE '%Thin Films%' OR name LIKE '%Thin Films%') AND department = 'EECS'
What was the Loss that had a Score of 9-1?
CREATE TABLE table_name_87 (loss VARCHAR,score VARCHAR)
SELECT loss FROM table_name_87 WHERE score = "9-1"
what is the number of patients whose admission year is less than 2165 and lab test name is reticulocyte count, manual?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2165" AND lab.label = "Reticulocyte Count, Manual"
What was the result on 16 November 2003?
CREATE TABLE table_37915 ("Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text)
SELECT "Result" FROM table_37915 WHERE "Date" = '16 november 2003'
What is the place of Australia?
CREATE TABLE table_name_46 (place VARCHAR,country VARCHAR)
SELECT place FROM table_name_46 WHERE country = "australia"
How many points did the Falcons score when the record was 4-4?
CREATE TABLE table_20980 ("Game" real,"Date" text,"Opponent" text,"Result" text,"Falcons points" real,"Opponents" real,"Record" text,"Attendance" real)
SELECT "Falcons points" FROM table_20980 WHERE "Record" = '4-4'
which motorcycle did garry mccoy use on his team ?
CREATE TABLE table_204_162 (id number,"team" text,"constructor" text,"motorcycle" text,"tyres" text,"no" number,"rider" text,"rounds" text)
SELECT "motorcycle" FROM table_204_162 WHERE "rider" = 'garry mccoy'
What is the Pinyin for ?
CREATE TABLE table_35849 ("Name" text,"Hanzi" text,"Hanyu Pinyin" text,"Population (2010-11-01)" text,"Area (km\u00b2)" text,"Density (/km\u00b2)" text)
SELECT "Hanyu Pinyin" FROM table_35849 WHERE "Hanzi" = '依兰县'
What's the standard name that has a common name of ADSL Over Pots and ADSL version?
CREATE TABLE table_64595 ("Version" text,"Standard name" text,"Common name" text,"Downstream rate" text,"Upstream rate" text)
SELECT "Standard name" FROM table_64595 WHERE "Version" = 'adsl' AND "Common name" = 'adsl over pots'
Name the mixed doubles when tour is hong kong super series
CREATE TABLE table_19376 ("Tour" text,"Mens singles" text,"Womens singles" text,"Mens doubles" text,"Womens doubles" text,"Mixed doubles" text)
SELECT "Mixed doubles" FROM table_19376 WHERE "Tour" = 'Hong Kong Super Series'
Name the D 48 O with D 41 of d 41
CREATE TABLE table_79909 ("D 41 \u221a" text,"D 42 \u221a" text,"D 43 \u221a" text,"D 44 O" text,"D 45 O" text,"D 46 O" text,"D 47 O" text,"D 48 O" text)
SELECT "D 48 O" FROM table_79909 WHERE "D 41 \u221a" = 'd 41 √'
what is the name of the drug, which patient 028-30487 was prescribed in the same day after being diagnosed with metabolic acidosis - lactic acidosis since 02/2105?
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosag...
SELECT t2.drugname FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-30487') AND diagnosis.diagnos...
including each municipality how many km total are there ?
CREATE TABLE table_204_249 (id number,"km" number,"municipality" text,"location" text,"interescting highway" text,"notes" text)
SELECT SUM("km") FROM table_204_249
How much did the federal government spend in No Child Left Behind funding in 2017?
CREATE TABLE finrev_fed_17 (state_code number,idcensus number,school_district text,nces_id text,yr_data number,t_fed_rev number,c14 number,c25 number)CREATE TABLE finrev_fed_key_17 (state_code number,state text,#_records text)CREATE TABLE ndecoreexcel_math_grade8 (year number,state text,all_students text,average_scale_...
SELECT SUM(c14) FROM finrev_fed_17 WHERE yr_data = 17
what is the top four most frequent diagnoses among the patients in the 20s since 2101?
CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)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 d_icd_procedures (ro...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN...
Who is the owner/operator of the line from Kambalda to Esperance?
CREATE TABLE table_name_18 (owner_operator VARCHAR,from_to VARCHAR)
SELECT owner_operator FROM table_name_18 WHERE from_to = "kambalda to esperance"
How many votes in Brooklyn were won by the candidate who won 321 votes in Manhattan?
CREATE TABLE table_137 ("1921" text,"party" text,"Manhattan" text,"The Bronx" text,"Brooklyn" text,"Queens" text,"Richmond [Staten Is.]" text,"Total" real,"%" text)
SELECT "Brooklyn" FROM table_137 WHERE "Manhattan" = '321'
Give me the comparison about ID over the meter_300 .
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 stadium (ID int,name text,Capacity int,City text,Country text,Opening_year...
SELECT meter_300, ID FROM swimmer
Where is the location of the coimbatore medical college?
CREATE TABLE table_57116 ("College Name" text,"Location" text,"District" text,"Affiliation" text,"Estd" text)
SELECT "Location" FROM table_57116 WHERE "College Name" = 'coimbatore medical college'
what is the time difference in seconds between rachel king and sriyani kulawansa ?
CREATE TABLE table_204_71 (id number,"rank" number,"heat" number,"name" text,"nationality" text,"time" text,"notes" text)
SELECT ABS((SELECT "time" FROM table_204_71 WHERE "name" = 'rachel king') - (SELECT "time" FROM table_204_71 WHERE "name" = 'sriyani kulawansa'))
Tell me the Australia march 17, 2005
CREATE TABLE table_32064 ("Title" text,"Japan" text,"North America" text,"Europe" text,"Australia" text)
SELECT "Australia" FROM table_32064 WHERE "Japan" = 'march 17, 2005'
When was benjamin mako hill 's first paper written ?
CREATE TABLE paperfield (fieldid int,paperid int)CREATE TABLE paperkeyphrase (paperid int,keyphraseid int)CREATE TABLE journal (journalid int,journalname varchar)CREATE TABLE author (authorid int,authorname varchar)CREATE TABLE field (fieldid int)CREATE TABLE keyphrase (keyphraseid int,keyphrasename varchar)CREATE TABL...
SELECT DISTINCT COUNT(paper.paperid), paper.year FROM author, paper, writes WHERE author.authorname = 'benjamin mako hill' AND writes.authorid = author.authorid AND writes.paperid = paper.paperid GROUP BY paper.year ORDER BY paper.year
Name the Years that have a free + pay?
CREATE TABLE table_60012 ("Provider" text,"Years" text,"Free or pay" text,"Transmission" text,"On demand" text)
SELECT "Years" FROM table_60012 WHERE "Free or pay" = 'free + pay'
What is Outcome, when Opponent is Victoria Azarenka, and when Score is 6 2, 2 6, 7 5?
CREATE TABLE table_name_63 (outcome VARCHAR,opponent VARCHAR,score VARCHAR)
SELECT outcome FROM table_name_63 WHERE opponent = "victoria azarenka" AND score = "6–2, 2–6, 7–5"
What is the average number of losses for teams with 0 draws and 0 byes?
CREATE TABLE table_36429 ("NTFA Div 1" text,"Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real)
SELECT AVG("Losses") FROM table_36429 WHERE "Draws" = '0' AND "Byes" < '0'
How many bonus points were won by 5?
CREATE TABLE table_21778 ("Club" text,"Played" text,"Won" text,"Drawn" text,"Lost" text,"Points for" text,"Points against" text,"Points difference" text,"Bonus Points" text,"Points" text)
SELECT "Bonus Points" FROM table_21778 WHERE "Won" = '5'
Find the last name of students who is either female (sex is F) and living in the city of code BAL or male (sex is M) and in age of below 20.
CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)CREATE TABLE has_amenity (dormid number,amenid number)CREATE TABLE dorm (dormid number,dorm_name text,student_capacity number,gender text)CREATE TABLE dorm_amenity (amenid number,amenity_name text)CRE...
SELECT lname FROM student WHERE sex = 'F' AND city_code = 'BAL' UNION SELECT lname FROM student WHERE sex = 'M' AND age < 20
What year was the start 33?
CREATE TABLE table_71600 ("Year" real,"Chassis" text,"Engine" text,"Start" text,"Finish" text,"Team" text)
SELECT SUM("Year") FROM table_71600 WHERE "Start" = '33'
What is the School/Junior/Club Group (Association) that has a Round bigger than 6, and a Place of winger, and a Player of evgeny afanasiev?
CREATE TABLE table_75532 ("Round" real,"Player" text,"Position" text,"Nationality" text,"College/Junior/Club Team (League)" text)
SELECT "College/Junior/Club Team (League)" FROM table_75532 WHERE "Round" > '6' AND "Position" = 'winger' AND "Player" = 'evgeny afanasiev'
Among patients diagnosed with closed fracture of base of skull with subarachnoid, subdural, and extradural hemorrhage, and loss of consciousness of unspecified duration, calculate the number of those who belonged to hispanic or latino - puertorican ethnic origin?
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,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND diagnoses.long_title = "Closed fracture of base of skull with subarachnoid, subdural, and extradural hemorrhage, with loss of ...
Compare the total number of different job titles for all those jobs in department 80 using a bar chart, show Y from low to high order.
CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_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 locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CO...
SELECT JOB_TITLE, COUNT(JOB_TITLE) FROM employees AS T1 JOIN jobs AS T2 ON T1.JOB_ID = T2.JOB_ID WHERE T1.DEPARTMENT_ID = 80 GROUP BY JOB_TITLE ORDER BY COUNT(JOB_TITLE)
what is average age of patients whose marital status is married and age is greater than or equal to 44?
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 AVG(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.age >= "44"
serum c _ peptide level < 0.6 ng / ml
CREATE TABLE table_train_203 ("id" int,"gender" string,"perforation" bool,"hemoglobin_a1c_hba1c" float,"peptic_ulcer_disease" bool,"serum_c_peptide" float,"gastrointestinal_disease" bool,"serum_creatinine" float,"age" float,"NOUSE" float)
SELECT * FROM table_train_203 WHERE serum_c_peptide < 0.6
Which Record is on july 31?
CREATE TABLE table_name_23 (record VARCHAR,date VARCHAR)
SELECT record FROM table_name_23 WHERE date = "july 31"
provide the number of patients whose admission location is clinic referral/premature and discharge location is left against medical advi?
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 demographic (subject_id text,hadm_id text,name text,marita...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.discharge_location = "LEFT AGAINST MEDICAL ADVI"
Return a bar chart about the distribution of other_details and the sum of monthly_rental , and group by attribute other_details.
CREATE TABLE Ref_Address_Types (address_type_code VARCHAR(15),address_type_description VARCHAR(80))CREATE TABLE Students_in_Detention (student_id INTEGER,detention_id INTEGER,incident_id INTEGER)CREATE TABLE Detention (detention_id INTEGER,detention_type_code VARCHAR(10),teacher_id INTEGER,datetime_detention_start DATE...
SELECT other_details, SUM(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
is systemicmean of patient 002-13643 second measured on the first intensive care unit visit greater than the first value measured on the first intensive care unit visit?
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 (SELECT vitalperiodic.systemicmean FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-13643') AND NOT patient.unitdischargetime ...
who was the only opponent to allow no points in a game ?
CREATE TABLE table_203_672 (id number,"week" number,"date" text,"opponent" text,"result" text,"venue" text,"attendance" number)
SELECT "opponent" FROM table_203_672 WHERE "result" = 0
Show the number of customers for each gender.
CREATE TABLE Customers (gender VARCHAR)
SELECT gender, COUNT(*) FROM Customers GROUP BY gender
Name the drawn for lost being 5 and tries for 89
CREATE TABLE table_27293285_4 (drawn VARCHAR,lost VARCHAR,tries_for VARCHAR)
SELECT drawn FROM table_27293285_4 WHERE lost = "5" AND tries_for = "89"
What's the date of the circuit Winton Motor Raceway?
CREATE TABLE table_name_21 (date VARCHAR,circuit VARCHAR)
SELECT date FROM table_name_21 WHERE circuit = "winton motor raceway"
is patient 24762 given medication until 40 months ago?
CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)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 transfers (row_id number,subject...
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24762) AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-40 month')
what's the tries against with try bonus being 10
CREATE TABLE table_13940275_5 (tries_against VARCHAR,try_bonus VARCHAR)
SELECT tries_against FROM table_13940275_5 WHERE try_bonus = "10"
What was the score of the match in which Portsmouth was the Away team?
CREATE TABLE table_name_23 (score_1 VARCHAR,away_team VARCHAR)
SELECT score_1 FROM table_name_23 WHERE away_team = "portsmouth"
How many weeks total are there?
CREATE TABLE table_24989925_2 (week INTEGER)
SELECT MAX(week) FROM table_24989925_2
Which country is Chinon-A3 in?
CREATE TABLE nuclear_power_plants (id text,name text,latitude text,longitude text,country text,status text,reactortype text,reactormodel text,constructionstartat text,operationalfrom text,operationalto text,capacity text,lastupdatedat text,source text)
SELECT country FROM nuclear_power_plants WHERE name = "Chinon-A3"
Which 2012 has a 2007 of 1r, and a 2008 of 1r, and a 2013 of 2r?
CREATE TABLE table_name_75 (Id VARCHAR)
SELECT 2012 FROM table_name_75 WHERE 2007 = "1r" AND 2008 = "1r" AND 2013 = "2r"
which star has the highest distance at maximum ?
CREATE TABLE table_203_56 (id number,"star" text,"start\nyear" number,"end\nyear" number,"maximum\nyear" number,"maximum\nmagnitude" number,"distance at\nmaximum (ly)" number,"current\ndistance" number,"current\nmagnitude" number)
SELECT "star" FROM table_203_56 ORDER BY "distance at\nmaximum (ly)" DESC LIMIT 1
what is the daily minimum of arterial bp [systolic] for patient 17638 in 05/2105?
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 cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE d_icd_diagnoses (row_id ...
SELECT MIN(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 17638)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arte...
Find the number of skilled nursing facility discharged patients who had coronary artery disease/coronary artery bypass graft with mvr maze as their primary disease.
CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "SNF" AND demographic.diagnosis = "CORONARY ARTERY DISEASE\CORONARY ARTERY BYPASS GRAFT WITH MVR; ? MAZE"
What is the description of the license for GNU GPL v2 or Ruby license?
CREATE TABLE table_27709 ("Software" text,"Description" text,"Platform" text,"License" text,"Developer" text)
SELECT "Description" FROM table_27709 WHERE "License" = 'GNU GPL v2 or Ruby license'
What is the score of player bob rosburg?
CREATE TABLE table_76581 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Score" FROM table_76581 WHERE "Player" = 'bob rosburg'
Thomas de Gendt performed on what stage as aggressive rider?
CREATE TABLE table_29332810_14 (stage INTEGER,aggressive_rider VARCHAR)
SELECT MAX(stage) FROM table_29332810_14 WHERE aggressive_rider = "Thomas De Gendt"
What is the name origin of Morrigan Linea?
CREATE TABLE table_16799784_9 (name VARCHAR)
SELECT name AS origin FROM table_16799784_9 WHERE name = "Morrigan Linea"
Show the names and ids of tourist attractions that are visited at most once by a bar chart, and show Tourist_Attraction_ID in descending order please.
CREATE TABLE Visitors (Tourist_ID INTEGER,Tourist_Details VARCHAR(255))CREATE TABLE Museums (Museum_ID INTEGER,Museum_Details VARCHAR(255))CREATE TABLE Theme_Parks (Theme_Park_ID INTEGER,Theme_Park_Details VARCHAR(255))CREATE TABLE Staff (Staff_ID INTEGER,Tourist_Attraction_ID INTEGER,Name VARCHAR(40),Other_Details VAR...
SELECT T1.Name, T1.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN Visits AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID ORDER BY T1.Tourist_Attraction_ID DESC
What's Steve Langdon's naitionality?
CREATE TABLE table_23131 ("Pick #" real,"Player" text,"Position" text,"Nationality" text,"NHL team" text,"College/junior/club team" text)
SELECT "Nationality" FROM table_23131 WHERE "Player" = 'Steve Langdon'
Date of september 28 had what record?
CREATE TABLE table_name_12 (record VARCHAR,date VARCHAR)
SELECT record FROM table_name_12 WHERE date = "september 28"
What difference has a points greater than 10, and a drawn less than 2?
CREATE TABLE table_75933 ("Position" real,"Team" text,"Points" real,"Played" real,"Drawn" real,"Lost" real,"Against" real,"Difference" text)
SELECT "Difference" FROM table_75933 WHERE "Points" > '10' AND "Drawn" < '2'
What`s the score in October 7.
CREATE TABLE table_29876 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT "Score" FROM table_29876 WHERE "Date" = 'October 7'
A pie chart shows the proportion of the number of locations of the wrestlers.
CREATE TABLE Elimination (Elimination_ID text,Wrestler_ID text,Team text,Eliminated_By text,Elimination_Move text,Time text)CREATE TABLE wrestler (Wrestler_ID int,Name text,Reign text,Days_held text,Location text,Event text)
SELECT Location, COUNT(Location) FROM wrestler GROUP BY Location
What is the Team with a Machine that is nsr250 and has Points of 8?
CREATE TABLE table_name_39 (team VARCHAR,machine VARCHAR,points VARCHAR)
SELECT team FROM table_name_39 WHERE machine = "nsr250" AND points = 8
Which Player has a Score smaller than 69, and a Place of t1?
CREATE TABLE table_name_33 (player VARCHAR,score VARCHAR,place VARCHAR)
SELECT player FROM table_name_33 WHERE score < 69 AND place = "t1"
A bar chart about how many professors have a PhD in each department?, and I want to display by the Y from low to high.
CREATE TABLE DEPARTMENT (DEPT_CODE varchar(10),DEPT_NAME varchar(30),SCHOOL_CODE varchar(8),EMP_NUM int,DEPT_ADDRESS varchar(20),DEPT_EXTENSION varchar(4))CREATE TABLE EMPLOYEE (EMP_NUM int,EMP_LNAME varchar(15),EMP_FNAME varchar(12),EMP_INITIAL varchar(1),EMP_JOBCODE varchar(5),EMP_HIREDATE datetime,EMP_DOB datetime)C...
SELECT DEPT_CODE, COUNT(*) FROM PROFESSOR WHERE PROF_HIGH_DEGREE = 'Ph.D.' GROUP BY DEPT_CODE ORDER BY COUNT(*)
What is To Par, when Player is Greg Norman?
CREATE TABLE table_44628 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text,"Money ($)" text)
SELECT "To par" FROM table_44628 WHERE "Player" = 'greg norman'
Which capacity has a purple and white colors?
CREATE TABLE table_name_77 (capacity VARCHAR,colors VARCHAR)
SELECT capacity FROM table_name_77 WHERE colors = "purple and white"
count the amount of intensive care unit visits of patient 035-15069 in 2104.
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime ti...
SELECT COUNT(DISTINCT patient.patientunitstayid) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-15069') AND STRFTIME('%y', patient.unitadmittime) = '2104'
what is the drug code of the patient id 6983?
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 diagnoses (subject_id text,hadm_id text,icd9_code text,sho...
SELECT prescriptions.formulary_drug_cd FROM prescriptions WHERE prescriptions.subject_id = "6983"
how many milion of viewers where in the episode called in english 'is a great way to care
CREATE TABLE table_31277 ("Rank" real,"English title" text,"Chinese title" text,"Average" real,"Peak" real,"Premiere" real,"Finale" real,"HK viewers" text)
SELECT "HK viewers" FROM table_31277 WHERE "English title" = 'A Great Way to Care'
give the number of patients whose insurance is private and procedure icd9 code is 4105.
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.icd9_code = "4105"
in what two seasons were there no goals scored ?
CREATE TABLE table_203_789 (id number,"season" text,"team" text,"country" text,"division" number,"apps" number,"goals" number,"assists" number)
SELECT "season" FROM table_203_789 WHERE "goals" = 0
has patient 013-20464's heartrate been less than 46.0 degrees since 07/07/2105?
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 COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-20464')) AND vitalperiodic.heartrate < 46.0 AND NOT vitalperiodi...
what was the minimum monthly number of patients who were diagnosed with ards - non-pulmonary etiology until 2104?
CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,dischargeweight number,hospitaladmittime time,hospitaladmitsource text,unitadmittime time,unitdischargetime tim...
SELECT MIN(t1.c1) FROM (SELECT COUNT(DISTINCT diagnosis.patientunitstayid) AS c1 FROM diagnosis WHERE diagnosis.diagnosisname = 'ards - non-pulmonary etiology' AND STRFTIME('%y', diagnosis.diagnosistime) <= '2104' GROUP BY STRFTIME('%y-%m', diagnosis.diagnosistime)) AS t1
Name the 2008 for wta premier mandatory tournaments of 2007
CREATE TABLE table_name_77 (Id VARCHAR)
SELECT 2008 FROM table_name_77 WHERE 2007 = "wta premier mandatory tournaments"
Django VS Rails - Total Posts by MONTH and YEAR.
CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score number,ApprovedByUserId number,ApprovalDate time)CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Cl...
SELECT Tags.TagName, YEAR(Posts.CreationDate) AS "yeardate", MONTH(Posts.CreationDate) AS "monthdate", COUNT(Posts.Id) AS "totalposts" FROM Tags JOIN PostTags ON PostTags.TagId = Tags.Id JOIN Posts ON PostTags.PostId = Posts.Id WHERE Tags.TagName = 'django' OR Tags.TagName = 'ruby-on-rails' GROUP BY Tags.TagName, YEAR(...
Who wrote Episode 2-15 (56)?
CREATE TABLE table_37476 ("Episode" text,"Title" text,"Writer(s)" text,"Preservation" text,"Original airdate" text)
SELECT "Writer(s)" FROM table_37476 WHERE "Episode" = '2-15 (56)'
What is Rating, when Air Date is 'July 24, 2008*', and when Weekly Winner is 'Sales Rep. Oscar Ledezma'?
CREATE TABLE table_61837 ("Air Date" text,"Rating" text,"18-49" text,"Viewers" text,"Weekly Winner" text)
SELECT "Rating" FROM table_61837 WHERE "Air Date" = 'july 24, 2008*' AND "Weekly Winner" = 'sales rep. oscar ledezma'
Number of questions asked per week given a starting creation date.
CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,Las...
SELECT COUNT(UniqueId) AS NrOfQuestions, WeekStart FROM (SELECT Posts.Id AS UniqueId, DATEADD(week, DATEDIFF(day, '20000109', CreationDate) / 7, '20000109') AS WeekStart FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.Id = PostTags.PostId WHERE Posts.CreationDate >= @CreationDate AND...
count the number of patients whose admission type is elective?
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 WHERE demographic.admission_type = "ELECTIVE"
Find the number of students for each department Plot them as bar chart, and order y axis in descending order.
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 varchar(5),STU_NUM int,ENROLL_GRADE varchar(50))CREATE TABLE EMPLOYEE (EMP_NUM int,EMP_LNAME varchar(15),EMP_FNAME varchar(12),EMP_INITIAL varchar(1),EM...
SELECT DEPT_CODE, COUNT(*) FROM STUDENT GROUP BY DEPT_CODE ORDER BY COUNT(*) DESC
what was the daily maximum value of weight for patient 016-25367 on their last hospital encounter?
CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmen...
SELECT MAX(patient.admissionweight) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-25367' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1) AND NOT patient.admissionweight IS NULL ...
Name the least rank with bronze of 2, gold more than 0 and nation of ynys m n/anglesey with total more than 8
CREATE TABLE table_34237 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MIN("Rank") FROM table_34237 WHERE "Bronze" = '2' AND "Gold" > '0' AND "Nation" = 'ynys môn/anglesey' AND "Total" > '8'
What is the sum of the home wins of the Boston College Eagles, which has more than 6 wins?
CREATE TABLE table_47129 ("Institution" text,"Wins" real,"Loss" real,"Home Wins" real,"Home Losses" real,"Away Wins" real,"Away Losses" real,"Neutral Wins" real,"Neutral Losses" real)
SELECT SUM("Home Wins") FROM table_47129 WHERE "Institution" = 'boston college eagles' AND "Wins" > '6'