instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of last_name and commission_pct , show x axis in desc order. | CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE 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 job_history... | SELECT LAST_NAME, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY LAST_NAME DESC |
For those products with a price between 60 and 120, return a scatter chart about the correlation between code and manufacturer . | CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL) | SELECT Code, Manufacturer FROM Products WHERE Price BETWEEN 60 AND 120 |
Name the place for ed oliver | CREATE TABLE table_name_47 (place VARCHAR,player VARCHAR) | SELECT place FROM table_name_47 WHERE player = "ed oliver" |
Just show the id and name of each editor using a bar chart. | CREATE TABLE journal_committee (Editor_ID int,Journal_ID int,Work_Type text)CREATE TABLE journal (Journal_ID int,Date text,Theme text,Sales int)CREATE TABLE editor (Editor_ID int,Name text,Age real) | SELECT T1.Name, T1.Editor_ID FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID |
nursing mothers | CREATE TABLE table_train_261 ("id" int,"allergy_to_biological_products" bool,"renal_disease" bool,"bursing_mothers" bool,"metabolic_bone_disease" bool,"liver_disease" bool,"allergy_to_drug" bool,"alcohol_abuse" bool,"drug_abuse" bool,"NOUSE" float) | SELECT * FROM table_train_261 WHERE bursing_mothers = 1 |
I want the venue for 23 july 1992 | CREATE TABLE table_51850 ("Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text) | SELECT "Venue" FROM table_51850 WHERE "Date" = '23 july 1992' |
Is 182 not a requirement for any of the upper level classes ? | CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE course (course_id int,name varchar,department varchar,number varchar,credits varchar,advisory_requirement varchar,enforced_requirement varchar,description varchar,num_semesters int,num_enrolled int,has_d... | SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%topic0%' OR name LIKE '%topic0%') AND department = 'EECS' |
Give the number of patients that survived and had a procedure icd9 code of 3995. | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,sho... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.icd9_code = "3995" |
What is Run 2, when Run 1 is 2:09.09? | CREATE TABLE table_name_84 (run_2 VARCHAR,run_1 VARCHAR) | SELECT run_2 FROM table_name_84 WHERE run_1 = "2:09.09" |
Who was the original Japanese cast if Sean Barrett acted on the English (Manga UK) version? | CREATE TABLE table_2160215_1 (original_japanese VARCHAR,english___manga_uk__ VARCHAR) | SELECT original_japanese FROM table_2160215_1 WHERE english___manga_uk__ = "Sean Barrett" |
what is the result when the rank is 12? | CREATE TABLE table_name_13 (result VARCHAR,rank VARCHAR) | SELECT result FROM table_name_13 WHERE rank = 12 |
What is the hebrew word listed for strongs # 5418? | CREATE TABLE table_1242447_2 (hebrew_word VARCHAR,strongs__number VARCHAR) | SELECT hebrew_word FROM table_1242447_2 WHERE strongs__number = "5418" |
Which Game has a Score of w 90 82 (ot)? | CREATE TABLE table_5065 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "Game" FROM table_5065 WHERE "Score" = 'w 90–82 (ot)' |
Name the average place for ties less than 1 and losess more than 3 with points of 6 qc | CREATE TABLE table_32067 ("Place" real,"Team" text,"Wins" real,"Ties" real,"Losses" real,"Points" text) | SELECT AVG("Place") FROM table_32067 WHERE "Ties" < '1' AND "Points" = '6 qc' AND "Losses" > '3' |
Number of 13 that has what highest weight? | CREATE TABLE table_34596 ("Number" real,"Name" text,"Position" text,"Height" text,"Weight" real,"Class" text,"Hometown" text) | SELECT MAX("Weight") FROM table_34596 WHERE "Number" = '13' |
Name the score with record of 68-66 | CREATE TABLE table_70296 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Record" text) | SELECT "Score" FROM table_70296 WHERE "Record" = '68-66' |
show me the least expensive flight leaving MIAMI on sunday after 1200 and arriving CLEVELAND | CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time int,connections int,departure_time int,dual_carrier text,flight_days text,flight_id int,flight_number int,from_airport varchar,meal_code text,stops int,time_elapsed int,to_airport varchar)CREATE TABLE dual_carrier (ma... | SELECT DISTINCT FLIGHT_0.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, airport_service AS AIRPORT_SERVICE_3, city AS CITY_0, city AS CITY_1, city AS CITY_2, city AS CITY_3, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, date_day AS DATE... |
What was the score for the Essendon home team? | CREATE TABLE table_33605 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Home team score" FROM table_33605 WHERE "Home team" = 'essendon' |
What was the result when Ray Roberts was elected? | CREATE TABLE table_18381 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text) | SELECT "Result" FROM table_18381 WHERE "Incumbent" = 'Ray Roberts' |
What are the average league goals that have 2 (1) as the total apps? | CREATE TABLE table_name_18 (league_goals INTEGER,total_apps VARCHAR) | SELECT AVG(league_goals) FROM table_name_18 WHERE total_apps = "2 (1)" |
Get votes in the last X days. Helper query that grabs all vote instances in the last X days | CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByReviewTaskId number)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,... | SELECT * FROM Votes WHERE CreationDate >= CURRENT_TIMESTAMP() - @numDaysBegin |
how many patients are diagnosed for diabetes with neurological manifestations type i (juvenile type) and not stated as uncontrolled and lab tested with blood fluid ? | 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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Diabetes with neurological manifestations, type I [juvenile type], not stated as uncontrolled" AND lab.fluid = ... |
show me flights from SAN FRANCISCO to SEATTLE | CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE time_interval (period text,begin_time int,end_time int)CREATE TABLE city (city_code varchar,city_name varchar,state_code varchar,country_name varchar,time_zone_code varchar)CREATE TABLE airport_service (city... | 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, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = '... |
tell me the two year survival rate of patients who have been prescribed tetracycline hcl after they were diagnosed with crbl thrmbs w infrct? | 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 d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE d_items (row_id number,itemid number,label text,linksto ... | SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t4.charttime) > 2 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.subject_id, t2.charttime FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd... |
For those employees who did not have any job in the past, show me about the change of department_id over hire_date in a line 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 countries (COUNTRY_ID varchar(2),COUN... | SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) |
how many emergency hospital admission patients have coronary atherosclerosis of native coronary artery diagnoses? | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.short_title = "Crnry athrscl natve vssl" |
If finishes is 10, what is the POS minimum? | CREATE TABLE table_26009 ("Pos" real,"Constructor" text,"Chassis" text,"Starts" real,"Finishes" real,"Wins" real,"Podiums" real,"Stage wins" real,"Power stage wins" real,"Points" real) | SELECT MIN("Pos") FROM table_26009 WHERE "Finishes" = '10' |
What is the average wickets that have overs greater than 44, danish kaneria as the player, with an average greater than 13.8? | CREATE TABLE table_name_24 (wickets INTEGER,average VARCHAR,overs VARCHAR,player VARCHAR) | SELECT AVG(wickets) FROM table_name_24 WHERE overs > 44 AND player = "danish kaneria" AND average > 13.8 |
What is the number of films of each director? Return a pie chart. | CREATE TABLE schedule (Cinema_ID int,Film_ID int,Date text,Show_times_per_day int,Price float)CREATE TABLE film (Film_ID int,Rank_in_series int,Number_in_season int,Title text,Directed_by text,Original_air_date text,Production_code text)CREATE TABLE cinema (Cinema_ID int,Name text,Openning_year int,Capacity int,Locatio... | SELECT Directed_by, COUNT(Directed_by) FROM film GROUP BY Directed_by |
specify the type of admission of patient kelly gallardo | CREATE TABLE diagnoses (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 procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ... | SELECT demographic.admission_type FROM demographic WHERE demographic.name = "Kelly Gallardo" |
what were the top four medicines that were frequently prescribed until 4 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 t1.drugname FROM (SELECT medication.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM medication WHERE DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY medication.drugname) AS t1 WHERE t1.c1 <= 4 |
Which venue had an extra of Junior Race? | CREATE TABLE table_name_68 (venue VARCHAR,extra VARCHAR) | SELECT venue FROM table_name_68 WHERE extra = "junior race" |
What is the general classification when the team classification is japan? | CREATE TABLE table_name_18 (general_classification VARCHAR,team_classification VARCHAR) | SELECT general_classification FROM table_name_18 WHERE team_classification = "japan" |
What is the least amount of wins when against is 1314? | CREATE TABLE table_name_41 (wins INTEGER,against VARCHAR) | SELECT MIN(wins) FROM table_name_41 WHERE against = 1314 |
when did patient 95057's first lab test take place in 12/this year? | 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 transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREA... | SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 95057) AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', labevents.charttime) = '12' ORDER BY labevents... |
What is the total number of FA trophies of player Neil Grayson, who has more than 2 FA cups and a league greater than 17? | CREATE TABLE table_7388 ("Player" text,"Club" text,"League" real,"FA Cup" real,"FA Trophy" real,"League Cup" real,"Total" real) | SELECT COUNT("FA Trophy") FROM table_7388 WHERE "FA Cup" > '2' AND "Player" = 'neil grayson' AND "League" > '17' |
Which Visa 3 has a Visa 1 of michael mcglinchey? | CREATE TABLE table_14339 ("Club" text,"Visa 1" text,"Visa 2" text,"Visa 3" text,"Visa 4" text,"Visa 5" text) | SELECT "Visa 3" FROM table_14339 WHERE "Visa 1" = 'michael mcglinchey' |
What is the id of the event with the most participants? | CREATE TABLE services (service_id number,service_type_code text)CREATE TABLE participants_in_events (event_id number,participant_id number)CREATE TABLE events (event_id number,service_id number,event_details text)CREATE TABLE participants (participant_id number,participant_type_code text,participant_details text) | SELECT event_id FROM participants_in_events GROUP BY event_id ORDER BY COUNT(*) DESC LIMIT 1 |
find the number of patients born before 1821 who belong to black/african american ethnic background. | 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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND demographic.dob_year < "1821" |
How many Red Breasted Nuthatch coins created before 2007 were minted, on average? | CREATE TABLE table_name_42 (mintage INTEGER,animal VARCHAR,year VARCHAR) | SELECT AVG(mintage) FROM table_name_42 WHERE animal = "red breasted nuthatch" AND year < 2007 |
Which Winners is the highest one that has a Rank larger than 7, and a Third smaller than 1? | CREATE TABLE table_76489 ("Rank" real,"Club" text,"Winners" real,"Runners-up" real,"Third" real) | SELECT MAX("Winners") FROM table_76489 WHERE "Rank" > '7' AND "Third" < '1' |
Who participated in the Mixed Doubles when Tracey Hallam participated in the Women's Singles? | CREATE TABLE table_71162 ("Year" real,"Men's singles" text,"Women's singles" text,"Women's doubles" text,"Mixed doubles" text) | SELECT "Mixed doubles" FROM table_71162 WHERE "Women's singles" = 'tracey hallam' |
2D Histogram of question score vs. highest voted answer score. | CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class number,TagBased boolean)CREATE TABLE Tags (... | SELECT sel.Idx, COUNT(*) AS "occurence" FROM (SELECT (q.Score - '##S1##') * @NS + (a.Score - '##S1##') AS "idx" FROM Posts AS q INNER JOIN (SELECT DISTINCT a.ParentId, MAX(a.Score) AS "score" FROM Posts AS a WHERE a.PostTypeId = 2 AND a.Score >= '##S1##' AND a.Score < '##S2##' GROUP BY a.ParentId) AS a ON q.Id = a.Pare... |
In zip code 94107, on which day neither Fog nor Rain was not observed? | CREATE TABLE status (station_id number,bikes_available number,docks_available number,time text)CREATE TABLE station (id number,name text,lat number,long number,dock_count number,city text,installation_date text)CREATE TABLE trip (id number,duration number,start_date text,start_station_name text,start_station_id number,... | SELECT date FROM weather WHERE zip_code = 94107 AND events <> "Fog" AND events <> "Rain" |
What was the average points for someone who has played more than 10? | CREATE TABLE table_name_67 (points INTEGER,played INTEGER) | SELECT AVG(points) FROM table_name_67 WHERE played > 10 |
High-Scoring Questions with Authors (Tutorial). | 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,LastEditorUserId number,LastEditorDisplayName text,LastEditDate time,LastActivityDate time,Title text,Tags text,Ans... | SELECT p.PostId, p.TagId, t.Id, t.TagName FROM PostTags AS p JOIN Tags AS t ON p.TagId = t.Id |
What was T3 player Lee Janzen's score? | CREATE TABLE table_7823 ("Place" text,"Player" text,"Country" text,"Score" real,"To par" text) | SELECT MIN("Score") FROM table_7823 WHERE "Place" = 't3' AND "Player" = 'lee janzen' |
For each customer status code, how many customers are classified that way? | CREATE TABLE customers (customer_id number,customer_address_id number,customer_status_code text,date_became_customer time,date_of_birth time,first_name text,last_name text,amount_outstanding number,email_address text,phone_number text,cell_mobile_phone_number text)CREATE TABLE addresses (address_id number,line_1_number... | SELECT customer_status_code, COUNT(*) FROM customers GROUP BY customer_status_code |
Top 50 Sri Lankan Developers who are on Stackoverflow. | CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,Pare... | SELECT ROW_NUMBER() OVER (ORDER BY Users.Reputation DESC) AS "#", Users.Id AS "user_link", Users.Location, Users.Reputation, Users.UpVotes, Users.DownVotes, (SELECT COUNT(*) FROM Posts AS PQ WHERE PostTypeId = 1 AND PQ.OwnerUserId = Users.Id) AS "questions", (SELECT COUNT(*) FROM Posts AS PA WHERE PostTypeId = 2 AND PA... |
Number of posts over time for a tag. | CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate ti... | SELECT 'year/month', COUNT(1) FROM (SELECT CONCAT(YEAR(CreationDate), '/', RIGHT(CONCAT('00', MONTH(CreationDate)), 2)) AS "Year/Month" FROM Posts WHERE 'tags' LIKE '%g1ant%') AS a GROUP BY 'year/month' ORDER BY 'year/month' |
how many patients received the neurosurgery consultation after the antibacterials in the same month? | CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,observationtime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyna... | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'antibacterials') AS t1 JOIN (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient O... |
What is the score of the game with a record of 12 8 3? | CREATE TABLE table_69612 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text) | SELECT "Score" FROM table_69612 WHERE "Record" = '12–8–3' |
What percentage of closed questions are reopened. | CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId n... | SELECT (SELECT COUNT(*) FROM PostHistory WHERE PostHistoryTypeId = 10) AS closed, (SELECT COUNT(*) FROM PostHistory WHERE PostHistoryTypeId = 11) AS reopened |
Name the tournament for 2006 of a, 1996 of 1r and 2004 of 1r | CREATE TABLE table_6203 ("Tournament" text,"1992" text,"1993" text,"1994" text,"1995" text,"1996" text,"1997" text,"1998" text,"1999" text,"2000" text,"2001" text,"2002" text,"2003" text,"2004" text,"2005" text,"2006" text,"Career SR" text,"Career Win-Loss" text) | SELECT "Tournament" FROM table_6203 WHERE "2006" = 'a' AND "1996" = '1r' AND "2004" = '1r' |
What's the highest First Elected with a Result of Re-elected and DIstrict of California 5? | CREATE TABLE table_name_21 (first_elected INTEGER,result VARCHAR,district VARCHAR) | SELECT MAX(first_elected) FROM table_name_21 WHERE result = "re-elected" AND district = "california 5" |
Who is the shirt sponsor for the manufacturer Nike? | CREATE TABLE table_14670 ("Team" text,"Manager" text,"Captain" text,"Kit manufacturer" text,"Shirt sponsor" text) | SELECT "Shirt sponsor" FROM table_14670 WHERE "Kit manufacturer" = 'nike' |
Bar chart of the frequency from each receipt date, and bin the date in weekday interval, and then show y axis in asc order. | CREATE TABLE Circulation_History (document_id INTEGER,draft_number INTEGER,copy_number INTEGER,employee_id INTEGER)CREATE TABLE Documents_Mailed (document_id INTEGER,mailed_to_address_id INTEGER,mailing_date DATETIME)CREATE TABLE Documents (document_id INTEGER,document_status_code CHAR(15),document_type_code CHAR(15),s... | SELECT receipt_date, COUNT(receipt_date) FROM Documents ORDER BY COUNT(receipt_date) |
The episode with production code 693-002, has how many original airdates? | CREATE TABLE table_26982362_2 (original_airdate VARCHAR,production_code VARCHAR) | SELECT COUNT(original_airdate) FROM table_26982362_2 WHERE production_code = "693-002" |
Who was awarded the young ride classification leader when the winner was Marzio Bruseghin? | CREATE TABLE table_19526 ("Stage" real,"Winner" text,"General classification" text,"Points classification" text,"Mountains classification" text,"Young rider classification" text) | SELECT "Young rider classification" FROM table_19526 WHERE "Winner" = 'Marzio Bruseghin' |
Show me about the distribution of Team_Name and Team_ID in a bar chart. | CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,Enrollment real,Nickname text,Primary_conference text)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_Perce... | SELECT Team_Name, Team_ID FROM basketball_match |
What is the name and the average gpa of department whose students have the highest average gpa? | CREATE TABLE department (dept_name VARCHAR,dept_code VARCHAR)CREATE TABLE student (stu_gpa INTEGER,dept_code VARCHAR) | SELECT T2.dept_name, AVG(T1.stu_gpa) FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY AVG(T1.stu_gpa) DESC LIMIT 1 |
For the MDE program requirement , who teaches courses that fulfill it ? | CREATE TABLE student (student_id int,lastname varchar,firstname varchar,program_id int,declare_major varchar,total_credit int,total_gpa float,entered_as varchar,admit_term int,predicted_graduation_semester int,degree varchar,minor varchar,internship varchar)CREATE TABLE requirement (requirement_id int,requirement varch... | SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN course_offering ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN program_course ON program_course.course_id = course_offering.course_id INN... |
What is the lowest expenditures on R&D for Poland after 2011? | CREATE TABLE table_name_94 (_ppp__ VARCHAR,d__billions_of_us$_ VARCHAR,expenditures_on_r INTEGER,country_region VARCHAR,year VARCHAR) | SELECT MIN(expenditures_on_r) & d__billions_of_us$_, _ppp__ FROM table_name_94 WHERE country_region = "poland" AND year > 2011 |
Find all invoice dates corresponding to customers with first name Astrid and last name Gruber, and count them by a bar chart, I want to show by the total number from low to high please. | CREATE TABLE MediaType (MediaTypeId integer,Name varchar(120))CREATE TABLE Artist (ArtistId integer,Name varchar(120))CREATE TABLE Customer (CustomerId integer,FirstName varchar(40),LastName varchar(20),Company varchar(80),Address varchar(70),City varchar(40),State varchar(40),Country varchar(40),PostalCode varchar(10)... | SELECT InvoiceDate, COUNT(InvoiceDate) FROM Customer AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = "Astrid" AND LastName = "Gruber" ORDER BY COUNT(InvoiceDate) |
What is the largest n value for 55.6% r1b1c4 (r-v69)? | CREATE TABLE table_73307 ("Region" text,"Population" text,"Country" text,"Language" text,"N" real,"Total%" text,"R1b1c (R-V88)" text,"R1b1a2 (R-M269)" text,"R1b1c* (R-V88*)" text,"R1b1c4 (R-V69)" text) | SELECT MAX("N") FROM table_73307 WHERE "R1b1c4 (R-V69)" = '55.6%' |
Show the transaction types and the total amount of transactions, could you sort in ascending by the Y-axis? | CREATE TABLE Orders (order_id INTEGER,customer_id INTEGER,date_order_placed DATETIME,order_details VARCHAR(255))CREATE TABLE Order_Items (order_item_id INTEGER,order_id INTEGER,product_id INTEGER,product_quantity VARCHAR(50),other_order_item_details VARCHAR(255))CREATE TABLE Products (product_id INTEGER,parent_product_... | SELECT transaction_type, SUM(transaction_amount) FROM Financial_Transactions GROUP BY transaction_type ORDER BY SUM(transaction_amount) |
Who's the incumbent of Florida 12 district? | CREATE TABLE table_1341423_9 (incumbent VARCHAR,district VARCHAR) | SELECT incumbent FROM table_1341423_9 WHERE district = "Florida 12" |
what is the highest amount of passengers when there is a rank of 1? | CREATE TABLE table_41857 ("Rank" real,"Location" text,"Total Passengers" real,"Annual change" text,"Capacity in use" text) | SELECT MAX("Total Passengers") FROM table_41857 WHERE "Rank" = '1' |
What Surface has a Tournament of pune, india? | CREATE TABLE table_name_61 (surface VARCHAR,tournament VARCHAR) | SELECT surface FROM table_name_61 WHERE tournament = "pune, india" |
Find the number of classes offered for all class rooms that held at least 2 classes. | CREATE TABLE CLASS (class_room VARCHAR) | SELECT COUNT(*), class_room FROM CLASS GROUP BY class_room HAVING COUNT(*) >= 2 |
A bar chart for finding the number of the first name of students who are living in the Smith Hall, and show by the Fname in asc please. | CREATE TABLE Has_amenity (dormid INTEGER,amenid INTEGER)CREATE TABLE Dorm_amenity (amenid INTEGER,amenity_name VARCHAR(25))CREATE TABLE Lives_in (stuid INTEGER,dormid INTEGER,room_number INTEGER)CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTE... | SELECT Fname, COUNT(Fname) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid JOIN Dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' GROUP BY Fname ORDER BY Fname |
What artist had a single called Alien Rock b/w Combat, The Remix on 12 inch Vinyl format? | CREATE TABLE table_name_82 (artist VARCHAR,format VARCHAR,single VARCHAR) | SELECT artist FROM table_name_82 WHERE format = "12 inch vinyl" AND single = "alien rock b/w combat, the remix" |
What Willingshain is Kirchheim 1,126? | CREATE TABLE table_name_71 (willingshain VARCHAR,kirchheim VARCHAR) | SELECT willingshain FROM table_name_71 WHERE kirchheim = "1,126" |
How many wins had a win percentage of 0.667 | CREATE TABLE table_19839391_3 (wins VARCHAR,winning__percentage VARCHAR) | SELECT wins FROM table_19839391_3 WHERE winning__percentage = "0.667" |
The total number of questions asked so far vs. time?. http://meta.stackexchange.com/questions/248396/how-can-i-get-stats-for-the-total-number-of-questions-asked-so-far-vs-time | CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE ... | SELECT DATEADD(d, days, @lowest) AS "date", SUM(qcnt) OVER (ORDER BY days) AS Questions, SUM(acnt) OVER (ORDER BY days) AS Answers FROM (SELECT DATEDIFF(m, @lowest, creationdate) AS days, SUM(CASE WHEN PostTypeId = 1 THEN 1 ELSE 0 END) AS qcnt, SUM(CASE WHEN PostTypeId = 2 THEN 1 ELSE 0 END) AS acnt FROM Posts WHERE Cr... |
Show the working years of managers in descending order of their level, and count them by a bar chart | CREATE TABLE railway (Railway_ID int,Railway text,Builder text,Built text,Wheels text,Location text,ObjectNumber text)CREATE TABLE train (Train_ID int,Train_Num text,Name text,From text,Arrival text,Railway_ID int)CREATE TABLE railway_manage (Railway_ID int,Manager_ID int,From_Year text)CREATE TABLE manager (Manager_ID... | SELECT Working_year_starts, COUNT(Working_year_starts) FROM manager ORDER BY Level DESC |
When Alberto Contador Kanstantsin Sivtsov was the general classification and Alessandro Petacchi was the points classification at the same time while Mark Cavendish is the winner, who was the mountain classification? | CREATE TABLE table_28538368_2 (mountains_classification VARCHAR,winner VARCHAR,general_classification VARCHAR,points_classification VARCHAR) | SELECT mountains_classification FROM table_28538368_2 WHERE general_classification = "Alberto Contador Kanstantsin Sivtsov" AND points_classification = "Alessandro Petacchi" AND winner = "Mark Cavendish" |
Who was the Ole Miss player associated with Chuck Dicus? | CREATE TABLE table_name_65 (ole_miss VARCHAR,arkansas VARCHAR) | SELECT ole_miss FROM table_name_65 WHERE arkansas = "chuck dicus" |
While the original 1st us tour cast included nicci claspell, who was in the original tokyo/seoul tour cast? | CREATE TABLE table_24353141_1 (original_tokyo___seoul_tour_cast VARCHAR,original_1st_us_tour_cast VARCHAR) | SELECT original_tokyo___seoul_tour_cast FROM table_24353141_1 WHERE original_1st_us_tour_cast = "Nicci Claspell" |
What is the IHSAA Class for a school in Munster with an enrollment of 1,206? | CREATE TABLE table_14077 ("School" text,"Location" text,"Mascot" text,"Enrollment" real,"IHSAA Class" text,"# / County" text) | SELECT "IHSAA Class" FROM table_14077 WHERE "Enrollment" > '1,206' AND "Location" = 'munster' |
what is the average cost of a hospital bill that includes a drug called metoclopramide hcl since 2 years ago? | CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiasto... | 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 medication.patientunitstayid FROM medication WHERE medication.drugname = 'metoclopramide hcl')) AND DATETIME(cost.charge... |
What would be the 4 credits result of a straight? | CREATE TABLE table_name_28 (hand VARCHAR) | SELECT 4 AS _credits FROM table_name_28 WHERE hand = "straight" |
whats the last height of patient 005-80291 until 10/2105? | CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,syst... | SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-80291') AND NOT patient.admissionheight IS NULL AND STRFTIME('%y-%m', patient.unitadmittime) <= '2105-10' ORDER BY patient.unitadmittime DESC LIMIT... |
What was the surface of the score of 7 5, 3 6, 7 6? | CREATE TABLE table_name_58 (surface VARCHAR,score VARCHAR) | SELECT surface FROM table_name_58 WHERE score = "7–5, 3–6, 7–6" |
Name the home team for manuka oval | CREATE TABLE table_19239 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Ground" text,"Crowd" real,"Date" text,"Report" text) | SELECT "Home team" FROM table_19239 WHERE "Ground" = 'Manuka Oval' |
What is the home team of the UEFA cup in the 2000-2001 season with a second round? | CREATE TABLE table_name_93 (home VARCHAR,round VARCHAR,competition VARCHAR,season VARCHAR) | SELECT home FROM table_name_93 WHERE competition = "uefa cup" AND season = "2000-2001" AND round = "second round" |
What are the number of the names of catalog entries with level number 8?, and order names in ascending order. | CREATE TABLE Catalog_Contents_Additional_Attributes (catalog_entry_id INTEGER,catalog_level_number INTEGER,attribute_id INTEGER,attribute_value VARCHAR(255))CREATE TABLE Catalog_Contents (catalog_entry_id INTEGER,catalog_level_number INTEGER,parent_entry_id INTEGER,previous_entry_id INTEGER,next_entry_id INTEGER,catalo... | SELECT catalog_entry_name, COUNT(catalog_entry_name) FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = "8" GROUP BY catalog_entry_name ORDER BY catalog_entry_name |
what song on prophets vs. profits has no producer ? | CREATE TABLE table_203_37 (id number,"#" number,"title" text,"producer(s)" text,"performer(s)" text,"length" text) | SELECT "title" FROM table_203_37 WHERE "producer(s)" IS NULL |
What are the dates that have an average sea level pressure between 30.3 and 31, and count them by a bar chart | CREATE TABLE weather (date TEXT,max_temperature_f INTEGER,mean_temperature_f INTEGER,min_temperature_f INTEGER,max_dew_point_f INTEGER,mean_dew_point_f INTEGER,min_dew_point_f INTEGER,max_humidity INTEGER,mean_humidity INTEGER,min_humidity INTEGER,max_sea_level_pressure_inches NUMERIC,mean_sea_level_pressure_inches NUM... | SELECT date, COUNT(date) FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31 |
What are the notes for 6:31.16? | CREATE TABLE table_62946 ("Rank" real,"Rowers" text,"Country" text,"Time" text,"Notes" text) | SELECT "Notes" FROM table_62946 WHERE "Time" = '6:31.16' |
If the points were 0, what were the tries for? | CREATE TABLE table_name_65 (tries_for VARCHAR,points_for VARCHAR) | SELECT tries_for FROM table_name_65 WHERE points_for = "0" |
What city has a Result of brisbane broncos def. halifax blue sox? | CREATE TABLE table_name_22 (city VARCHAR,result VARCHAR) | SELECT city FROM table_name_22 WHERE result = "brisbane broncos def. halifax blue sox" |
what procedure did patient 57023 receive that last time this year? | CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE ... | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT procedures_icd.icd9_code FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 57023) AND DATETIME(procedures_icd.charttime, 'start of year') = DAT... |
Show all distinct product categories along with the number of mailshots in each category in a bar chart, and list Y-axis from low to high order. | CREATE TABLE Customer_Orders (order_id INTEGER,customer_id INTEGER,order_status_code VARCHAR(15),shipping_method_code VARCHAR(15),order_placed_datetime DATETIME,order_delivered_datetime DATETIME,order_shipping_charges VARCHAR(255))CREATE TABLE Mailshot_Customers (mailshot_id INTEGER,customer_id INTEGER,outcome_code VAR... | SELECT product_category, COUNT(*) FROM Mailshot_Campaigns GROUP BY product_category ORDER BY COUNT(*) |
Occupational pensions of 7%, and a Working tax credit of 2%, and a Other social security benefits of 6% has what investment income? | CREATE TABLE table_35397 ("Region" text,"Employment (salaries & wages)" text,"Self employed" text,"Investment income" text,"Working tax credit" text,"State pensions" text,"Occupational pensions" text,"Disability benefits" text,"Other social security benefits" text,"Other income sources" text) | SELECT "Investment income" FROM table_35397 WHERE "Occupational pensions" = '7%' AND "Working tax credit" = '2%' AND "Other social security benefits" = '6%' |
What is the 4.45 for Yelena Isinbayeva? | CREATE TABLE table_name_5 (name VARCHAR) | SELECT 445 FROM table_name_5 WHERE name = "yelena isinbayeva" |
Group by services attribute in station table and compute the total number of services with a bar chart, display x-axis from high to low order please. | CREATE TABLE train (id int,train_number int,name text,origin text,destination text,time text,interval text)CREATE TABLE route (train_id int,station_id int)CREATE TABLE station (id int,network_name text,services text,local_authority text)CREATE TABLE weekly_weather (station_id int,day_of_week text,high_temperature int,l... | SELECT services, COUNT(services) FROM station GROUP BY services ORDER BY services DESC |
which players played the same position as ardo kreek ? | CREATE TABLE table_203_116 (id number,"no." number,"player" text,"birth date" text,"weight" number,"height" number,"position" text,"current club" text) | SELECT "player" FROM table_203_116 WHERE "player" <> 'ardo kreek' AND "position" = (SELECT "position" FROM table_203_116 WHERE "player" = 'ardo kreek') |
What is Michael Stewart's school or club team? | CREATE TABLE table_31926 ("Player" text,"Nationality" text,"Position" text,"Years in Toronto" text,"School/Club Team" text) | SELECT "School/Club Team" FROM table_31926 WHERE "Player" = 'michael stewart' |
What was the final score when the Maple Leafs played the Columbus Blue Jackets? | CREATE TABLE table_16864968_7 (score VARCHAR,opponent VARCHAR) | SELECT score FROM table_16864968_7 WHERE opponent = "Columbus Blue Jackets" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.