instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
How many points is there when the lost is 6 and the try bonus is 9?
CREATE TABLE table_name_24 (points_for VARCHAR,lost VARCHAR,try_bonus VARCHAR)
SELECT points_for FROM table_name_24 WHERE lost = "6" AND try_bonus = "9"
For those records from the products and each product's manufacturer, return a bar chart about the distribution of founder and the amount of founder , and group by attribute founder.
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 Founder, COUNT(Founder) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder
what is the average hospital cost for a procedure that involves intraaortic balloon pump removal this year?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE medication (medicationid number,patient...
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'intraaortic balloon pump removal')) AND DATE...
What is the least number of silver medals won
CREATE TABLE table_2606 ("Rank" real,"Athlete" text,"Nation" text,"Olympics" text,"Gold" real,"Silver" real,"Bronze" real,"Total(min. 2 medals)" real)
SELECT MIN("Silver") FROM table_2606
Show all the activity names and the number of faculty involved in each activity in a bar chart, and I want to list bars in ascending order.
CREATE TABLE Faculty (FacID INTEGER,Lname VARCHAR(15),Fname VARCHAR(15),Rank VARCHAR(15),Sex VARCHAR(1),Phone INTEGER,Room VARCHAR(5),Building VARCHAR(13))CREATE TABLE Participates_in (stuid INTEGER,actid INTEGER)CREATE TABLE Faculty_Participates_in (FacID INTEGER,actid INTEGER)CREATE TABLE Activity (actid INTEGER,acti...
SELECT activity_name, COUNT(*) FROM Activity AS T1 JOIN Faculty_Participates_in AS T2 ON T1.actid = T2.actid GROUP BY T1.actid ORDER BY activity_name
What was the loss from the coyotes as opponents?
CREATE TABLE table_57474 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Record" text,"Arena" text,"Points" real)
SELECT "Loss" FROM table_57474 WHERE "Opponent" = 'coyotes'
Users who posted only single questions.
CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLicense text)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationI...
SELECT Users.Id AS "user_link" FROM Posts INNER JOIN Users ON Users.Id = OwnerUserId WHERE PostTypeId = 1 GROUP BY Users.Id HAVING COUNT(Posts.Id) = 1 LIMIT 5000
What is the lowest crowd size at MCG?
CREATE TABLE table_33771 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT MIN("Crowd") FROM table_33771 WHERE "Venue" = 'mcg'
What title was used in the nomination of Matrimonio All'Italiana?
CREATE TABLE table_name_5 (film_title_used_in_nomination VARCHAR,original_title VARCHAR)
SELECT film_title_used_in_nomination FROM table_name_5 WHERE original_title = "matrimonio all'italiana"
Which artist/group is most productive?
CREATE TABLE torrents (groupname text,totalsnatched number,artist text,groupyear number,releasetype text,groupid number,id number)CREATE TABLE tags (index number,id number,tag text)
SELECT artist FROM torrents GROUP BY artist ORDER BY COUNT(groupname) DESC LIMIT 1
did patient 95986 undergo surgery during this year?
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 d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id nu...
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 95986) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
Who is the manufacturer for the date of June 22?
CREATE TABLE table_24853 ("Year" text,"Date" text,"Driver" text,"Team" text,"Manufacturer" text,"Laps" text,"Miles (km)" text,"Race Time" text,"Average Speed (mph)" text,"Report" text)
SELECT "Manufacturer" FROM table_24853 WHERE "Date" = 'June 22'
please show me all one way FIRST class flights from INDIANAPOLIS to MEMPHIS
CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE code_description (code varchar,description text)CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time int,connections int,depa...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, fare_basis, flight, flight_fare WHERE ((fare_basis.class_type = 'FIRST' AND fare.fare_basis_code = fare_basis.fare_basis_code) AND CITY_1.city_code = AIRPORT_SERVICE_1....
For all employees who have the letters D or S in their first name, a line chart shows the trend of salary over hire_date , and I want to order HIRE_DATE from low to high order please.
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 regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER...
SELECT HIRE_DATE, SALARY FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE
For all employees who have the letters D or S in their first name, show me about the distribution of job_id and the sum of manager_id , and group by attribute job_id in a bar chart, display from low to high by the y axis please.
CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE departments (DEPARTMENT_ID decima...
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID)
What Russian word translates to bucket?
CREATE TABLE table_name_34 (russian VARCHAR,translation VARCHAR)
SELECT russian FROM table_name_34 WHERE translation = "bucket"
who had more silvers ? colmbia or the bahamas
CREATE TABLE table_203_466 (id number,"rank" number,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number)
SELECT "nation" FROM table_203_466 WHERE "nation" IN ('colombia', 'bahamas') ORDER BY "silver" DESC LIMIT 1
What's the lost when there were more than 16 points and had a drawn less than 1?
CREATE TABLE table_name_18 (lost INTEGER,points VARCHAR,drawn VARCHAR)
SELECT SUM(lost) FROM table_name_18 WHERE points > 16 AND drawn < 1
Name the position for ron lalonde
CREATE TABLE table_1473672_4 (position VARCHAR,player VARCHAR)
SELECT position FROM table_1473672_4 WHERE player = "Ron Lalonde"
What torque does 1.9 diesel with 1905 cc have?
CREATE TABLE table_36521 ("Name" text,"Capacity" text,"Type" text,"Power" text,"Torque" text)
SELECT "Torque" FROM table_36521 WHERE "Name" = '1.9 diesel' AND "Capacity" = '1905 cc'
what does S/ designate as a meal
CREATE TABLE airport (airport_code varchar,airport_name text,airport_location text,state_code varchar,country_name varchar,time_zone_code varchar,minimum_connect_time int)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE code_description (code varchar,descr...
SELECT DISTINCT compartment, meal_code, meal_description, meal_number FROM food_service WHERE meal_code = 'S/'
Find the order dates of the orders with price above 1000, and count them by a bar chart
CREATE TABLE Services (Service_ID INTEGER,Service_Type_Code CHAR(15),Workshop_Group_ID INTEGER,Product_Description VARCHAR(255),Product_Name VARCHAR(255),Product_Price DECIMAL(20,4),Other_Product_Service_Details VARCHAR(255))CREATE TABLE Invoices (Invoice_ID INTEGER,Order_ID INTEGER,payment_method_code CHAR(15),Product...
SELECT Order_Date, COUNT(Order_Date) FROM Customer_Orders AS T1 JOIN Order_Items AS T2 ON T1.Order_ID = T2.Order_ID JOIN Products AS T3 ON T2.Product_ID = T3.Product_ID WHERE T3.Product_Price > 1000
What was the score of the game on December 11?
CREATE TABLE table_21652 ("Game" real,"Date" text,"Opponent" text,"Score" text,"Location" text,"Attendance" real,"Record" text,"Points" real)
SELECT "Score" FROM table_21652 WHERE "Date" = 'December 11'
What is the result when the score is 4-0?
CREATE TABLE table_75053 ("Date" text,"Result" text,"Score" text,"Brazil scorers" text,"Competition" text)
SELECT "Result" FROM table_75053 WHERE "Score" = '4-0'
What is the 2010/11 number when the 2007/08 is 772.6?
CREATE TABLE table_30617 ("IME Exchange (Including spot,credit and forward transactions)" text,"2007/08" text,"2008/09" text,"2009/10" text,"2010/11" text)
SELECT "2010/11" FROM table_30617 WHERE "2007/08" = '772.6'
What years did the person coach who had more than 1 tie, mess than 311 wins and 174 losses?
CREATE TABLE table_name_30 (years VARCHAR,losses VARCHAR,ties VARCHAR,wins VARCHAR)
SELECT years FROM table_name_30 WHERE ties > 1 AND wins < 311 AND losses = 174
What is the frequency of the station owned by the Canadian Broadcasting Corporation and branded as CBC Radio One?
CREATE TABLE table_37149 ("Frequency" text,"Call sign" text,"Branding" text,"Format" text,"Owner" text)
SELECT "Frequency" FROM table_37149 WHERE "Owner" = 'canadian broadcasting corporation' AND "Branding" = 'cbc radio one'
What was the air date in the U.S. for the episode that had 1.452 million Canadian viewers?
CREATE TABLE table_18424435_4 (us_air_date VARCHAR,canadian_viewers__million_ VARCHAR)
SELECT us_air_date FROM table_18424435_4 WHERE canadian_viewers__million_ = "1.452"
Who directed the nominated film 'blood on his hands'?
CREATE TABLE table_name_45 (director_s_ VARCHAR,rank VARCHAR,film VARCHAR)
SELECT director_s_ FROM table_name_45 WHERE rank = "nominated" AND film = "blood on his hands"
what is the least expensive flight available from DALLAS FORT WORTH to SAN FRANCISCO
CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,saturday_stay_required text,minimum_stay int,maximum_stay int,application text,no_discounts text)CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion va...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, fare, flight, flight_fare WHERE ((CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS FORT WOR...
Number of [vote type] on [post type] posted by users under [reputation].
CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRenam...
SELECT FLOOR(Users.Reputation / 10) * 10 AS "reputation_interval", COUNT(CAST(Votes.Id AS INT)) FROM Posts INNER JOIN Users ON Posts.OwnerUserId = Users.Id INNER JOIN Votes ON Votes.PostId = Posts.Id WHERE Posts.PostTypeId = @postType AND Users.Reputation <= @reputation AND Votes.VoteTypeId = @voteType GROUP BY FLOOR(U...
What is the station type of DWMC-TV?
CREATE TABLE table_28303 ("Branding" text,"Callsign" text,"Ch. #" text,"Station Type" text,"Power kW (ERP)" text,"Location (Transmitter Site)" text)
SELECT "Station Type" FROM table_28303 WHERE "Callsign" = 'DWMC-TV'
Top 20 posts in a week.
CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLicense text)CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId nu...
SELECT Id AS "post_link", Title, Score FROM Posts WHERE Posts.CreationDate > CURRENT_TIMESTAMP() - 7 ORDER BY Score DESC LIMIT 20
When 20 is the rr4 points what is the lowest rr3 points?
CREATE TABLE table_24402 ("Team name" text,"Races" real,"Won" real,"RR1 Pts." real,"RR2 Pts." real,"RR3 Pts." real,"RR4 Pts." text,"Total Pts." real,"Ranking" real)
SELECT MIN("RR3 Pts.") FROM table_24402 WHERE "RR4 Pts." = '20'
In what rounds did Luigi Fagioli drive for Alfa Romeo SPA?
CREATE TABLE table_10617 ("Entrant" text,"Constructor" text,"Chassis" text,"Engine" text,"Tyre" text,"Driver" text,"Rounds" text)
SELECT "Rounds" FROM table_10617 WHERE "Entrant" = 'alfa romeo spa' AND "Driver" = 'luigi fagioli'
Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order. Show bar chart.
CREATE TABLE Guests (guest_id INTEGER,gender_code CHAR(1),guest_first_name VARCHAR(80),guest_last_name VARCHAR(80),date_of_birth DATETIME)CREATE TABLE Apartments (apt_id INTEGER,building_id INTEGER,apt_type_code CHAR(15),apt_number CHAR(10),bathroom_count INTEGER,bedroom_count INTEGER,room_count CHAR(5))CREATE TABLE Ap...
SELECT apt_type_code, COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*)
does YX have any flights from MONTREAL to NASHVILLE
CREATE TABLE class_of_service (booking_class varchar,rank int,class_description text)CREATE TABLE month (month_number int,month_name text)CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE code_description (code varchar,description t...
SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((flight.airline_code = 'YX') AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'NASHVILLE' AND flight.to_airport = AIRPORT_...
What game did the Buffalo Bills' opponents earn more than 28 points?
CREATE TABLE table_9357 ("Game" real,"Date" text,"Opponent" text,"Result" text,"Bills points" real,"Opponents" real,"Bills first downs" real,"Record" text,"'Attendance" real)
SELECT "Game" FROM table_9357 WHERE "Opponents" > '28'
What school does Wayne Cooper play for?
CREATE TABLE table_53255 ("Player" text,"Nationality" text,"Position" text,"Years for Jazz" text,"School/Club Team" text)
SELECT "School/Club Team" FROM table_53255 WHERE "Player" = 'wayne cooper'
What is the average silver with more than 0 gold, a Rank of 1, and a Total smaller than 30?
CREATE TABLE table_name_82 (silver INTEGER,total VARCHAR,gold VARCHAR,rank VARCHAR)
SELECT AVG(silver) FROM table_name_82 WHERE gold > 0 AND rank = "1" AND total < 30
What is the average 2006 value with a 2010 value of 417.9 and a 2011 value greater than 426.7?
CREATE TABLE table_name_26 (Id VARCHAR)
SELECT AVG(2006) FROM table_name_26 WHERE 2010 = 417.9 AND 2011 > 426.7
What is the type when yes votes are 546255?
CREATE TABLE table_256286_61 (type VARCHAR,yes_votes VARCHAR)
SELECT type FROM table_256286_61 WHERE yes_votes = 546255
Where was adac rally deutschland's rally HQ?
CREATE TABLE table_64378 ("Round" real,"Dates" text,"Rally Name" text,"Rally HQ" text,"Support Category" text,"Surface" text)
SELECT "Rally HQ" FROM table_64378 WHERE "Rally Name" = 'adac rally deutschland'
how many years are listed ?
CREATE TABLE table_204_838 (id number,"year" number,"award" text,"category" text,"nominated work" text,"result" text)
SELECT COUNT(DISTINCT "year") FROM table_204_838
what is the total goals on this chart
CREATE TABLE table_204_920 (id number,"goal" number,"date" text,"location" text,"opponent" text,"lineup" text,"min" number,"assist/pass" text,"score" text,"result" text,"competition" text)
SELECT SUM("result") FROM table_204_920
What's the hometown of the player who is 6-4?
CREATE TABLE table_name_45 (hometown VARCHAR,height VARCHAR)
SELECT hometown FROM table_name_45 WHERE height = "6-4"
What are the values of n for cinema content provided by Sky Cinema +24 on its Sky Cinema package?
CREATE TABLE table_20394 ("N\u00b0" text,"Television service" text,"Country" text,"Language" text,"Content" text,"DAR" text,"HDTV" text,"PPV" text,"Package/Option" text)
SELECT "N\u00b0" FROM table_20394 WHERE "Package/Option" = 'Sky Cinema' AND "Content" = 'cinema' AND "Television service" = 'Sky Cinema +24'
count the number of patients whose language is engl and year of birth is less than 2069?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid 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,ethni...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.language = "ENGL" AND demographic.dob_year < "2069"
Which total number of Week has an Opponent of at new orleans saints, and an Attendance larger than 53,448?
CREATE TABLE table_name_17 (week VARCHAR,opponent VARCHAR,attendance VARCHAR)
SELECT COUNT(week) FROM table_name_17 WHERE opponent = "at new orleans saints" AND attendance > 53 OFFSET 448
What is the time of the Essendon home team game?
CREATE TABLE table_34435 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Ground" text,"Crowd" text,"Date" text,"Time" text,"Report" text)
SELECT "Time" FROM table_34435 WHERE "Home team" = 'essendon'
Which upper level classes are worth 10 credits ?
CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE TABLE gsi (course_offering_id int,student_id int)CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar...
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.credits = 10 AND program_course.category LIKE 'ULCS'
How many games had red star as the runner up?
CREATE TABLE table_73958 ("Year" text,"Winner" text,"Runner-up" text,"Result" text,"Venues" text,"Attendance" real,"Entries" real)
SELECT COUNT("Attendance") FROM table_73958 WHERE "Runner-up" = 'Red Star'
Which Apogee was on 1959-02-20?
CREATE TABLE table_name_5 (apogee VARCHAR,date VARCHAR)
SELECT apogee FROM table_name_5 WHERE date = "1959-02-20"
What championship had a margin of playoff 2?
CREATE TABLE table_13026799_1 (championship VARCHAR,margin VARCHAR)
SELECT championship FROM table_13026799_1 WHERE margin = "Playoff 2"
What is the relationship between Body_Builder_ID and Snatch ?
CREATE TABLE body_builder (Body_Builder_ID int,People_ID int,Snatch real,Clean_Jerk real,Total real)CREATE TABLE people (People_ID int,Name text,Height real,Weight real,Birth_Date text,Birth_Place text)
SELECT Body_Builder_ID, Snatch FROM body_builder
With 14 under the date, what is the tonnage of the ship?
CREATE TABLE table_78965 ("Date" text,"Ship Name" text,"Tonnage" text,"Ship Type" text,"Location" text,"Disposition of Ship" text)
SELECT "Tonnage" FROM table_78965 WHERE "Date" = '14'
Show all artist names and the number of exhibitions for each artist in a bar chart.
CREATE TABLE exhibition_record (Exhibition_ID int,Date text,Attendance int)CREATE TABLE artist (Artist_ID int,Name text,Country text,Year_Join int,Age int)CREATE TABLE exhibition (Exhibition_ID int,Year int,Theme text,Artist_ID int,Ticket_Price real)
SELECT Name, COUNT(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.Artist_ID = T2.Artist_ID GROUP BY T1.Artist_ID
Questions with letter transpositions of 'Android' in the title. case-insensitive
CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)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 T...
SELECT Id AS "post_link", CreationDate FROM Posts WHERE PostTypeId = 1 AND (Title LIKE '%nadroid%' COLLATE SQL_Latin1_General_CP1_CI_AS OR Title LIKE '%adnroid%' COLLATE SQL_Latin1_General_CP1_CI_AS OR Title LIKE '%anrdoid%' COLLATE SQL_Latin1_General_CP1_CI_AS OR Title LIKE '%andorid%' COLLATE SQL_Latin1_General_CP1_C...
get me the number of private insurance patients who had phys referral/normal deli admission.
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 prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Private" AND demographic.admission_location = "PHYS REFERRAL/NORMAL DELI"
How many against for the Moyston-Willaura team with 4 losses and fewer than 2 byes?
CREATE TABLE table_12674 ("Mininera DFL" text,"Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real)
SELECT MAX("Against") FROM table_12674 WHERE "Losses" = '4' AND "Mininera DFL" = 'moyston-willaura' AND "Byes" < '2'
What percentile am I in for a given tag for a given location?. Determines where you rank in a given tag as of the last data load
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,OwnerUserId number,Comment text,Text text,Title text,Tags text,RevisionGUID other)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE Comments (Id number,Po...
SELECT STR(NTILE(100) OVER (ORDER BY SUM(answers.Score) DESC), 3) + '%' AS "top", ROW_NUMBER() OVER (ORDER BY SUM(answers.Score) DESC) AS "ranking", Users.Id AS "user_link", SUM(answers.Score) AS "total_score" FROM Tags JOIN PostTags ON Tags.Id = PostTags.TagId AND Tags.TagName = '##TagName##' JOIN Posts AS questions O...
What's the highest Date listed that has U-boats destroyed (Pola) of 1?
CREATE TABLE table_13828 ("Date" real,"Ships sunk (Pola)" text,"Tonnage" text,"U-boats destroyed (KuK)" text,"U-boats destroyed (Pola)" text)
SELECT MAX("Date") FROM table_13828 WHERE "U-boats destroyed (Pola)" = '1'
What was the total number of votes in the 2005 elections?
CREATE TABLE table_19698421_1 (total_votes INTEGER,year VARCHAR)
SELECT MIN(total_votes) FROM table_19698421_1 WHERE year = "2005"
what is the type when the position is ambassador and the location is rabat?
CREATE TABLE table_60655 ("Mission" text,"Location" text,"Type" text,"Head of Mission" text,"Position" text,"List" text)
SELECT "Type" FROM table_60655 WHERE "Position" = 'ambassador' AND "Location" = 'rabat'
What bowling style does First Class Team, Griqualand West have?
CREATE TABLE table_57386 ("Player" text,"Date of Birth" text,"Batting Style" text,"Bowling Style" text,"First Class Team" text)
SELECT "Bowling Style" FROM table_57386 WHERE "First Class Team" = 'griqualand west'
What is the episode number for series 17?
CREATE TABLE table_73189 ("Series #" real,"Episode #" real,"Title" text,"Directed by" text,"Written by" text,"Original airdate" text)
SELECT "Episode #" FROM table_73189 WHERE "Series #" = '17'
Position of guard, and a Pick # larger than 9 is what highest round?
CREATE TABLE table_name_67 (round INTEGER,position VARCHAR,pick__number VARCHAR)
SELECT MAX(round) FROM table_name_67 WHERE position = "guard" AND pick__number > 9
had patient 89875 been prescribed metoprolol tartrate, furosemide, or hydralazine hcl since 11/2104?
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 outputevents (row_id number,subject_id number,hadm_id number,i...
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 89875) AND prescriptions.drug IN ('furosemide', 'metoprolol tartrate', 'hydralazine hcl') AND STRFTIME('%y-%m', prescriptions.startdate) >= '2104-11'
What nationality is the draft pick with w position from leninogorsk (russia-2)?
CREATE TABLE table_77839 ("Round" real,"Player" text,"Position" text,"Nationality" text,"College/Junior/Club Team (League)" text)
SELECT "Nationality" FROM table_77839 WHERE "Position" = 'w' AND "College/Junior/Club Team (League)" = 'leninogorsk (russia-2)'
what venue was the latest match played at ?
CREATE TABLE table_203_614 (id number,"#" number,"date" text,"venue" text,"opponent" text,"score" text,"result" text,"competition" text)
SELECT "venue" FROM table_203_614 ORDER BY "date" DESC LIMIT 1
What is every value for average on previous season if the competition is league two?
CREATE TABLE table_2970978_1 (___ave_on_prev_season VARCHAR,competition VARCHAR)
SELECT ___ave_on_prev_season FROM table_2970978_1 WHERE competition = "League Two"
User with highest average comment score.
CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PostLinks (Id n...
SELECT c.UserId AS "user_link", c.UserDisplayName, AVG(CAST(c.Score AS FLOAT)) AS "average_score", SUM(c.Score) AS "total_score", COUNT(c.Id) AS "total_count", 'site://users/' + CAST(c.UserId AS TEXT) + '?tab=activity&sort=comments' AS "link_to_comments" FROM Comments AS c GROUP BY c.UserId, c.UserDisplayName HAVING CO...
Which exaltation has a domicile of Saturn and a fall of Jupiter?
CREATE TABLE table_name_98 (exaltation VARCHAR,domicile VARCHAR,fall VARCHAR)
SELECT exaltation FROM table_name_98 WHERE domicile = "saturn" AND fall = "jupiter"
how many players had a total of 4 ?
CREATE TABLE table_204_784 (id number,"player" text,"league" number,"cup" number,"europa league" number,"total" number)
SELECT COUNT("player") FROM table_204_784 WHERE "total" = 4
Who is the 125cc winnder for the Phillip Island circuit?
CREATE TABLE table_12186237_1 (circuit VARCHAR)
SELECT 125 AS cc_winner FROM table_12186237_1 WHERE circuit = "Phillip Island"
get user post subject tags.
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,Las...
SELECT Users.Id AS user_id, COUNT(DISTINCT userPostsBeforeT.TagId) AS NumSubjectAreas FROM Users AS users LEFT JOIN (SELECT OwnerUserId, PostId, PostTypeId, PT.TagId FROM Posts AS P JOIN PostTags AS PT ON P.Id = Pt.PostId) AS userPostsBeforeT ON userPostsBeforeT.OwnerUserId = Users.Id AND userPostsBeforeT.PostTypeId = ...
how many patients whose insurance is private and discharge location is left against medical advi?
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 demographic (subject_id text,hadm_id text,name text,marita...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Private" AND demographic.discharge_location = "LEFT AGAINST MEDICAL ADVI"
what is drug name of subject name paul edwards?
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 prescriptions.drug FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.name = "Paul Edwards"
What Car Model has the Manufacturer of Saab, and Driver Dean Randle?
CREATE TABLE table_name_35 (car_model VARCHAR,manufacturer VARCHAR,driver VARCHAR)
SELECT car_model FROM table_name_35 WHERE manufacturer = "saab" AND driver = "dean randle"
what is the direct bilirubin change and difference of patient 012-27355 last measured on the first hospital visit compared to the first value measured on the first hospital visit?
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE microlab ...
SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-27355' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi...
Tell me the title for japan august 23, 2012
CREATE TABLE table_32063 ("Title" text,"Japan" text,"North America" text,"Europe" text,"Australia" text)
SELECT "Title" FROM table_32063 WHERE "Japan" = 'august 23, 2012'
What was the lowest attendance for games played on december 23?
CREATE TABLE table_23308178_6 (attendance INTEGER,date VARCHAR)
SELECT MIN(attendance) FROM table_23308178_6 WHERE date = "December 23"
How many teams drafted players from the University of Maryland?
CREATE TABLE table_25518547_3 (mls_team VARCHAR,affiliation VARCHAR)
SELECT COUNT(mls_team) FROM table_25518547_3 WHERE affiliation = "University of Maryland"
What are the dates of the orders made by the customer named 'Jeramie', and count them by a line chart
CREATE TABLE Invoices (invoice_number INTEGER,invoice_date DATETIME,invoice_details VARCHAR(255))CREATE TABLE Order_Items (order_item_id INTEGER,product_id INTEGER,order_id INTEGER,order_item_status VARCHAR(10),order_item_details VARCHAR(255))CREATE TABLE Shipment_Items (shipment_id INTEGER,order_item_id INTEGER)CREATE...
SELECT date_order_placed, COUNT(date_order_placed) FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = "Jeramie"
What's the network of BBTV Channel 7?
CREATE TABLE table_name_99 (network VARCHAR,name VARCHAR)
SELECT network FROM table_name_99 WHERE name = "bbtv channel 7"
What is the lowest week for December 26, 1999
CREATE TABLE table_42293 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" text)
SELECT MIN("Week") FROM table_42293 WHERE "Date" = 'december 26, 1999'
what is the original air date of the episode directed by Ben Jones and written by Steven Melching?
CREATE TABLE table_20360535_4 (original_air_date VARCHAR,directed_by VARCHAR,written_by VARCHAR)
SELECT original_air_date FROM table_20360535_4 WHERE directed_by = "Ben Jones" AND written_by = "Steven Melching"
Count the number of cities in the state of Colorado.
CREATE TABLE individuals (individual_id number,individual_first_name text,individual_middle_name text,inidividual_phone text,individual_email text,individual_address text,individual_last_name text)CREATE TABLE party_services (booking_id number,customer_id number,service_id number,service_datetime time,booking_made_date...
SELECT COUNT(*) FROM addresses WHERE state_province_county = "Colorado"
What day was United States the opposing team?
CREATE TABLE table_name_92 (date VARCHAR,opposing_team VARCHAR)
SELECT date FROM table_name_92 WHERE opposing_team = "united states"
What is the 2006 that has a 2r in 2004, and a 2r in 2005?
CREATE TABLE table_name_84 (Id VARCHAR)
SELECT 2006 FROM table_name_84 WHERE 2004 = "2r" AND 2005 = "2r"
How many championships have there been with Steffi Graf?
CREATE TABLE table_22858557_1 (championship VARCHAR,opponent_in_final VARCHAR)
SELECT championship FROM table_22858557_1 WHERE opponent_in_final = "Steffi Graf"
what was the lowest year stamped ?
CREATE TABLE table_203_248 (id number,"code" text,"year" number)
SELECT MIN("year") FROM table_203_248
What is the English title of the film Directed by Jayme Monjardim?
CREATE TABLE table_38922 ("Year (Ceremony)" real,"Original title" text,"English title" text,"Director" text,"Result" text)
SELECT "English title" FROM table_38922 WHERE "Director" = 'jayme monjardim'
Which kickoff had an attendance of 58,120?
CREATE TABLE table_name_9 (kickoff_ VARCHAR,a_ VARCHAR,attendance VARCHAR)
SELECT kickoff_ AS "a_" FROM table_name_9 WHERE attendance = "58,120"
Give me the comparison about the average of Team_ID over the ACC_Road , and group by attribute ACC_Road, I want to sort in desc by the Y-axis.
CREATE TABLE basketball_match (Team_ID int,School_ID int,Team_Name text,ACC_Regular_Season text,ACC_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Percent int,All_Home text,All_Road text,All_Neutral text)CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,En...
SELECT ACC_Road, AVG(Team_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY AVG(Team_ID) DESC
Name the least number of episodes for the panelists of reggie yates and kelly osbourne
CREATE TABLE table_72739 ("Episode Number" real,"Air Date" text,"Guest Host" text,"Musical Guest (Song performed)" text,"Who knows the most about the guest host? Panelists" text,"Coat Of Cash Wearing Celebrity" text)
SELECT MIN("Episode Number") FROM table_72739 WHERE "Who knows the most about the guest host? Panelists" = 'Reggie Yates and Kelly Osbourne'
Upvote : Top user in kerala - VB.NET.
CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,Reje...
SELECT Users.Id AS "user_link", TagName, COUNT(*) AS UpVotes FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId INNER JOIN Votes ON Votes.PostId = Posts.Id AND VoteTypeId = 2 INNER JOIN Users ON Users.Id = Posts.OwnerUserId WHERE LOWER(Location) LIKE '%kottaya...
Show different nominees and the number of musicals they have been nominated in a bar chart, show Nominee from low to high order.
CREATE TABLE actor (Actor_ID int,Name text,Musical_ID int,Character text,Duration text,age int)CREATE TABLE musical (Musical_ID int,Name text,Year int,Award text,Category text,Nominee text,Result text)
SELECT Nominee, COUNT(*) FROM musical GROUP BY Nominee ORDER BY Nominee
User with most questions asked.
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 ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE Review...
SELECT Users.Id AS "user_link", QuestionCounts.PostsCount AS "number_of_questions", AnswerCounts.PostsCount AS "number_of_answers" FROM (SELECT OwnerUserId, COUNT(Id) AS PostsCount FROM Posts WHERE PostTypeId = 1 GROUP BY OwnerUserId) AS QuestionCounts, (SELECT OwnerUserId, COUNT(Id) AS PostsCount FROM Posts WHERE Post...
What are the ids of all students who played video games and sports?
CREATE TABLE video_games (gameid number,gname text,gtype text)CREATE TABLE sportsinfo (stuid number,sportname text,hoursperweek number,gamesplayed number,onscholarship text)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)CREATE TABLE plays_games (s...
SELECT stuid FROM sportsinfo INTERSECT SELECT stuid FROM plays_games