instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
find the number of patients with st elevated myocardial infarction/cardiac catheterization primary disease who have procedure icd9 code 2219. | CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND procedures.icd9_code = "2219" |
Highest upvote of question, answer. | CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCou... | SELECT P.Id AS "post_link", R.MaxScore, R.PostType FROM Posts AS P INNER JOIN (SELECT MAX(PO.Score) AS MaxScore, PT.Name AS PostType FROM Posts AS PO INNER JOIN PostTypes AS PT ON PT.Id = PO.PostTypeId AND PT.Id IN (1, 2) WHERE PO.DeletionDate IS NULL GROUP BY PT.Name) AS R ON R.MaxScore = P.Score |
how many singles were released after 2010 ? | CREATE TABLE table_203_491 (id number,"year" number,"title" text,"us hot 100" number,"us modern rock" number,"us mainstream rock" number,"album" text) | SELECT COUNT("title") FROM table_203_491 WHERE "year" > 2010 |
how many releases are there in all months of june ? | CREATE TABLE table_204_209 (id number,"released" text,"title" text,"label" text,"number" text,"notes" text) | SELECT COUNT(*) FROM table_204_209 WHERE "released" = 6 |
Who's average is 24.8? | CREATE TABLE table_16912000_13 (player VARCHAR,kr_avg VARCHAR) | SELECT player FROM table_16912000_13 WHERE kr_avg = "24.8" |
Show me the trend aboutthe maximum score of wines for each year. | CREATE TABLE grapes (ID INTEGER,Grape TEXT,Color TEXT)CREATE TABLE wine (No INTEGER,Grape TEXT,Winery TEXT,Appelation TEXT,State TEXT,Name TEXT,Year INTEGER,Price INTEGER,Score INTEGER,Cases INTEGER,Drink TEXT)CREATE TABLE appellations (No INTEGER,Appelation TEXT,County TEXT,State TEXT,Area TEXT,isAVA TEXT) | SELECT Year, MAX(Score) FROM wine GROUP BY Year |
What Time has Ad Freq of 15 minutes, and a Show Name of country today? | CREATE TABLE table_78993 ("Time" text,"Show Name" text,"Local/Networked" text,"Ad Freq" text,"News Freq" text) | SELECT "Time" FROM table_78993 WHERE "Ad Freq" = '15 minutes' AND "Show Name" = 'country today' |
what flights are there from DALLAS to PITTSBURGH on monday morning | CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE dual_carrier (main_airline varchar,low_flight_n... | 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, date_day, days, flight WHERE (((flight.departure_time BETWEEN 0 AND 1200) AND date_day.day_number = 21 AND date_day.month_number = 2 AND date_day.year = 1991 AND days.day_nam... |
Name the most goals for josep samitier | CREATE TABLE table_name_8 (goals INTEGER,name VARCHAR) | SELECT MAX(goals) FROM table_name_8 WHERE name = "josep samitier" |
what was the drug that until 28 months ago patient 26218 had been prescribed two times? | CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)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)C... | SELECT t1.drug FROM (SELECT prescriptions.drug, COUNT(prescriptions.startdate) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26218) AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-28 month') GROUP BY prescriptions.dru... |
what's party with district being tennessee 3 | CREATE TABLE table_18408 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text) | SELECT "Party" FROM table_18408 WHERE "District" = 'Tennessee 3' |
For all employees who have the letters D or S in their first name, give me the trend about manager_id over hire_date , display HIRE_DATE from low to high order. | 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 regions (REGION_ID decimal(5,0),REGIO... | SELECT HIRE_DATE, MANAGER_ID FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE |
What is the Score, when the Year is after 2007, and when the Country is England? | CREATE TABLE table_14571 ("Year" real,"Venue" text,"Winner" text,"Country" text,"Score" text) | SELECT "Score" FROM table_14571 WHERE "Year" > '2007' AND "Country" = 'england' |
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of job_id and manager_id , list by the Y-axis from low to high please. | CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))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)... | SELECT JOB_ID, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY MANAGER_ID |
How many maac are there that have 14th as the ncaa and the overall is 20-10? | CREATE TABLE table_21756039_1 (maac VARCHAR,ncaa_seed VARCHAR,overall VARCHAR) | SELECT COUNT(maac) FROM table_21756039_1 WHERE ncaa_seed = "14th" AND overall = "20-10" |
What is the relationship between ID and meter_100 ? | CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year int)CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text... | SELECT ID, meter_100 FROM swimmer |
Class of 125cc, and a Year smaller than 1966 had what lowest wins? | CREATE TABLE table_34659 ("Year" real,"Class" text,"Team" text,"Points" real,"Wins" real) | SELECT MIN("Wins") FROM table_34659 WHERE "Class" = '125cc' AND "Year" < '1966' |
what song hit the highest spot on the uk chart ? | CREATE TABLE table_204_654 (id number,"year" number,"song" text,"u.s." number,"u.s.\nr&b" number,"u.s.\nac" number,"uk" number,"album" text) | SELECT "song" FROM table_204_654 ORDER BY "uk" LIMIT 1 |
What is the average Total Freshwater Withdrawal (km 3 /yr), when Industrial Use (m 3 /p/yr)(in %) is 337(63%), and when Per Capita Withdrawal (m 3 /p/yr) is greater than 535? | CREATE TABLE table_name_5 (total_freshwater_withdrawal__km_3__yr_ INTEGER,industrial_use__m_3__p_yr__in__percentage_ VARCHAR,per_capita_withdrawal__m_3__p_yr_ VARCHAR) | SELECT AVG(total_freshwater_withdrawal__km_3__yr_) FROM table_name_5 WHERE industrial_use__m_3__p_yr__in__percentage_ = "337(63%)" AND per_capita_withdrawal__m_3__p_yr_ > 535 |
What venue has the away side scoring 15.23 (113)? | CREATE TABLE table_32371 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Venue" FROM table_32371 WHERE "Away team score" = '15.23 (113)' |
What's the losing bonus of Crumlin RFC? | CREATE TABLE table_74946 ("Club" text,"Played" text,"Drawn" text,"Lost" text,"Points for" text,"Points against" text,"Tries for" text,"Tries against" text,"Try bonus" text,"Losing bonus" text,"Points" text) | SELECT "Losing bonus" FROM table_74946 WHERE "Club" = 'crumlin rfc' |
Give id of the instructor who advises students in the History department. | CREATE TABLE course (course_id text,title text,dept_name text,credits number)CREATE TABLE section (course_id text,sec_id text,semester text,year number,building text,room_number text,time_slot_id text)CREATE TABLE department (dept_name text,building text,budget number)CREATE TABLE instructor (id text,name text,dept_nam... | SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id = T2.id WHERE T2.dept_name = 'History' |
Date of wed. nov. 13 had how many number of games? | CREATE TABLE table_name_1 (game VARCHAR,date VARCHAR) | SELECT COUNT(game) FROM table_name_1 WHERE date = "wed. nov. 13" |
How many female patients had a thyroxine (t4) lab test done? | CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.gender = "F" AND lab.label = "Thyroxine (T4)" |
Give me the comparison about All_Games_Percent over the All_Neutral by a bar chart, and rank total number in ascending order. | 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 All_Neutral, All_Games_Percent FROM basketball_match ORDER BY All_Games_Percent |
what is the maximum age of male patients who stayed in hospital for 5 days? | 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 MAX(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.days_stay = "5" |
how many patients primarily have bowel obstruction and were admitted before the year 2203? | CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,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.diagnosis = "BOWEL OBSTRUCTION" AND demographic.admityear < "2203" |
list the top three most frequently prescribed drugs that patients were prescribed with in the same hospital encounter after they were prescribed with 10 ml vial : insulin glargine 100 unit/ml sc soln. | CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature ... | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime, patient.patienthealthsystemstayid FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = '10 ml vial : ins... |
how many patients had gentamicin lab test? | CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag text,admission_location text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "Gentamicin" |
How many people attended the game in week 13? | CREATE TABLE table_43025 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" text) | SELECT "Attendance" FROM table_43025 WHERE "Week" = '13' |
what flight from DENVER to PITTSBURGH arrives earliest in the morning | CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion varchar,wide_body varchar,wing_span int,length int,weight int,capacity int,pay_load int,cruising_speed int,range_miles int,pressurized varchar)CREATE TABLE food_service (meal_code tex... | 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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND flight.arrival_time = (SELECT MIN(FLIGHTalias1.arrival_time) FROM airport... |
My Highest Rated Comments with CreationDate. | CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId numbe... | SELECT PostId AS "post_link", Score, Text, CreationDate FROM Comments WHERE UserId = '##UserId##' ORDER BY Score DESC LIMIT 250 |
What town has the population of 777? | CREATE TABLE table_2562572_39 (cyrillic_name_other_names VARCHAR,population__2011_ VARCHAR) | SELECT cyrillic_name_other_names FROM table_2562572_39 WHERE population__2011_ = "777" |
What is the rank of the swimmer named Petria Thomas? | CREATE TABLE table_68383 ("Rank" real,"Lane" real,"Name" text,"Nationality" text,"Time" text) | SELECT "Rank" FROM table_68383 WHERE "Name" = 'petria thomas' |
If you compared EECS 453 and EECS 592 , which would you consider to be least difficult ? | CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE gsi (course_offering_id int,student_id int)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_... | SELECT DISTINCT course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (course.number = 453 OR course.number = 592) AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 INNER JOIN course AS COURSEalias1 ON ... |
who was the opponent previous to the south georgia wildcats ? | CREATE TABLE table_204_644 (id number,"week" number,"date" text,"opponent" text,"result" text,"record" text,"game site" text,"bye" text) | SELECT "opponent" FROM table_204_644 WHERE "date" < (SELECT "date" FROM table_204_644 WHERE "opponent" = 'south georgia wildcats') ORDER BY "date" DESC LIMIT 1 |
When 44 is the col in meters what is the country? | CREATE TABLE table_18946749_1 (country VARCHAR,col__m_ VARCHAR) | SELECT country FROM table_18946749_1 WHERE col__m_ = 44 |
Who is the home team with tie number 9? | CREATE TABLE table_50842 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text) | SELECT "Home team" FROM table_50842 WHERE "Tie no" = '9' |
thanks and what 's the last flight back from WASHINGTON to BOSTON | CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion varchar,wide_body varchar,wing_span int,length int,weight int,capacity int,pay_load int,cruising_speed int,range... | 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 = 'WASHINGTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BO... |
how much patient 76372 had to pay for their stay in hospital on this hospital encounter? | CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)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)C... | SELECT SUM(cost.cost) FROM cost WHERE cost.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 76372 AND admissions.dischtime IS NULL) |
how many english speaking patients had the procedure titled closed biopsy of skin and subcutaneous tissue? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.language = "ENGL" AND procedures.long_title = "Closed biopsy of skin and subcutaneous tissue" |
When against is 797 and wins is more than 10, what is the sum of draws? | CREATE TABLE table_name_28 (draws VARCHAR,against VARCHAR,wins VARCHAR) | SELECT COUNT(draws) FROM table_name_28 WHERE against = 797 AND wins > 10 |
what is march 27-29 when november 3 is 133? | CREATE TABLE table_25355392_2 (march_27_29 VARCHAR,november_3 VARCHAR) | SELECT march_27_29 FROM table_25355392_2 WHERE november_3 = "133" |
What was the result in the event 1 medley for the man with a 4 (6 in 31.85s) in the event 3 squat lift? | CREATE TABLE table_3031 ("Position" text,"Name" text,"Nationality" text,"Event 1 Medley" text,"Event 2 Truck Pull" text,"Event 3 Squat Lift" text,"Event 4 Carwalk" text,"Event 5 Dumbbell Press" text,"Event 6 Atlas Stones" text) | SELECT "Event 1 Medley" FROM table_3031 WHERE "Event 3 Squat Lift" = '4 (6 in 31.85s)' |
What is the rank with a higher than 2 total, 21 gold and more than 12 bronze? | CREATE TABLE table_name_18 (rank INTEGER,bronze VARCHAR,total VARCHAR,gold VARCHAR) | SELECT AVG(rank) FROM table_name_18 WHERE total > 2 AND gold = 21 AND bronze > 12 |
Find the total access count of all documents in the most popular document type. | CREATE TABLE roles (role_code text,role_description text)CREATE TABLE document_sections_images (section_id number,image_id number)CREATE TABLE functional_areas (functional_area_code text,parent_functional_area_code text,functional_area_description text)CREATE TABLE documents (document_code text,document_structure_code ... | SELECT SUM(access_count) FROM documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 1 |
did he act longer on sinndoor tere naam ka or saat phere ? | CREATE TABLE table_203_173 (id number,"year(s)" text,"serial name" text,"role" text,"co-star" text,"note(s)" text,"channel" text) | SELECT "serial name" FROM table_203_173 WHERE "serial name" IN ('sinndoor tere naam ka', 'saat phere') ORDER BY "year(s)" - "year(s)" DESC LIMIT 1 |
When sweden is the country who is the skip? | CREATE TABLE table_29119 ("Country" text,"Skip" text,"W" real,"L" real,"PF" real,"PA" real,"Ends Won" real,"Ends Lost" real,"Blank Ends" real,"Stolen Ends" real,"Shot Pct." real) | SELECT "Skip" FROM table_29119 WHERE "Country" = 'Sweden' |
Which nation ran a time of 9.69 seconds? | CREATE TABLE table_79379 ("Event" text,"Performance" text,"Nation" text,"Place" text,"Date" text) | SELECT "Nation" FROM table_79379 WHERE "Performance" = '9.69' |
Are there any recommended courses to take before taking RCSSCI 345 ? | CREATE TABLE area (course_id int,area varchar)CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE course (course_id int,name varchar,department varchar,number varchar,credits varchar,advisory_requirement v... | SELECT DISTINCT advisory_requirement FROM course WHERE department = 'RCSSCI' AND number = 345 |
What was the surface of the match against bethanie mattek-sands? | CREATE TABLE table_68459 ("Outcome" text,"Date" text,"Surface" text,"Opponent" text,"Score" text) | SELECT "Surface" FROM table_68459 WHERE "Opponent" = 'bethanie mattek-sands' |
What is the rated power for the reactor that ended construction on May 10, 1978? | CREATE TABLE table_name_52 (rated_power VARCHAR,finish_construction VARCHAR) | SELECT rated_power FROM table_name_52 WHERE finish_construction = "may 10, 1978" |
Against which team does Missouri Tigers have a record of mu, 2-1 at a neutral site? | CREATE TABLE table_16201038_4 (missouri_vs VARCHAR,at_neutral_site VARCHAR) | SELECT missouri_vs FROM table_16201038_4 WHERE at_neutral_site = "MU, 2-1" |
Mean Score Per User. | CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByReviewTaskId number)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,Re... | SELECT u.Id AS uid, AVG(q.Score) AS mean_score FROM Users AS u INNER JOIN Posts AS a ON a.OwnerUserId = u.Id INNER JOIN Posts AS q ON a.ParentId = q.Id GROUP BY u.Id ORDER BY AVG(q.Score) DESC |
What is the 2nd leg of dinamo minsk team #2? | CREATE TABLE table_name_20 (team__number2 VARCHAR) | SELECT 2 AS nd_leg FROM table_name_20 WHERE team__number2 = "dinamo minsk" |
What are all the title directed by reginald hudlin | CREATE TABLE table_24701 ("Series #" real,"Season #" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Prod. code" text) | SELECT COUNT("Title") FROM table_24701 WHERE "Directed by" = 'Reginald Hudlin' |
Who is the player that has scored more than 0 league cup goals, but has than 13 total goals, and 4 league cup appearances total? | CREATE TABLE table_name_74 (name VARCHAR,league_cup_apps VARCHAR,league_cup_goals VARCHAR,total_goals VARCHAR) | SELECT name FROM table_name_74 WHERE league_cup_goals > 0 AND total_goals < 13 AND league_cup_apps = "4" |
What campus opened in 1970? | CREATE TABLE table_name_12 (campus VARCHAR,year_opened VARCHAR) | SELECT campus FROM table_name_12 WHERE year_opened = "1970" |
did the philippines or kazakhstan have a higher number of total medals ? | CREATE TABLE table_203_165 (id number,"rank" number,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number) | SELECT "nation" FROM table_203_165 WHERE "nation" IN ('philippines', 'kazakhstan') ORDER BY "total" DESC LIMIT 1 |
what symbol comes before symbol co ? | CREATE TABLE table_204_39 (id number,"number" number,"symbol" text,"name" text,"21st" number,"22nd" number,"23rd" number,"24th" number,"25th" number,"26th" number,"27th" number,"28th" number,"29th" number,"30th" number) | SELECT "symbol" FROM table_204_39 WHERE id = (SELECT id FROM table_204_39 WHERE "symbol" = 'co') - 1 |
Which buildings have apartments that have more than two bathrooms? Give me the addresses of the buildings. | CREATE TABLE guests (guest_id number,gender_code text,guest_first_name text,guest_last_name text,date_of_birth time)CREATE TABLE view_unit_status (apt_id number,apt_booking_id number,status_date time,available_yn others)CREATE TABLE apartment_bookings (apt_booking_id number,apt_id number,guest_id number,booking_status_... | SELECT T1.building_address FROM apartment_buildings AS T1 JOIN apartments AS T2 ON T1.building_id = T2.building_id WHERE T2.bathroom_count > 2 |
What is the total (kg) when the snatch was 84, and bodyweight was less than 57.35? | CREATE TABLE table_name_3 (total__kg_ INTEGER,snatch VARCHAR,bodyweight VARCHAR) | SELECT AVG(total__kg_) FROM table_name_3 WHERE snatch = 84 AND bodyweight < 57.35 |
how many lakes have areas more then 300km | CREATE TABLE table_204_341 (id number,"name in english" text,"name in turkish" text,"area (km2)" text,"depth" text,"location (districts and/or provinces)" text) | SELECT COUNT("name in english") FROM table_204_341 WHERE "area (km2)" > 300 |
What Genre has Hindi as the Language and Star Gold as the Network? | CREATE TABLE table_4727 ("Network" text,"Origin of Programming" text,"Language" text,"Genre" text,"Service" text) | SELECT "Genre" FROM table_4727 WHERE "Language" = 'hindi' AND "Network" = 'star gold' |
how many times patient 6580 visited the intensive care unit since 2104? | CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE d_labitems (row_id number,itemid number,label text)... | SELECT COUNT(DISTINCT icustays.icustay_id) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 6580) AND STRFTIME('%y', icustays.intime) >= '2104' |
Just compare the number of journal committees of each editor using a histogram. | CREATE TABLE editor (Editor_ID int,Name text,Age real)CREATE TABLE journal (Journal_ID int,Date text,Theme text,Sales int)CREATE TABLE journal_committee (Editor_ID int,Journal_ID int,Work_Type text) | SELECT Name, COUNT(*) FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID GROUP BY T1.Editor_ID |
What is the average high temperature for each day of week Plot them as bar chart, display in ascending by the X. | 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,low_temperature int,precipitation real,wind_speed_mph int)CREATE TABLE train (id int,train_number int,name t... | SELECT day_of_week, AVG(high_temperature) FROM weekly_weather GROUP BY day_of_week ORDER BY day_of_week |
what are the name of players who get more than the average points. | CREATE TABLE player (name VARCHAR,points INTEGER) | SELECT name FROM player WHERE points > (SELECT AVG(points) FROM player) |
calculate the number of drugs prescribed to patient 66015 in 09/this year. | CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE prescriptions (row_id number,subject_id n... | SELECT COUNT(*) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 66015) AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', prescriptions.startdate) = '09' |
What is the sum of the rounds where the overall pick was more than 295 and the pick was smaller than 10 and the player was rich dobbert? | CREATE TABLE table_name_93 (round INTEGER,pick VARCHAR,overall VARCHAR,name VARCHAR) | SELECT SUM(round) FROM table_name_93 WHERE overall > 295 AND name = "rich dobbert" AND pick < 10 |
Show order ids and the total quantity in each order. Visualize by scatter chart. | CREATE TABLE Product_Categories (production_type_code VARCHAR(15),product_type_description VARCHAR(80),vat_rating DECIMAL(19,4))CREATE TABLE Financial_Transactions (transaction_id INTEGER,account_id INTEGER,invoice_number INTEGER,transaction_type VARCHAR(15),transaction_date DATETIME,transaction_amount DECIMAL(19,4),tr... | SELECT order_id, SUM(product_quantity) FROM Order_Items GROUP BY order_id |
What gender is the team that has a decile of 5 and in the Dalefield area? | CREATE TABLE table_name_95 (gender VARCHAR,decile VARCHAR,area VARCHAR) | SELECT gender FROM table_name_95 WHERE decile = 5 AND area = "dalefield" |
SAN FRANCISCO to BOSTON please with a stopover in DENVER | CREATE TABLE code_description (code varchar,description text)CREATE TABLE time_interval (period text,begin_time int,end_time int)CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE flight_stop (flight_id int,stop_numbe... | 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 = 'BOSTON' AND CITY_2.cit... |
What is the publication the observer music monthly highest year? | CREATE TABLE table_name_10 (year INTEGER,publication VARCHAR) | SELECT MAX(year) FROM table_name_10 WHERE publication = "the observer music monthly" |
What place is United States player Corey Pavin in? | CREATE TABLE table_name_25 (place VARCHAR,country VARCHAR,player VARCHAR) | SELECT place FROM table_name_25 WHERE country = "united states" AND player = "corey pavin" |
give me the number of patients whose marital status is divorced and procedure short title is closed biopsy of tongue? | 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 INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "DIVORCED" AND procedures.short_title = "Closed biopsy of tongue" |
find me all the round trip flights from BURBANK to MILWAUKEE stopping in ST. LOUIS | CREATE TABLE code_description (code varchar,description text)CREATE TABLE city (city_code varchar,city_name varchar,state_code varchar,country_name varchar,time_zone_code varchar)CREATE TABLE flight_fare (flight_id int,fare_id int)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_descripti... | SELECT DISTINCT flight.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, flight, flight_stop AS FLIGHT_STOP_0, flight_stop AS FLIGHT_STOP_1... |
Show minimal age from each job, could you order x-axis from low to high order? | CREATE TABLE PersonFriend (name varchar(20),friend varchar(20),year INTEGER)CREATE TABLE Person (name varchar(20),age INTEGER,city TEXT,gender TEXT,job TEXT) | SELECT job, MIN(age) FROM Person GROUP BY job ORDER BY job |
What was the character name for the film with a release date of July 29, 1938? | CREATE TABLE table_6590 ("Release date" text,"Length" text,"Director(s)" text,"Character name" text,"Character type" text,"Leading lady" text) | SELECT "Character name" FROM table_6590 WHERE "Release date" = 'july 29, 1938' |
Answers by me that contain code.. This query produces a list of your answers where the answer contains one or more 'code ' blocks. | CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,Co... | SELECT Id AS "post_link", Score, ViewCount FROM Posts WHERE OwnerUserId = @UserID ORDER BY ViewCount |
Which Number has a Name of hill, lucius t.? | CREATE TABLE table_name_41 (number INTEGER,name VARCHAR) | SELECT MAX(number) FROM table_name_41 WHERE name = "hill, lucius t." |
What is the Age of dorothy Peel as of 1 February 2014 ? | CREATE TABLE table_36012 ("Name" text,"Birth date" text,"Age as of 1 February 2014" text,"Country of birth" text,"Place of residence" text) | SELECT "Age as of 1 February 2014" FROM table_36012 WHERE "Name" = 'dorothy peel' |
What was the title of the song that peaked the charts at #1 with track 20? | CREATE TABLE table_name_78 (song_title VARCHAR,chart_peak VARCHAR,track VARCHAR) | SELECT song_title FROM table_name_78 WHERE chart_peak = "#1" AND track = 20 |
Name results for herb wetanson | CREATE TABLE table_27561503_2 (results VARCHAR,gt_20_winning_team VARCHAR) | SELECT results FROM table_27561503_2 WHERE gt_20_winning_team = "Herb Wetanson" |
Count the number of answers of ELL in a given year. | CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId nu... | SELECT COUNT(AnswerCount) AS "total_answers" FROM Posts WHERE YEAR(CreationDate) = @GiveYear |
Which Partner is on 22 april 2002? | CREATE TABLE table_name_35 (partner VARCHAR,date VARCHAR) | SELECT partner FROM table_name_35 WHERE date = "22 april 2002" |
List the distinct police forces of counties whose location is not on east side. | CREATE TABLE county_public_safety (Police_force VARCHAR,LOCATION VARCHAR) | SELECT DISTINCT Police_force FROM county_public_safety WHERE LOCATION <> "East" |
Which Season has Podiums of 0, and Races of 16? | CREATE TABLE table_name_44 (season INTEGER,podiums VARCHAR,races VARCHAR) | SELECT MAX(season) FROM table_name_44 WHERE podiums = "0" AND races = "16" |
What circuit features the placemakers v8 supercars race? | CREATE TABLE table_20884163_2 (circuit VARCHAR,race_title VARCHAR) | SELECT circuit FROM table_20884163_2 WHERE race_title = "PlaceMakers V8 Supercars" |
I want to see trend of the number of date of notes by date of notes, order X in descending order. | CREATE TABLE Teachers (teacher_id INTEGER,address_id INTEGER,first_name VARCHAR(80),middle_name VARCHAR(80),last_name VARCHAR(80),gender VARCHAR(1),cell_mobile_number VARCHAR(40),email_address VARCHAR(40),other_details VARCHAR(255))CREATE TABLE Behavior_Incident (incident_id INTEGER,incident_type_code VARCHAR(10),stude... | SELECT date_of_notes, COUNT(date_of_notes) FROM Assessment_Notes ORDER BY date_of_notes DESC |
What are the origins of all flights that are headed to Honolulu? | CREATE TABLE certificate (eid number,aid number)CREATE TABLE aircraft (aid number,name text,distance number)CREATE TABLE flight (flno number,origin text,destination text,distance number,departure_date time,arrival_date time,price number,aid number)CREATE TABLE employee (eid number,name text,salary number) | SELECT origin FROM flight WHERE destination = "Honolulu" |
How many games were played where the height of the player is 1.92m? | CREATE TABLE table_74035 ("Player" text,"Position" text,"Starting No.#" real,"D.O.B" text,"Club" text,"Height" text,"Weight" text,"Games" real) | SELECT COUNT("Games") FROM table_74035 WHERE "Height" = '1.92m' |
Which Tonnage (GRT) has a Nationality of united kingdom, and a Name of king gruffydd? | CREATE TABLE table_name_44 (tonnage__grt_ INTEGER,nationality VARCHAR,name VARCHAR) | SELECT MIN(tonnage__grt_) FROM table_name_44 WHERE nationality = "united kingdom" AND name = "king gruffydd" |
What is the acc percentage when all games percentage is .484? | CREATE TABLE table_20696 ("Team" text,"ACC Regular Season" text,"ACC %" text,"ACC Home" text,"ACC Road" text,"All Games" text,"All Games %" text,"All Home" text,"All Road" text,"All Neutral" text) | SELECT "ACC %" FROM table_20696 WHERE "All Games %" = '.484' |
What is the total attendance before week 1? | CREATE TABLE table_66616 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real) | SELECT SUM("Attendance") FROM table_66616 WHERE "Week" < '1' |
List the details of the customers who do not have any policies. | CREATE TABLE Customer_Policies (customer_id VARCHAR)CREATE TABLE Customers (customer_details VARCHAR,customer_id VARCHAR) | SELECT customer_details FROM Customers EXCEPT SELECT T1.customer_details FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.customer_id = T2.customer_id |
What is the country that has the most perpetrators? | CREATE TABLE people (people_id number,name text,height number,weight number,home town text)CREATE TABLE perpetrator (perpetrator_id number,people_id number,date text,year number,location text,country text,killed number,injured number) | SELECT country, COUNT(*) FROM perpetrator GROUP BY country ORDER BY COUNT(*) DESC LIMIT 1 |
Which Genre has a Year before 2013, and a Name of kikumana? | CREATE TABLE table_name_92 (genre VARCHAR,year VARCHAR,name VARCHAR) | SELECT genre FROM table_name_92 WHERE year < 2013 AND name = "kikumana" |
what airline is a s AS in sam | CREATE TABLE flight_stop (flight_id int,stop_number int,stop_days text,stop_airport text,arrival_time int,arrival_airline text,arrival_flight_number int,departure_time int,departure_airline text,departure_flight_number int,stop_time int)CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE... | SELECT DISTINCT airline_code FROM airline WHERE airline_code = 'AS' |
What is the lowest value of Blank Ends when Stolen Ends is 7. | CREATE TABLE table_1505809_2 (blank_ends INTEGER,stolen_ends VARCHAR) | SELECT MIN(blank_ends) FROM table_1505809_2 WHERE stolen_ends = 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.