instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
Show all allergy type with number of students affected by a pie chart.
CREATE TABLE Allergy_Type (Allergy VARCHAR(20),AllergyType 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))CREATE TABLE Has_Allergy (StuID INTEGER,Allergy VARCHAR(20))
SELECT AllergyType, COUNT(*) FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy GROUP BY T2.AllergyType
List papers that has a keyword Depth Map
CREATE TABLE author (authorid int,authorname varchar)CREATE TABLE paperfield (fieldid int,paperid int)CREATE TABLE paper (paperid int,title varchar,venueid int,year int,numciting int,numcitedby int,journalid int)CREATE TABLE field (fieldid int)CREATE TABLE journal (journalid int,journalname varchar)CREATE TABLE keyphra...
SELECT DISTINCT paper.paperid FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'Depth Map' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid
How many incumbents for the district of South Carolina 5?
CREATE TABLE table_19245 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT COUNT("Incumbent") FROM table_19245 WHERE "District" = 'South Carolina 5'
What is the surface when the us open is the championship in the year 1979?
CREATE TABLE table_22860698_2 (surface VARCHAR,championship VARCHAR,year VARCHAR)
SELECT surface FROM table_22860698_2 WHERE championship = "US Open" AND year = 1979
Which song has a place greater than 7, more than 13 points, and draw of 5?
CREATE TABLE table_13980 ("Draw" real,"Artist" text,"Song" text,"Points" real,"Place" real)
SELECT "Song" FROM table_13980 WHERE "Place" > '7' AND "Points" > '13' AND "Draw" = '5'
what is the date when the opponent is leeds united?
CREATE TABLE table_name_80 (date VARCHAR,opponent VARCHAR)
SELECT date FROM table_name_80 WHERE opponent = "leeds united"
what are the three most frequently prescribed drugs for patients who have previously been diagnosed with drug withdrawal syndrome - alcohol during the same month, this year?
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissio...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'drug withdrawal syndrome - alcohol' AND DATETIME(d...
How many players were in the team Boston Red Stockings in 2000?
CREATE TABLE team (team_id_br VARCHAR,name VARCHAR)CREATE TABLE salary (team_id VARCHAR,year VARCHAR)
SELECT COUNT(*) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2000
count the number of people who were prescribed lr within 2 months following a diagnosis of personal history of fall since 4 years ago.
CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last...
SELECT COUNT(DISTINCT t1.subject_id) 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 d_icd_diagnoses.short_title = 'personal history o...
What is the ad frequency for the Show Off The Bench?
CREATE TABLE table_name_28 (ad_freq VARCHAR,show_name VARCHAR)
SELECT ad_freq FROM table_name_28 WHERE show_name = "off the bench"
What is the average attendance when the Forest Green Rovers is the away team?
CREATE TABLE table_54967 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Attendance" real)
SELECT AVG("Attendance") FROM table_54967 WHERE "Away team" = 'forest green rovers'
What series number had an original airdate of March 1, 1991?
CREATE TABLE table_2409041_3 (no_in_series INTEGER,original_air_date VARCHAR)
SELECT MIN(no_in_series) FROM table_2409041_3 WHERE original_air_date = "March 1, 1991"
Return a line chart on what is the average number of attendance at home games for each year?
CREATE TABLE pitching_postseason (player_id TEXT,year INTEGER,round TEXT,team_id TEXT,league_id TEXT,w INTEGER,l INTEGER,g INTEGER,gs INTEGER,cg INTEGER,sho INTEGER,sv INTEGER,ipouts INTEGER,h INTEGER,er INTEGER,hr INTEGER,bb INTEGER,so INTEGER,baopp TEXT,era NUMERIC,ibb NUMERIC,wp NUMERIC,hbp NUMERIC,bk NUMERIC,bfp NU...
SELECT year, AVG(attendance) FROM home_game GROUP BY year
What was the result of week 1 and the opponent was bye?
CREATE TABLE table_32450 ("Week" text,"Date" text,"Opponent" text,"Result" text,"Kickoff" text,"Game site" text,"Record" text,"Attendance" text)
SELECT "Result" FROM table_32450 WHERE "Week" = '1' AND "Opponent" = 'bye'
Question which had the tag but no longer have it (including the editor).
CREATE TABLE VoteTypes (Id number,Name text)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 FlagTypes ...
WITH firstrev_cte AS (SELECT MIN(ph.Id) AS MinId, p.Id FROM Posts AS p JOIN PostHistory AS ph ON ph.PostId = p.Id WHERE ph.Text LIKE '%<##tagName##>%' AND NOT (p.Tags LIKE '%<##tagName##>%') GROUP BY p.Id) SELECT PostId AS "post_link", url = 'site://posts/' + CAST(PostId AS TEXT) + '/revisions', UserId AS "user_link", ...
When daniel lincoln ( usa ) is the saif saaeed shaheen ( qat ) What is the date for September 3rd, 2004?
CREATE TABLE table_23988726_2 (saif_saaeed_shaheen___qat__ VARCHAR)
SELECT 3 AS _september_2004 FROM table_23988726_2 WHERE saif_saaeed_shaheen___qat__ = "Daniel Lincoln ( USA )"
what's the cost of a loc exc les metatar/tar.
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 microbiologyevents (row_id number,subject_id number,hadm_id nu...
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'procedures_icd' AND cost.event_id IN (SELECT procedures_icd.row_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'loc exc les metatar/tar'))
what is the language/dialect when basikal is sepeda and boleh is bulih?
CREATE TABLE table_name_63 (language_dialect VARCHAR,basikal VARCHAR,boleh VARCHAR)
SELECT language_dialect FROM table_name_63 WHERE basikal = "sepeda" AND boleh = "bulih"
Return a bar chart about the distribution of Sex and the average of Height , and group by attribute Sex, list in descending by the x axis.
CREATE TABLE candidate (Candidate_ID int,People_ID int,Poll_Source text,Date text,Support_rate real,Consider_rate real,Oppose_rate real,Unsure_rate real)CREATE TABLE people (People_ID int,Sex text,Name text,Date_of_Birth text,Height real,Weight real)
SELECT Sex, AVG(Height) FROM people GROUP BY Sex ORDER BY Sex DESC
What is the Date of Game 5 with Road Team St. Louis?
CREATE TABLE table_46898 ("Game" text,"Date" text,"Home Team" text,"Result" text,"Road Team" text)
SELECT "Date" FROM table_46898 WHERE "Road Team" = 'st. louis' AND "Game" = 'game 5'
Up vs Down votes by day for last week of Question or Answer.
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 PostHistory (Id number,PostHistoryTypeId number,PostId number,R...
SELECT CASE WHEN PostTypeId = 1 THEN 'Question' ELSE 'Answer' END AS "post_type", TIME_TO_STR(p.CreationDate, '%H'), COUNT(*) AS Amount, SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END) AS UpVotes, SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) AS DownVotes, CASE WHEN SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) = 0...
Give the number of patients diagnosed with pressure ulcer buttock whose drug route is id.
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title 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 text,flag text,value_unit text,label text,fluid ...
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.short_title = "Pressure ulcer, buttock" AND prescriptions.route = "ID"
What is the name of the stadium for the city of melfi?
CREATE TABLE table_name_7 (stadium VARCHAR,city VARCHAR)
SELECT stadium FROM table_name_7 WHERE city = "melfi"
What is the least rank for the premier that assumed office on 17 may 1919 and was in office for 7 years, 335 days?
CREATE TABLE table_66471 ("Rank:" real,"State:" text,"Premier:" text,"Party:" text,"Assumed office:" text,"Left office:" text,"TOTAL Time in office:" text)
SELECT MIN("Rank:") FROM table_66471 WHERE "TOTAL Time in office:" = '7 years, 335 days' AND "Assumed office:" = '17 may 1919'
How many laps did innes ireland drive with a grid higher than 11?
CREATE TABLE table_name_29 (laps INTEGER,driver VARCHAR,grid VARCHAR)
SELECT SUM(laps) FROM table_name_29 WHERE driver = "innes ireland" AND grid > 11
what's the average hospital cost if there is postop vaginal prolapse since 1 year ago?
CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,ro...
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'postop vaginal prolapse')) AND DATETIME(cost.chargetime) >= DAT...
What is the method of the match where there was a loss to Carlos Newton in round 1?
CREATE TABLE table_name_61 (method VARCHAR,opponent VARCHAR,round VARCHAR,res VARCHAR)
SELECT method FROM table_name_61 WHERE round = "1" AND res = "loss" AND opponent = "carlos newton"
Create a bar chart showing capacity across name, and I want to show x axis in ascending order please.
CREATE TABLE schedule (Cinema_ID int,Film_ID int,Date text,Show_times_per_day int,Price float)CREATE TABLE cinema (Cinema_ID int,Name text,Openning_year int,Capacity int,Location text)CREATE TABLE film (Film_ID int,Rank_in_series int,Number_in_season int,Title text,Directed_by text,Original_air_date text,Production_cod...
SELECT Name, Capacity FROM cinema ORDER BY Name
What was the score for the game when West Ham United was the away team?
CREATE TABLE table_name_84 (score VARCHAR,away_team VARCHAR)
SELECT score FROM table_name_84 WHERE away_team = "west ham united"
how many patients were prescribed warfarin sodium 5 mg po tabs?
CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE medication (medicat...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'warfarin sodium 5 mg po tabs')
what is the highest total when the nation is france and silver is more than 1?
CREATE TABLE table_name_71 (total INTEGER,nation VARCHAR,silver VARCHAR)
SELECT MAX(total) FROM table_name_71 WHERE nation = "france" AND silver > 1
What surface was the Australian Open (1) played on?
CREATE TABLE table_name_84 (surface VARCHAR,championship VARCHAR)
SELECT surface FROM table_name_84 WHERE championship = "australian open (1)"
What is the largest crowd when the away team is Hawthorn?
CREATE TABLE table_74745 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT MAX("Crowd") FROM table_74745 WHERE "Away team" = 'hawthorn'
Name the region 1 for episode number 13
CREATE TABLE table_171320_3 (region_1 VARCHAR,ep__number VARCHAR)
SELECT region_1 FROM table_171320_3 WHERE ep__number = 13
what are the five most common procedures given for patients who had previously been diagnosed with gi obstruction / ileus - small bowel obstruction during the same hospital encounter during this year?
CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,dischargeweight number,hospitaladmittime time,hospitaladmitsource text,unitadmittime time,unitdischargetime tim...
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'gi ob...
What is the number of poles with 104 points?
CREATE TABLE table_name_51 (poles VARCHAR,points VARCHAR)
SELECT poles FROM table_name_51 WHERE points = "104"
Name the average silver with total less than 1
CREATE TABLE table_name_5 (silver INTEGER,total INTEGER)
SELECT AVG(silver) FROM table_name_5 WHERE total < 1
what is the monthly average dose of p.o. that patient 008-30575 has taken since 12/08/2100?
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 AVG(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '008-30575')) AND intakeoutput.celllabel = 'p.o.'...
what is the number of unmarried patients who had po2 lab test?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "SINGLE" AND lab.label = "pO2"
Find the number of the parties associated with the delegates from district 1 or 2. Who served as comptrollers of the parties?
CREATE TABLE party (Party_ID int,Year real,Party text,Governor text,Lieutenant_Governor text,Comptroller text,Attorney_General text,US_Senate text)CREATE TABLE county (County_Id int,County_name text,Population real,Zip_code text)CREATE TABLE election (Election_ID int,Counties_Represented text,District int,Delegate text...
SELECT Comptroller, COUNT(Comptroller) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2 GROUP BY Comptroller
Voters in moderator elections per year.
CREATE TABLE Users (Id number,Reputation number,CreationDate time,DisplayName text,LastAccessDate time,WebsiteUrl text,Location text,AboutMe text,Views number,UpVotes number,DownVotes number,ProfileImageUrl text,EmailHash text,AccountId number)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPos...
SELECT YEAR(b.Date) AS Election, COUNT(*) AS "number_of_voters" FROM Badges AS b WHERE b.Name = 'Constituent' GROUP BY YEAR(b.Date) ORDER BY YEAR(b.Date)
When was the last win for the club that had a final loss in 2011?
CREATE TABLE table_name_34 (last_win VARCHAR,last_final_lost VARCHAR)
SELECT last_win FROM table_name_34 WHERE last_final_lost = "2011"
Name the outcome for opponents of jonas bj rkman john mcenroe
CREATE TABLE table_name_60 (outcome VARCHAR,opponents_in_the_final VARCHAR)
SELECT outcome FROM table_name_60 WHERE opponents_in_the_final = "jonas björkman john mcenroe"
Which upper level classes do not have 792 as a prerequisite ?
CREATE TABLE jobs (job_id int,job_title varchar,description varchar,requirement varchar,city varchar,state varchar,country varchar,zip int)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE program_course (program_id int,cour...
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite, program_course WHERE NOT COURSE_1.course_id IN (SELECT course_prerequisite.pre_course_id FROM course AS COURSE_0, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.cours...
What is the sum of Money of the game that was played in the United States with Sam Snead as a player?
CREATE TABLE table_name_55 (money___ INTEGER,country VARCHAR,player VARCHAR)
SELECT SUM(money___) AS $__ FROM table_name_55 WHERE country = "united states" AND player = "sam snead"
When the trailing votes was 25.88% who was the trailing party?
CREATE TABLE table_1810 ("Year" real,"Lok Sabha" text,"Members of Parliament" text,"Party Won" text,"Winners % votes" text,"Trailing Party" text,"Trailing Party % votes" text)
SELECT "Members of Parliament" FROM table_1810 WHERE "Trailing Party % votes" = '25.88%'
Which event had a prize of $2,434,061?
CREATE TABLE table_name_61 (name VARCHAR,prize VARCHAR)
SELECT name FROM table_name_61 WHERE prize = "$2,434,061"
Questions needing attention to avoid Roomba carnage - only me.
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 ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE PostHistoryTypes (Id number,Nam...
SELECT Posts.Title, Posts.CreationDate, Posts.OwnerUserId, Users.DisplayName, ViewCount, Posts.Id AS "post_link", Tags FROM Posts, Users WHERE Users.Id = Posts.OwnerUserId AND Posts.PostTypeId = 1 AND Users.DisplayName = 'Franck Dernoncourt' ORDER BY Posts.CreationDate
What is the schedule of 564 next semester ?
CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE course_offering (offering_id int,course_id int,semester int,section_number int,start_time time,end_time time...
SELECT DISTINCT course_offering.end_time, course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.start_time, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM course, course_offering, semester WHERE course.course_id = course_offe...
Who is the driver of the chassis-engine porsche 956 gti?
CREATE TABLE table_name_14 (driver VARCHAR,chassis___engine VARCHAR)
SELECT driver FROM table_name_14 WHERE chassis___engine = "porsche 956 gti"
what is minimum age of patients whose insurance is government and days of hospital stay is 2?
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 diagnoses (subject_id text,hadm_id text,icd9_code text,sho...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.insurance = "Government" AND demographic.days_stay = "2"
Which species of bacteria has 5,566 genes?
CREATE TABLE table_name_35 (strain VARCHAR,genes VARCHAR)
SELECT strain FROM table_name_35 WHERE genes = "5,566"
whats the percentage of difference between the frog and zebra fish ?
CREATE TABLE table_204_358 (id number,"species" text,"common name" text,"ncbi accession #" text,"ncbi name" text,"length" text,"sequence identity" text,"sequence similarity" text,"years since divergence from human (mya)" number)
SELECT (SELECT "sequence identity" FROM table_204_358 WHERE "common name" = 'frog') - (SELECT "sequence identity" FROM table_204_358 WHERE "common name" = 'zebra fish')
What is the prerequisite for THTREMUS 342 ?
CREATE TABLE area (course_id int,area varchar)CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE gsi (course_offering_id in...
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...
nation that earned the most total medals after spain
CREATE TABLE table_204_107 (id number,"rank" number,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number)
SELECT "nation" FROM table_204_107 WHERE "total" < (SELECT "total" FROM table_204_107 WHERE "nation" = 'spain') ORDER BY "total" DESC LIMIT 1
provide the number of catholic religious background patients for whom absolute cd3 count lab test was ordered.
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "CATHOLIC" AND lab.label = "Absolute CD3 Count"
Who played in group 12 when Group 9 played psid jombang?
CREATE TABLE table_73122 ("Group 7" text,"Group 8" text,"Group 9" text,"Group 10" text,"Group 11" text,"Group 12" text)
SELECT "Group 12" FROM table_73122 WHERE "Group 9" = 'PSID Jombang'
Name the author for peri and april 2010
CREATE TABLE table_20617 ("#" real,"Series Sorted" text,"Title" text,"Author" text,"Doctor" text,"Featuring" text,"Released" text)
SELECT "Author" FROM table_20617 WHERE "Featuring" = 'Peri' AND "Released" = 'April 2010'
Give me the trend about monthly_rental over date_address_from .
CREATE TABLE Ref_Address_Types (address_type_code VARCHAR(15),address_type_description VARCHAR(80))CREATE TABLE Ref_Detention_Type (detention_type_code VARCHAR(10),detention_type_description VARCHAR(80))CREATE TABLE Students (student_id INTEGER,address_id INTEGER,first_name VARCHAR(80),middle_name VARCHAR(40),last_name...
SELECT date_address_from, monthly_rental FROM Student_Addresses ORDER BY monthly_rental DESC
after never say goodbye , what was the title of the next movie she was in chronologically ?
CREATE TABLE table_203_239 (id number,"year" number,"title" text,"chinese title" text,"role" text,"notes" text)
SELECT "title" FROM table_203_239 WHERE id = (SELECT id FROM table_203_239 WHERE "title" = 'never say goodbye') + 1
What was the resting potential with an AP duration of 1.0 and a median giant fiber cell type?
CREATE TABLE table_name_69 (resting_potential__mv_ VARCHAR,ap_duration__ms_ VARCHAR,cell_type VARCHAR)
SELECT resting_potential__mv_ FROM table_name_69 WHERE ap_duration__ms_ = "1.0" AND cell_type = "median giant fiber"
At what percent was Pat Robertson when George H.W. Bush had 76%?
CREATE TABLE table_36254 ("Date" text,"State" text,"George H.W. Bush" text,"Bob Dole" text,"Pat Robertson" text,"Jack Kemp" text,"Pete du Pont" text)
SELECT "Pat Robertson" FROM table_36254 WHERE "George H.W. Bush" = '76%'
Who is the father that was born on January 2, 1842?
CREATE TABLE table_name_30 (father VARCHAR,date_of_birth VARCHAR)
SELECT father FROM table_name_30 WHERE date_of_birth = "january 2, 1842"
What was the report for the game with the home team of the Townsville Crocodiles?
CREATE TABLE table_44266 ("Date" text,"Home team" text,"Score" text,"Away team" text,"Venue" text,"Box Score" text,"Report" text)
SELECT "Report" FROM table_44266 WHERE "Home team" = 'townsville crocodiles'
how many hours have passed since the last time that patient 14467 has had an d5w intake on the current intensive care unit visit?
CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE o...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', inputevents_cv.charttime)) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14467) AND icustays.outtime IS NULL)...
Tell me the result for warsaw 1929
CREATE TABLE table_name_8 (result VARCHAR,location VARCHAR,year VARCHAR)
SELECT result FROM table_name_8 WHERE location = "warsaw" AND year = 1929
A bar chart shows the distribution of meter_500 and ID .
CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year int)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 swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 te...
SELECT meter_500, ID FROM swimmer
when was the first time patient 32163 had a microbiology test, since 79 months ago?
CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE p...
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 32163) AND DATETIME(microbiologyevents.charttime) >= DATETIME(CURRENT_TIME(), '-79 month') ORDER BY microbiologyevents.charttime LIMIT 1
provide the number of patients whose admission year is less than 2175 and diagnoses long title is diverticulosis of colon with hemorrhage?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2175" AND diagnoses.long_title = "Diverticulosis of colon with hemorrhage"
What is the total number of earnings for golfers who have 28 events and more than 2 wins?
CREATE TABLE table_name_94 (earnings___ VARCHAR,events VARCHAR,wins VARCHAR)
SELECT COUNT(earnings___) AS $__ FROM table_name_94 WHERE events = 28 AND wins > 2
For all employees who have the letters D or S in their first name, find job_id and the average of manager_id , and group by attribute job_id, and visualize them by a bar chart, I want to list in desc by the y axis.
CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,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)...
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(MANAGER_ID) DESC
which patients have order for nonsquamous epithelial cell lab test?
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "NonSquamous Epithelial Cell"
What year was the first election in the district whose election now was won by Ron Kind?
CREATE TABLE table_18135 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Results" text,"Candidates" text)
SELECT MIN("First elected") FROM table_18135 WHERE "Incumbent" = 'Ron Kind'
Name the lowest rank for red chillies entertainment for 2013
CREATE TABLE table_name_99 (rank INTEGER,year VARCHAR,studio_s_ VARCHAR)
SELECT MIN(rank) FROM table_name_99 WHERE year = 2013 AND studio_s_ = "red chillies entertainment"
Compare the total salary by each hire date (bin it into the day of week interval) of employees using a bar chart.
CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2),COMMISSION_PCT decimal(2,2),MANAGER_ID decimal(6,0),DEPARTMENT_ID decimal(4,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),S...
SELECT HIRE_DATE, SUM(SALARY) FROM employees
What are the dates in which the mean sea level pressure was between 30.3 and 31?
CREATE TABLE weather (date VARCHAR,mean_sea_level_pressure_inches INTEGER)
SELECT date FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31
What is the nickname of Columbia University?
CREATE TABLE table_name_62 (nickname VARCHAR,institution VARCHAR)
SELECT nickname FROM table_name_62 WHERE institution = "columbia university"
Which League Cup has a Scottish Cup larger than 69?
CREATE TABLE table_name_42 (league INTEGER,scottish_cup INTEGER)
SELECT SUM(league) AS Cup FROM table_name_42 WHERE scottish_cup > 69
Find identical titles (no closed questions) by the same user. We also show the creation date of the posts.
CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous bool...
SELECT a.Id AS "post_link", a.CreationDate AS "First Date", b.Id AS "post_link", b.CreationDate AS "Second Date" FROM Posts AS a JOIN Posts AS b ON a.Title = b.Title WHERE a.Id < b.Id AND a.ClosedDate IS NULL AND b.ClosedDate IS NULL AND a.OwnerUserId = b.OwnerUserId
What is the sum of the live viewers for episodes with share over 5?
CREATE TABLE table_36231 ("Air Date" text,"Rating" real,"Share" real,"18-49" text,"Viewers [Live] (m)" real,"Viewers [DVR+7] (m)" text)
SELECT SUM("Viewers [Live] (m)") FROM table_36231 WHERE "Share" > '5'
does patient 31325 have a arterial bp [systolic] greater than 107.0, in 06/last year?
CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)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 number,icd9_code tex...
SELECT COUNT(*) > 0 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 = 31325)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [syst...
in 04/2104 did patient 65309 excret any urine out foley?
CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,route text)CREATE TABLE icustays (row_id number,subject_id number,hadm_id number...
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 = 65309)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urine out fole...
provide me the number of patients who were on prescription drug glucagon and admitted before the year 2137.
CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2137" AND prescriptions.drug = "Glucagon"
what is the patient name and icu stay id of the patient id 76446?
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 diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT demographic.name, prescriptions.icustay_id FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "76446"
what is admission location and admission time of subject id 9271?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay ...
SELECT demographic.admission_location, demographic.admittime FROM demographic WHERE demographic.subject_id = "9271"
SO - Total Posts per Month.
CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,Suggeste...
SELECT CONCAT(YEAR(P.CreationDate), '-', MONTH(P.CreationDate)) AS YearMonth, COUNT(*) AS PostCount FROM Posts AS P GROUP BY YEAR(P.CreationDate), MONTH(P.CreationDate) ORDER BY YEAR(P.CreationDate) DESC, MONTH(P.CreationDate) DESC
What place has jack renner as the player?
CREATE TABLE table_name_48 (place VARCHAR,player VARCHAR)
SELECT place FROM table_name_48 WHERE player = "jack renner"
Name the opponent with a record of 60-61
CREATE TABLE table_71567 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Record" text)
SELECT "Opponent" FROM table_71567 WHERE "Record" = '60-61'
What is the total number of Solo with a Player with sean mcinerney, and Yards larger than 0?
CREATE TABLE table_56449 ("Player" text,"Tackles" real,"Solo" real,"Assisted" real,"Sack" real,"Yards" real,"TD's" real)
SELECT COUNT("Solo") FROM table_56449 WHERE "Player" = 'sean mcinerney' AND "Yards" > '0'
What were the notes for the time 45.74?
CREATE TABLE table_name_89 (notes VARCHAR,time VARCHAR)
SELECT notes FROM table_name_89 WHERE time = "45.74"
Who was the visiting team when the Suns were the home team?
CREATE TABLE table_name_39 (visitor VARCHAR,home VARCHAR)
SELECT visitor FROM table_name_39 WHERE home = "suns"
What manufacturer made 6 and preserved 1?
CREATE TABLE table_name_82 (manufacturer VARCHAR,quantity_made VARCHAR,quantity_preserved VARCHAR)
SELECT manufacturer FROM table_name_82 WHERE quantity_made = "6" AND quantity_preserved = "1"
at the 2006 gran premio telmex , how many drivers completed less than 60 laps ?
CREATE TABLE table_204_496 (id number,"pos" number,"no" number,"driver" text,"team" text,"laps" number,"time/retired" text,"grid" number,"points" number)
SELECT COUNT("driver") FROM table_204_496 WHERE "laps" < 60
For those employees who was hired before 2002-06-21, draw a bar chart about the distribution of job_id and the average of salary , and group by attribute job_id, rank in ascending by the Y.
CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2),COMMISSION_PCT decimal(2,2),MANAGER_ID decimal(6,0),DEPARTMENT_ID decimal(4,0))CREATE TABLE departments (DEPARTMENT_ID decimal(4,...
SELECT JOB_ID, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(SALARY)
What was the tries against when the drawn was 2?
CREATE TABLE table_12792876_3 (tries_against VARCHAR,drawn VARCHAR)
SELECT tries_against FROM table_12792876_3 WHERE drawn = "2"
when did patient 2127 until 2102 for the first time be admitted to the hospital?
CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid numbe...
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 2127 AND STRFTIME('%y', admissions.admittime) <= '2102' ORDER BY admissions.admittime LIMIT 1
Last 3 months unanswered questions.
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Sug...
SELECT * FROM Posts INNER JOIN Users ON Users.Id = OwnerUserId WHERE Posts.PostTypeId = 1 AND Posts.CreationDate BETWEEN DATEADD(MONTH, -3, CURRENT_TIMESTAMP()) AND CURRENT_TIMESTAMP() AND AcceptedAnswerId IS NULL AND AnswerCount = 0 AND Score > -1 AND CommentCount = 0 AND Users.Reputation > 100
Which player was drafted by the Saskatchewan Roughriders?
CREATE TABLE table_name_5 (player VARCHAR,cfl_team VARCHAR)
SELECT player FROM table_name_5 WHERE cfl_team = "saskatchewan roughriders"
Name the total number of start when finish is less than 4
CREATE TABLE table_name_21 (start VARCHAR,finish INTEGER)
SELECT COUNT(start) FROM table_name_21 WHERE finish < 4
that was held in 1964?
CREATE TABLE table_36953 ("Year" real,"Competition" text,"Venue" text,"Position" text,"Event" text)
SELECT "Event" FROM table_36953 WHERE "Year" = '1964'