instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
What is the other premiership when the runner up wis Geelong?
CREATE TABLE table_16717 ("Season" real,"Premier" text,"Runner Up" text,"Score" text,"Venue" text,"Attendance" real,"Premiership" text)
SELECT "Premiership" FROM table_16717 WHERE "Runner Up" = 'Geelong'
WHAT IS THE LEAD WITH THIRD AS JEANNA SCHRAEDER?
CREATE TABLE table_44573 ("Skip" text,"Third" text,"Second" text,"Lead" text,"City" text)
SELECT "Lead" FROM table_44573 WHERE "Third" = 'jeanna schraeder'
Evolution of the number of posts of a given type. Calculates a graph with the number of posts of a given type for each day between two chosen dates. Posts types are 1 for question, 2 for answers, and for more, see http://meta.stackexchange.com/q/2677/285933
CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,Own...
SELECT TIME_TO_STR(CreationDate, '%d') AS DayDate, STR(YEAR(CreationDate)) + '-' + STR(MONTH(CreationDate)) + '-' + STR(DAY(CreationDate)) AS FullDate, COUNT(*) AS Total FROM Posts WHERE PostTypeId = 1 GROUP BY STR(YEAR(CreationDate)) + '-' + STR(MONTH(CreationDate)) + '-' + STR(DAY(CreationDate)), TIME_TO_STR(Creation...
What top round has a pick smaller than 2?
CREATE TABLE table_76964 ("Round" real,"Pick" real,"Overall" real,"Name" text,"Position" text,"College" text)
SELECT MAX("Round") FROM table_76964 WHERE "Pick" < '2'
what are the top three most frequent diagnoses which patients were given within the same month after undergoing non-invasive mech vent since 2105?
CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TAB...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissi...
Which Location has a Year Joined of 1966, and a Previous Conference of noble county, and a School of wawaka?
CREATE TABLE table_name_83 (location VARCHAR,school VARCHAR,year_joined VARCHAR,previous_conference VARCHAR)
SELECT location FROM table_name_83 WHERE year_joined = 1966 AND previous_conference = "noble county" AND school = "wawaka"
What is the NFL team for the player who's college was North Carolina?
CREATE TABLE table_16376436_1 (nfl_team VARCHAR,college VARCHAR)
SELECT nfl_team FROM table_16376436_1 WHERE college = "North Carolina"
How many silver medals when the bronze is more than 2 and having a rank more than 5?
CREATE TABLE table_name_89 (silver INTEGER,rank VARCHAR,bronze VARCHAR)
SELECT MAX(silver) FROM table_name_89 WHERE rank > 5 AND bronze > 2
What number episode in the series had a production code of 110?
CREATE TABLE table_27483 ("No. in series" text,"Title" text,"Directed by" text,"Written by" text,"U.S. viewers (millions)" text,"Original U.S. air date" text,"Prod. code" text)
SELECT "No. in series" FROM table_27483 WHERE "Prod. code" = '110'
How many reg GP for mattias ohlund?
CREATE TABLE table_name_35 (reg_gp VARCHAR,player VARCHAR)
SELECT COUNT(reg_gp) FROM table_name_35 WHERE player = "mattias ohlund"
Which Points have an Opponent of @ florida panthers, and a Game larger than 58?
CREATE TABLE table_35366 ("Game" real,"February" real,"Opponent" text,"Score" text,"Record" text,"Points" real)
SELECT MIN("Points") FROM table_35366 WHERE "Opponent" = '@ florida panthers' AND "Game" > '58'
i need a flight from MEMPHIS to TACOMA that goes through LOS ANGELES
CREATE TABLE fare (fare_id int,from_airport varchar,to_airport varchar,fare_basis_code text,fare_airline text,restriction_code text,one_direction_cost int,round_trip_cost int,round_trip_required varchar)CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE state (state_code text,state_name text,country_nam...
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, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'LOS ANGELES' AND CITY_...
Which Wheels has Built smaller than 1958, a Location of york, and a Railway of nsr?
CREATE TABLE table_name_31 (wheels VARCHAR,railway VARCHAR,built VARCHAR,location VARCHAR)
SELECT wheels FROM table_name_31 WHERE built < 1958 AND location = "york" AND railway = "nsr"
What attendance has Washington redskins as the opponent?
CREATE TABLE table_name_89 (attendance VARCHAR,opponent VARCHAR)
SELECT attendance FROM table_name_89 WHERE opponent = "washington redskins"
Days I hit rep cap. Returns the days a user hit the rep cap
CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE Review...
SELECT ROW_NUMBER() OVER (ORDER BY CreationDate) AS row, CreationDate, Votes FROM (SELECT SUM(CASE Votes.VoteTypeId WHEN 1 THEN 15 WHEN 2 THEN 10 WHEN 3 THEN -3 WHEN 9 THEN BountyAmount END) AS Votes, Votes.CreationDate AS CreationDate FROM Posts INNER JOIN Votes ON Votes.PostId = Posts.Id WHERE Posts.OwnerUserId = @Us...
How many female people are older than 30 in our record?
CREATE TABLE church (church_id number,name text,organized_by text,open_date number,continuation_of text)CREATE TABLE wedding (church_id number,male_id number,female_id number,year number)CREATE TABLE people (people_id number,name text,country text,is_male text,age number)
SELECT COUNT(*) FROM people WHERE is_male = 'F' AND age > 30
What were the dates of the games where Jalen Rose (32) had the highest points?
CREATE TABLE table_15872814_5 (date VARCHAR,high_points VARCHAR)
SELECT date FROM table_15872814_5 WHERE high_points = "Jalen Rose (32)"
Who was the player with a 36.74 average?
CREATE TABLE table_26041144_11 (player VARCHAR,average VARCHAR)
SELECT player FROM table_26041144_11 WHERE average = "36.74"
How did the manager replaced by Michael Oenning depart?
CREATE TABLE table_48703 ("Team" text,"Outgoing manager" text,"Manner of departure" text,"Date of vacancy" text,"Replaced by" text,"Date of appointment" text)
SELECT "Manner of departure" FROM table_48703 WHERE "Replaced by" = 'michael oenning'
has patient 030-47098 received a thrombocytopenia - heparin-induced diagnosis since 5 years ago.
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 intakeoutput (intakeoutputid number,patientunitstayid number,ce...
SELECT COUNT(*) > 0 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-47098')) AND diagnosis.diagnosisname = 'thrombocytopenia - heparin-induc...
What is the title of the album that had a RIAA of gold?
CREATE TABLE table_name_56 (title VARCHAR,riaa VARCHAR)
SELECT title FROM table_name_56 WHERE riaa = "gold"
What is the Removal that has a Trim of xe (2009)?
CREATE TABLE table_35723 ("Trim" text,"Engine" text,"Displacement" text,"Power" text,"Torque" text,"Transmission" text,"Fuel Mileage (latest EPA mpg - US)" text)
SELECT "Transmission" FROM table_35723 WHERE "Trim" = 'xe (2009)'
How long is the song titled burning love?
CREATE TABLE table_40061 ("Track" real,"Recorded" text,"Catalogue" text,"Release date" text,"Song title" text,"Writer(s)" text,"Time" text)
SELECT "Time" FROM table_40061 WHERE "Song title" = 'burning love'
What is the id, forname and surname of the driver who had the first position in terms of laptime at least twice?
CREATE TABLE qualifying (qualifyid number,raceid number,driverid number,constructorid number,number number,position number,q1 text,q2 text,q3 text)CREATE TABLE laptimes (raceid number,driverid number,lap number,position number,time text,milliseconds number)CREATE TABLE circuits (circuitid number,circuitref text,name te...
SELECT T1.driverid, T1.forename, T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid WHERE position = '1' GROUP BY T1.driverid HAVING COUNT(*) >= 2
When was the record 3-14-6?
CREATE TABLE table_name_62 (date VARCHAR,record VARCHAR)
SELECT date FROM table_name_62 WHERE record = "3-14-6"
How many debates are there?
CREATE TABLE debate (debate_id number,date text,venue text,num_of_audience number)CREATE TABLE debate_people (debate_id number,affirmative number,negative number,if_affirmative_win others)CREATE TABLE people (people_id number,district text,name text,party text,age number)
SELECT COUNT(*) FROM debate
Show budget type codes and the number of documents in each budget type. Show bar chart.
CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR(15),Document_Type_Name VARCHAR(255),Document_Type_Description VARCHAR(255))CREATE TABLE Ref_Budget_Codes (Budget_Type_Code CHAR(15),Budget_Type_Description VARCHAR(255))CREATE TABLE Projects (Project_ID INTEGER,Project_Details VARCHAR(255))CREATE TABLE Documents ...
SELECT Budget_Type_Code, COUNT(*) FROM Documents_with_Expenses GROUP BY Budget_Type_Code
Which Post Town has a Dialcode of 020 and is located in Hook?
CREATE TABLE table_53503 ("Location" text,"Londonborough" text,"Post town" text,"Postcodedistrict" text,"Dialcode" text)
SELECT "Post town" FROM table_53503 WHERE "Dialcode" = '020' AND "Location" = 'hook'
What is the data point for s hindu where the buddhist data point is 73.0%?
CREATE TABLE table_1079 ("Composition" text,"s Hindu" text,"s Muslim" text,"Christians" text,"s Sikh" text,"Buddhist" text,"s Jain" text,"Others" text)
SELECT COUNT("s Hindu") FROM table_1079 WHERE "Buddhist" = '73.0%'
What was the attendance at the game that had a loss of Crabtree (0-1)?
CREATE TABLE table_name_34 (attendance VARCHAR,loss VARCHAR)
SELECT attendance FROM table_name_34 WHERE loss = "crabtree (0-1)"
What is the Date of attack of the ship with iron ore sunk by u-101 *?
CREATE TABLE table_43626 ("Name" text,"Flag" text,"Cargo" text,"Fate" text,"Date of attack" text)
SELECT "Date of attack" FROM table_43626 WHERE "Fate" = 'sunk by u-101 *' AND "Cargo" = 'iron ore'
Which retitled network has a Show of supermarket sweep?
CREATE TABLE table_50875 ("Show" text,"Last Aired" real,"Previous Network" text,"Retitled as/Same" text,"New/Returning/Same Network" text,"Returning" text)
SELECT "Retitled as/Same" FROM table_50875 WHERE "Show" = 'supermarket sweep'
What is the scored figure when the result is 40-22?
CREATE TABLE table_name_94 (scored INTEGER,result VARCHAR)
SELECT SUM(scored) FROM table_name_94 WHERE result = "40-22"
when was the last time that patient 15986's arterial bp [diastolic] was measured or taken on this month/23?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime 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 admissions (row_id number,subject_id number,hadm_id number,admittime time,di...
SELECT chartevents.charttime 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 = 15986)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial...
Close Votes for Tag X by User (with Links).
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId n...
SELECT COUNT(*) FROM ReviewTasks WHERE ReviewTaskTypeId = 2 AND ReviewTaskStateId = 1
What is Country, when Class is 'club'?
CREATE TABLE table_49605 ("Place" text,"Country" text,"Qualifying Grand Prix" text,"Class" text,"Dates" text)
SELECT "Country" FROM table_49605 WHERE "Class" = 'club'
What is the number of start date of each apartment booking for each weekday? Return a bar chart.
CREATE TABLE Apartment_Facilities (apt_id INTEGER,facility_code CHAR(15))CREATE TABLE Apartment_Bookings (apt_booking_id INTEGER,apt_id INTEGER,guest_id INTEGER,booking_status_code CHAR(15),booking_start_date DATETIME,booking_end_date DATETIME)CREATE TABLE View_Unit_Status (apt_id INTEGER,apt_booking_id INTEGER,status_...
SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id
How many tenants are there in the city of Samsun?
CREATE TABLE table_10601843_2 (tenant VARCHAR,city VARCHAR)
SELECT COUNT(tenant) FROM table_10601843_2 WHERE city = "Samsun"
What year did Senator Ken Armbrister take office?
CREATE TABLE table_76076 ("Senator" text,"Party" text,"District" real,"Home Town" text,"Took Office" real)
SELECT "Took Office" FROM table_76076 WHERE "Senator" = 'ken armbrister'
For all employees who have the letters D or S in their first name, a bar chart shows the distribution of hire_date and the average of manager_id bin hire_date by time, and sort by the y-axis in descending.
CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))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),MANAGE...
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(MANAGER_ID) DESC
What squad plays at comunale in darfo boario terme?
CREATE TABLE table_name_40 (name VARCHAR,home_venue VARCHAR,city VARCHAR)
SELECT name FROM table_name_40 WHERE home_venue = "comunale" AND city = "darfo boario terme"
specify the procedural and diagnosis icd9 codes for patient id 16438
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 diagnoses.short_title, procedures.short_title FROM diagnoses INNER JOIN procedures ON diagnoses.hadm_id = procedures.hadm_id WHERE diagnoses.subject_id = "16438"
Which Rd took place at the Indianapolis 500?
CREATE TABLE table_72110 ("Rd" real,"Name" text,"Pole Position" text,"Fastest Lap" text,"Winning driver" text,"Winning team" text,"Report" text)
SELECT "Rd" FROM table_72110 WHERE "Name" = 'Indianapolis 500'
hba1c > 6.49 and < 14.1
CREATE TABLE table_train_148 ("id" int,"hemoglobin_a1c_hba1c" float,"renal_disease" bool,"hematocrit_hct" float,"serum_creatinine" float,"albumin" float,"body_mass_index_bmi" float,"NOUSE" float)
SELECT * FROM table_train_148 WHERE hemoglobin_a1c_hba1c > 6.49 AND hemoglobin_a1c_hba1c < 14.1
What is the kickoff time for week 3?
CREATE TABLE table_55182 ("Week" text,"Date" text,"Opponent" text,"Result" text,"Kickoff [a ]" text,"Game site" text,"Attendance" text,"Record" text)
SELECT "Kickoff [a ]" FROM table_55182 WHERE "Week" = '3'
What is the Unit for the Aircraft F.e.2b, located in Logeast?
CREATE TABLE table_60760 ("Date" text,"Unit" real,"Aircraft" text,"Opponent" text,"Location" text)
SELECT SUM("Unit") FROM table_60760 WHERE "Aircraft" = 'f.e.2b' AND "Location" = 'logeast'
What is the latest November date with an Opponent of @ Pittsburgh Pirates and the game is more than 3?
CREATE TABLE table_name_55 (november INTEGER,opponent VARCHAR,game VARCHAR)
SELECT MAX(november) FROM table_name_55 WHERE opponent = "@ pittsburgh pirates" AND game > 3
What team has an incoming manager named Kenny Dalglish?
CREATE TABLE table_73620 ("Team" text,"Outgoing manager" text,"Manner of departure" text,"Date of vacancy" text,"Table" text,"Incoming manager" text,"Date of appointment" text)
SELECT "Team" FROM table_73620 WHERE "Incoming manager" = 'Kenny Dalglish'
Users with highest reputation-to-number-of-answers ratio.
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 PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number...
SELECT u.Id AS "user_link", COUNT(*) AS NumPosts, u.Reputation AS Reputation, CAST(Reputation * 1.0 / COUNT(*) AS FLOAT(5, 2)) AS ratio FROM Posts AS a INNER JOIN Users AS u ON u.Id = a.OwnerUserId GROUP BY u.Reputation, u.Id, u.DisplayName HAVING COUNT(*) >= @MinPosts ORDER BY ratio DESC, NumPosts DESC LIMIT 200
For each customer status code, how many customers are classified that way. Show the proportion.
CREATE TABLE Customers (customer_id INTEGER,customer_address_id INTEGER,customer_status_code VARCHAR(15),date_became_customer DATETIME,date_of_birth DATETIME,first_name VARCHAR(80),last_name VARCHAR(80),amount_outstanding DOUBLE,email_address VARCHAR(250),phone_number VARCHAR(255),cell_mobile_phone_number VARCHAR(255))...
SELECT customer_status_code, COUNT(*) FROM Customers GROUP BY customer_status_code
What is To par, when Country is 'United States', and when Player is 'Jay Haas'?
CREATE TABLE table_name_85 (to_par VARCHAR,country VARCHAR,player VARCHAR)
SELECT to_par FROM table_name_85 WHERE country = "united states" AND player = "jay haas"
Who has taught APPPHYS 550 in the past ?
CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE TABLE student_record (student_id int,course_id int,semester int,grade varchar,how varchar,transfer_source varchar,earn_cr...
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN semester...
Find the team of each player and sort them in ascending alphabetical order.
CREATE TABLE player (player_id number,player text,team text,age number,position text,school_id number)CREATE TABLE school (school_id number,school text,location text,enrollment number,founded number,denomination text,boys_or_girls text,day_or_boarding text,year_entered_competition number,school_colors text)CREATE TABLE...
SELECT team FROM player ORDER BY team
Where is moving to the type loaned out under the name tragodara?
CREATE TABLE table_name_74 (moving_to VARCHAR,type VARCHAR,name VARCHAR)
SELECT moving_to FROM table_name_74 WHERE type = "loaned out" AND name = "tragodara"
Which Opponent has an Attendance of 375?
CREATE TABLE table_name_65 (opponent VARCHAR,attendance VARCHAR)
SELECT opponent FROM table_name_65 WHERE attendance = 375
What is the Japanese title with an average rating of 11.6%?
CREATE TABLE table_18540104_1 (japanese_title VARCHAR,average_ratings VARCHAR)
SELECT japanese_title FROM table_18540104_1 WHERE average_ratings = "11.6%"
What was the venue of the competition that held the 1st position in 2011?
CREATE TABLE table_32155 ("Year" real,"Competition" text,"Venue" text,"Position" text,"Notes" text)
SELECT "Venue" FROM table_32155 WHERE "Position" = '1st' AND "Year" = '2011'
How many births per year are there for the period with 998 000 deaths per year?
CREATE TABLE table_18950570_2 (live_births_per_year VARCHAR,deaths_per_year VARCHAR)
SELECT live_births_per_year FROM table_18950570_2 WHERE deaths_per_year = "998 000"
What is the maximum points received when Peeter V hl gave a 9?
CREATE TABLE table_31025 ("Artist" text,"Jaanu N\u0151gisto" real,"Iiris Vesik" real,"Erik Morna" real,"Veronika Portsmuth" real,"Chalice" real,"Kristo Rajasaare" real,"Hannaliisa Uusmaa" real,"Siim Nestor" real,"Peeter V\u00e4hi" real,"Helen Sildna" real,"Ott Lepland" real,"Total" real,"Points" real)
SELECT MIN("Points") FROM table_31025 WHERE "Peeter V\u00e4hi" = '9'
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, visualize a bar chart about the distribution of job_id and the sum of department_id , and group by attribute job_id, and could you sort sum department id in descending order?
CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))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 departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANA...
SELECT JOB_ID, SUM(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY SUM(DEPARTMENT_ID) DESC
What is Geelong's home team score?
CREATE TABLE table_name_89 (home_team VARCHAR)
SELECT home_team AS score FROM table_name_89 WHERE home_team = "geelong"
In which championship did the winner have a score of 9 (66-69-73-71=279)?
CREATE TABLE table_46564 ("Year" real,"Championship" text,"Winning score" text,"Margin of victory" text,"Runner(s)-up" text)
SELECT "Championship" FROM table_46564 WHERE "Winning score" = '−9 (66-69-73-71=279)'
Just show the employee's last name and their department's id using a bar chart, display by the DEPARTMENT_ID in descending.
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 LAST_NAME, DEPARTMENT_ID FROM employees ORDER BY DEPARTMENT_ID DESC
List the id, color scheme, and name for all the photos.
CREATE TABLE photos (id number,camera_lens_id number,mountain_id number,color text,name text)CREATE TABLE mountain (id number,name text,height number,prominence number,range text,country text)CREATE TABLE camera_lens (id number,brand text,name text,focal_length_mm number,max_aperture number)
SELECT id, color, name FROM photos
Average Score of my Questions.
CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,Rej...
SELECT AVG(CAST(Score AS FLOAT)) AS "AverageScore" FROM Posts WHERE PostTypeId = 1 AND OwnerUserId = '##UserId##'
What was the away team score, when the away team was Fitzroy?
CREATE TABLE table_56149 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Date" text)
SELECT "Away team score" FROM table_56149 WHERE "Away team" = 'fitzroy'
Name the number of against for portuguesa santista
CREATE TABLE table_20012 ("Position" real,"Team" text,"Points" real,"Played" real,"Won" real,"Drawn" real,"Lost" real,"For" real,"Against" real,"Difference" text)
SELECT COUNT("Against") FROM table_20012 WHERE "Team" = 'Portuguesa Santista'
What's the largest amount of wins Texas has?
CREATE TABLE table_72759 ("Appearances" real,"School" text,"Wins" real,"Losses" real,"Percent" text,"Last Appearance" text)
SELECT MAX("Wins") FROM table_72759 WHERE "School" = 'Texas'
Who was the visitor when ward recorded the decision with a record of 22 21 4?
CREATE TABLE table_name_4 (visitor VARCHAR,decision VARCHAR,record VARCHAR)
SELECT visitor FROM table_name_4 WHERE decision = "ward" AND record = "22–21–4"
What is Game, when Road Team is 'Syracuse', and when Result is '109-82'?
CREATE TABLE table_name_77 (game VARCHAR,road_team VARCHAR,result VARCHAR)
SELECT game FROM table_name_77 WHERE road_team = "syracuse" AND result = "109-82"
What is the away team score at princes park with a Crowd larger than 27,455?
CREATE TABLE table_11409 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Away team score" FROM table_11409 WHERE "Crowd" > '27,455' AND "Venue" = 'princes park'
tell me the marital status for the patient john gartman.
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 demographic.marital_status FROM demographic WHERE demographic.name = "John Gartman"
Who wrote episode that had 1.97 million u.s. viewers?
CREATE TABLE table_27892955_1 (written_by VARCHAR,us_viewers__million_ VARCHAR)
SELECT written_by FROM table_27892955_1 WHERE us_viewers__million_ = "1.97"
who is the Visitor that has a Series of series tied 2 2?
CREATE TABLE table_36393 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Series" text)
SELECT "Visitor" FROM table_36393 WHERE "Series" = 'series tied 2–2'
Name the District which has a Reserved for ( SC / ST /None) of sc?
CREATE TABLE table_name_94 (district VARCHAR,reserved_for___sc___st__none_ VARCHAR)
SELECT district FROM table_name_94 WHERE reserved_for___sc___st__none_ = "sc"
Name how ashtagrama lyers say it for engal veetil, engal agathil
CREATE TABLE table_67100 ("Pure Tamil" text,"How Ashtagrama Iyers say it" text,"How other Iyers say it" text,"How other Tamils say it" text,"English Meaning" text)
SELECT "How Ashtagrama Iyers say it" FROM table_67100 WHERE "Pure Tamil" = 'engal veetil, engal agathil'
what is admission time and diagnoses short title of subject id 98220?
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 demographic.admittime, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "98220"
What County has an Opposition of Antrim and the Player Bernie Forde?
CREATE TABLE table_63289 ("Rank" real,"Player" text,"County" text,"Tally" text,"Total" real,"Opposition" text)
SELECT "County" FROM table_63289 WHERE "Opposition" = 'antrim' AND "Player" = 'bernie forde'
What was the U.S birthstone in the 15th-20th century when in 2013 it was amethyst?
CREATE TABLE table_62329 ("Month" text,"15th- 20th century" text,"U.S. (1912)" text,"U.S. (2013)" text,"Britain (2013)" text,"Hindu" text)
SELECT "15th- 20th century" FROM table_62329 WHERE "U.S. (2013)" = 'amethyst'
tell me the monthly minimum amount of prismasate in patient 11362's body since 05/2104?
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 labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE inputevents_cv (row_...
SELECT MIN(inputevents_cv.amount) 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 = 11362)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.lab...
Which state has a Term in office of 1984 1996, a Party of labor, and a Member of robert tickner?
CREATE TABLE table_68661 ("Member" text,"Party" text,"Electorate" text,"State" text,"Term in office" text)
SELECT "State" FROM table_68661 WHERE "Term in office" = '1984–1996' AND "Party" = 'labor' AND "Member" = 'robert tickner'
Which country had a score of 72-67=139?
CREATE TABLE table_8921 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Country" FROM table_8921 WHERE "Score" = '72-67=139'
Who are the Runner(s)-up with a Margin of 1 stroke?
CREATE TABLE table_39383 ("Year" real,"Championship" text,"54 holes" text,"Winning score" text,"Margin" text,"Runner(s)-up" text)
SELECT "Runner(s)-up" FROM table_39383 WHERE "Margin" = '1 stroke'
count the numbers of patients who died after having been diagnosed with stroke within the same hospital visit until 2 years ago.
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE treatment (treatmentid number,patientunitstayid ...
SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT t1.uniquepid, t1.diagnosistime, t1.patienthealthsystemstayid FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = ...
list airfares for FIRST class round trip from DETROIT to ST. PETERSBURG
CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)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 city (city_code varchar,city_name varchar,state_code varc...
SELECT DISTINCT fare.fare_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 (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DETROIT' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AN...
Which player had a To par of +11?
CREATE TABLE table_name_55 (player VARCHAR,to_par VARCHAR)
SELECT player FROM table_name_55 WHERE to_par = "+11"
how many patients of black/african american ethnicity are admitted before the year 2178?
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 procedures (subject_id text,hadm_id text,icd9_code text,sho...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND demographic.admityear < "2178"
What nation started in lane 3 of heat 2?
CREATE TABLE table_name_78 (nationality VARCHAR,heat VARCHAR,lane VARCHAR)
SELECT nationality FROM table_name_78 WHERE heat = 2 AND lane = 3
What is the total for the person with 73.28 bodyweight and fewer snatches than 75?
CREATE TABLE table_name_22 (total__kg_ INTEGER,bodyweight VARCHAR,snatch VARCHAR)
SELECT AVG(total__kg_) FROM table_name_22 WHERE bodyweight = 73.28 AND snatch < 75
Name the nationality for d
CREATE TABLE table_51806 ("Round" real,"Player" text,"Position" text,"Nationality" text,"College/Junior/Club Team (League)" text)
SELECT "Nationality" FROM table_51806 WHERE "Position" = 'd'
What is the highest Pick # for the College of Maryland-Eastern Shore?
CREATE TABLE table_69046 ("Round" real,"Pick #" real,"Overall" real,"Name" text,"Position" text,"College" text)
SELECT MAX("Pick #") FROM table_69046 WHERE "College" = 'maryland-eastern shore'
What is the ICT when education is 1.73 and KI is ag 1.99?
CREATE TABLE table_23050383_1 (ict VARCHAR,education VARCHAR,ki VARCHAR)
SELECT ict FROM table_23050383_1 WHERE education = "1.73" AND ki = "1.99"
What was the final score of the game at the astrodome?
CREATE TABLE table_69275 ("Date" text,"Visiting Team" text,"Final Score" text,"Host Team" text,"Stadium" text)
SELECT "Final Score" FROM table_69275 WHERE "Stadium" = 'astrodome'
Who were all the candidates in elections in which Steve Chabot was a candidate?
CREATE TABLE table_1801 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Results" text,"Candidates" text)
SELECT "Candidates" FROM table_1801 WHERE "Incumbent" = 'Steve Chabot'
did patient 021-32860 undergo any procedures in the last year?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,tempe...
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-32860')) AND DATETIME(treatment.treatmenttime, 'start of year') = DATETI...
For all organizations that have grants of more than 6000 dollars, compare the number of details of the organizations with a bar chart, display in asc by the bars.
CREATE TABLE Organisations (organisation_id INTEGER,organisation_type VARCHAR(10),organisation_details VARCHAR(255))CREATE TABLE Projects (project_id INTEGER,organisation_id INTEGER,project_details VARCHAR(255))CREATE TABLE Organisation_Types (organisation_type VARCHAR(10),organisation_type_description VARCHAR(255))CRE...
SELECT organisation_details, COUNT(organisation_details) FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id GROUP BY organisation_details ORDER BY organisation_details
How many fb players were drafted?
CREATE TABLE table_16401 ("Pick #" real,"CFL Team" text,"Player" text,"Position" text,"College" text)
SELECT COUNT("Pick #") FROM table_16401 WHERE "Position" = 'FB'
What were the wounded for complement of 46 off 656 men?
CREATE TABLE table_17195 ("Unit" text,"Commander" text,"Complement" text,"Killed" text,"Wounded" text,"Missing" text)
SELECT "Wounded" FROM table_17195 WHERE "Complement" = '46 off 656 men'
Who were the Brazil scorers who scored 3-3?
CREATE TABLE table_43415 ("Date" text,"Result" text,"Score" text,"Brazil scorers" text,"Competition" text)
SELECT "Brazil scorers" FROM table_43415 WHERE "Score" = '3-3'
What is the average heat that has 52.83 sb mark and lane less than 4?
CREATE TABLE table_8897 ("Heat" real,"Lane" real,"Name" text,"Country" text,"Mark" text)
SELECT AVG("Heat") FROM table_8897 WHERE "Mark" = '52.83 sb' AND "Lane" < '4'