instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Find the names of stadiums that some Australian swimmers have been to. | CREATE TABLE swimmer (id VARCHAR,nationality VARCHAR)CREATE TABLE record (swimmer_id VARCHAR,event_id VARCHAR)CREATE TABLE event (id VARCHAR,stadium_id VARCHAR)CREATE TABLE stadium (name VARCHAR,id VARCHAR) | SELECT t4.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id JOIN event AS t3 ON t2.event_id = t3.id JOIN stadium AS t4 ON t4.id = t3.stadium_id WHERE t1.nationality = 'Australia' |
What is the GPU model when the L3 cache is standard power? | CREATE TABLE table_name_74 (gpu_model VARCHAR,l3_cache VARCHAR) | SELECT gpu_model FROM table_name_74 WHERE l3_cache = "standard power" |
What is the # for worthing high school? | CREATE TABLE table_22496344_1 (_number VARCHAR,high_school VARCHAR) | SELECT COUNT(_number) FROM table_22496344_1 WHERE high_school = "Worthing" |
what is the number of patients admitted to hospital during the last year? | CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE icustays (row_id number,subject_id n... | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') |
Which name had a bodyweight bigger than 89.64, a total (kg) bigger than 310, a clean and jerk less than 207.5, and a snatch that is bigger than 165? | CREATE TABLE table_11063 ("Name" text,"Bodyweight" real,"Snatch" real,"Clean & jerk" real,"Total (kg)" real) | SELECT "Name" FROM table_11063 WHERE "Bodyweight" > '89.64' AND "Total (kg)" > '310' AND "Clean & jerk" < '207.5' AND "Snatch" > '165' |
Which 1997's accompanying 1991 was a when the tournament was the australian open? | CREATE TABLE table_name_57 (tournament VARCHAR) | SELECT 1997 FROM table_name_57 WHERE 1991 = "a" AND tournament = "australian open" |
Compare the average age of drivers from the same home city with a bar chart, display bars in ascending order please. | CREATE TABLE driver (Driver_ID int,Name text,Party text,Home_city text,Age int)CREATE TABLE school_bus (School_ID int,Driver_ID int,Years_Working int,If_full_time bool)CREATE TABLE school (School_ID int,Grade text,School text,Location text,Type text) | SELECT Home_city, AVG(Age) FROM driver GROUP BY Home_city ORDER BY Home_city |
Tell me the wkts for econ of 4.23 | CREATE TABLE table_name_13 (wkts VARCHAR,econ VARCHAR) | SELECT wkts FROM table_name_13 WHERE econ = "4.23" |
What engine doe the Ed Carpenter Racing team use? | CREATE TABLE table_2503102_1 (engine VARCHAR,team VARCHAR) | SELECT engine FROM table_2503102_1 WHERE team = "Ed Carpenter Racing" |
Who directed the movie when John Wayne played the role of John Travers? | CREATE TABLE table_67269 ("Title" text,"Studio" text,"Role" text,"Leading lady" text,"Director" text) | SELECT "Director" FROM table_67269 WHERE "Role" = 'john travers' |
How many teams were at 10 points? | CREATE TABLE table_28743 ("Season" real,"Series" text,"Team" text,"Races" real,"Wins" real,"F/Laps" real,"Podiums" real,"Points" real,"Position" text) | SELECT COUNT("Team") FROM table_28743 WHERE "Points" = '10' |
What is the name of the national final co host when David Jacobs was the National final main host, and the selection show was a song for europe in 1966? | CREATE TABLE table_13915 ("Year(s)" text,"Selection show" text,"Venue" text,"National final main host" text,"National final co host" text,"Semi final/heat host" text) | SELECT "National final co host" FROM table_13915 WHERE "National final main host" = 'david jacobs' AND "Selection show" = 'a song for europe' AND "Year(s)" = '1966' |
What was the result of the match on December 1, 1963? | CREATE TABLE table_32929 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real) | SELECT "Result" FROM table_32929 WHERE "Date" = 'december 1, 1963' |
What has the lowest number of wins with GA smaller than 39, more than 2 losses, and ties greater than 0? | CREATE TABLE table_51247 ("Team" text,"Games Played" real,"Wins" real,"Losses" real,"Ties" real,"Goals For" real,"Goals Against" real) | SELECT MIN("Wins") FROM table_51247 WHERE "Goals Against" < '39' AND "Losses" > '2' AND "Ties" > '0' |
What is the 1st leg when club is a.c. libertas? | CREATE TABLE table_500 ("Season" text,"Competition" text,"Round" text,"Club" text,"1st leg" text,"2nd leg" text,"Aggregate" text) | SELECT "1st leg" FROM table_500 WHERE "Club" = 'A.C. Libertas' |
What is the original air date for the episode 'a pig in a poke'? | CREATE TABLE table_17546 ("No. in series" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" real) | SELECT "Original air date" FROM table_17546 WHERE "Title" = 'A Pig in a Poke' |
Who was the director of the movie Joy from 2015 ? | CREATE TABLE made_by (id int,msid int,pid int)CREATE TABLE written_by (id int,msid int,wid int)CREATE TABLE tv_series (sid int,title text,release_year int,num_of_seasons int,num_of_episodes int,title_aka text,budget text)CREATE TABLE producer (pid int,gender text,name text,nationality text,birth_city text,birth_year in... | SELECT director.name FROM directed_by, director, movie WHERE director.did = directed_by.did AND movie.mid = directed_by.msid AND movie.release_year = 2015 AND movie.title = 'Joy' |
What is the country when last/current driver(s) 3 november 2013 is daniel abt ( 2012 )? | CREATE TABLE table_27279050_3 (country VARCHAR,last_current_driver_s__3_november_2013 VARCHAR) | SELECT country FROM table_27279050_3 WHERE last_current_driver_s__3_november_2013 = "Daniel Abt ( 2012 )" |
How many seats were there in 2001 when there were 11 seats in 2006? | CREATE TABLE table_2422 ("Political parties" text,"% 2006" text,"Seats 2006" real,"% 2001" text,"Seats 2001" real,"% 1997" text) | SELECT MIN("Seats 2001") FROM table_2422 WHERE "Seats 2006" = '11' |
What were the years that the building at 200 sw harrison was considered to be the tallest building? | CREATE TABLE table_38559 ("Name" text,"Street address" text,"Years as tallest" text,"Height feet / m" text,"Floors" real) | SELECT "Years as tallest" FROM table_38559 WHERE "Street address" = '200 sw harrison' |
What are the losses of Warrnambool with a draw less than 19? | CREATE TABLE table_64139 ("Club" text,"Active" text,"Wins" real,"Losses" real,"Draws" real,"Percentage wins" text,"Flags" real) | SELECT AVG("Losses") FROM table_64139 WHERE "Club" = 'warrnambool' AND "Draws" < '19' |
Are there any courses which require taking RESTORA 746 first ? | CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE area (course_id int,area varchar)CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE student (student_id int,lastname varchar,firstname varchar,program_id int,declare_major varchar,tota... | SELECT DISTINCT COURSE_1.department, COURSE_1.name, COURSE_1.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND COURSE_0.department = 'RESTORA' AND COURSE_0.number = 746 AND COURSE_1.course_id = course_prerequisite.course_id |
who had the next best time after dusmetova . | CREATE TABLE table_204_174 (id number,"rank" number,"name" text,"nationality" text,"result" number,"notes" text) | SELECT "name" FROM table_204_174 WHERE "result" < (SELECT "result" FROM table_204_174 WHERE "name" = 'liliya dusmetova') ORDER BY "result" DESC LIMIT 1 |
Which Award has a Year smaller than 2004, and a Work of the clone, and a Result of won, and a Category of favourite actress? | CREATE TABLE table_name_45 (award VARCHAR,category VARCHAR,result VARCHAR,year VARCHAR,work VARCHAR) | SELECT award FROM table_name_45 WHERE year < 2004 AND work = "the clone" AND result = "won" AND category = "favourite actress" |
Find the parties associated with the delegates from district 1 or 2. Who served as comptrollers of the parties, and count them by a bar chart | CREATE TABLE county (County_Id int,County_name text,Population real,Zip_code text)CREATE TABLE party (Party_ID int,Year real,Party text,Governor text,Lieutenant_Governor text,Comptroller text,Attorney_General text,US_Senate text)CREATE TABLE election (Election_ID int,Counties_Represented text,District int,Delegate text... | SELECT Comptroller, COUNT(Comptroller) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2 GROUP BY Comptroller |
What's the Time/Retired of Ivan Capelli? | CREATE TABLE table_11665 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT "Time/Retired" FROM table_11665 WHERE "Driver" = 'ivan capelli' |
What is the rating of episode 1.04? | CREATE TABLE table_28283535_4 (rating VARCHAR,episode VARCHAR) | SELECT rating FROM table_28283535_4 WHERE episode = "1.04" |
What is the boston celtics' record? | CREATE TABLE table_name_39 (record VARCHAR,team VARCHAR) | SELECT record FROM table_name_39 WHERE team = "boston celtics" |
what was the drug prescribed to patient 65309 in 10/last year for the last time? | CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)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 t... | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 65309) AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', prescriptions.startdate) = '10' ORD... |
Rank of 6 has what time? | CREATE TABLE table_name_16 (time VARCHAR,rank VARCHAR) | SELECT time FROM table_name_16 WHERE rank = 6 |
How many carries for jeff smoker? | CREATE TABLE table_53728 ("Player" text,"Car." real,"Yards" text,"Avg." text,"TD's" real,"Long" text) | SELECT SUM("Car.") FROM table_53728 WHERE "Player" = 'jeff smoker' |
Who played in Maryland the same year that New Jersey hosted Somerset Hills LL Bernardsville? | CREATE TABLE table_13012165_1 (maryland VARCHAR,new_jersey VARCHAR) | SELECT maryland FROM table_13012165_1 WHERE new_jersey = "Somerset Hills LL Bernardsville" |
what is the number of patients with diagnoses icd9 code 41031 who had ascitic lab fluid test? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la... | 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.icd9_code = "41031" AND lab.fluid = "Ascites" |
What episode number is the episode with a segment on thinning shears? | CREATE TABLE table_19908 ("Series Ep." text,"Episode" real,"Segment A" text,"Segment B" text,"Segment C" text,"Segment D" text) | SELECT MIN("Episode") FROM table_19908 WHERE "Segment A" = 'Thinning Shears' |
What was Collingwood's score as the home team? | CREATE TABLE table_name_54 (home_team VARCHAR) | SELECT home_team AS score FROM table_name_54 WHERE home_team = "collingwood" |
until 2 years ago, what is the five most frequent drugs, prescribed to the patients of age 20s after the diagnosis of leukocytosis within 2 months? | CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissio... | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'leukocytosis' AND DATETIME(diagnosis.diagnosistime... |
What is the Primary Sponsor for the team owned by Randy Humphrey? | CREATE TABLE table_71520 ("Team" text,"Car(s)" text,"Driver(s)" text,"Primary Sponsor(s)" text,"Owner(s)" text,"Crew Chief" text,"Rounds" real) | SELECT "Primary Sponsor(s)" FROM table_71520 WHERE "Owner(s)" = 'randy humphrey' |
how many patients stayed in hospital for more than 1 day and were diagnosed with icd9 code 99859? | 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "1" AND diagnoses.icd9_code = "99859" |
For team Atl tico Nacional, what were the points? | CREATE TABLE table_21069 ("Team #1" text,"Points" text,"Team #2" text,"1st leg" text,"2nd leg" text) | SELECT "Points" FROM table_21069 WHERE "Team #2" = 'Atlético Nacional' |
Name the incumbent for first elected 1956 | CREATE TABLE table_1341930_40 (incumbent VARCHAR,first_elected VARCHAR) | SELECT incumbent FROM table_1341930_40 WHERE first_elected = 1956 |
What was the record on july 24? | CREATE TABLE table_name_95 (record VARCHAR,date VARCHAR) | SELECT record FROM table_name_95 WHERE date = "july 24" |
What is the least value of joined? | CREATE TABLE table_261954_1 (joined INTEGER) | SELECT MIN(joined) FROM table_261954_1 |
during this year, what was the top three most commonly prescribed drugs to patients after they were diagnosed with angina pectoris nec/nos during the same hospital visit? | CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,route text)CREATE TABLE d_items (row_id number,itemid number,label text,linksto ... | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_... |
What was the score of the game with the Etobicoke Kangaroos as the home team? | CREATE TABLE table_name_55 (score VARCHAR,home VARCHAR) | SELECT score FROM table_name_55 WHERE home = "etobicoke kangaroos" |
What is Van Waiters position? | CREATE TABLE table_32991 ("Pick #" real,"NFL Team" text,"Player" text,"Position" text,"College" text) | SELECT "Position" FROM table_32991 WHERE "Player" = 'van waiters' |
What is the kickoff that has a NFL.com recap, is played before week 17, and is played at arrowhead stadium? | CREATE TABLE table_33108 ("Week" real,"Kickoff" text,"Date" text,"Opponent" text,"Result" text,"Record" text,"Game Site" text,"NFL.com Recap" text) | SELECT "Kickoff" FROM table_33108 WHERE "NFL.com Recap" = 'recap' AND "Week" < '17' AND "Game Site" = 'arrowhead stadium' |
builder that has the most experience | CREATE TABLE table_204_637 (id number,"type" text,"gauge" text,"railway" text,"works no." text,"year" text,"builder" text) | SELECT "builder" FROM table_204_637 GROUP BY "builder" ORDER BY COUNT(*) DESC LIMIT 1 |
What is the record of the champion in 2008? | CREATE TABLE table_13252 ("Year" real,"Champion" text,"City" text,"LLWS" text,"Record" text) | SELECT "Record" FROM table_13252 WHERE "Year" = '2008' |
What is the lowest Game, when Date is 'April 12'? | CREATE TABLE table_44745 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT MIN("Game") FROM table_44745 WHERE "Date" = 'april 12' |
How many spectators were present when the away team scored 10.12 (72)? | CREATE TABLE table_57250 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT COUNT("Crowd") FROM table_57250 WHERE "Away team score" = '10.12 (72)' |
what year did the bulldogs make the greatest number of tries | CREATE TABLE table_203_34 (id number,"season" text,"appearance" number,"interchange" number,"tries" number,"goals" number,"f/g" number,"points" number) | SELECT "season" FROM table_203_34 ORDER BY "tries" DESC LIMIT 1 |
what were the five most commonly ordered procedures for patients with brain tumor who had previously been diagnosed within 2 months until 2104? | CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,discha... | SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'brain tumor' AND STRFTIME('%y', diagnosi... |
What is Score, when Opponent is Natalia Rizhonkova? | CREATE TABLE table_44611 ("Outcome" text,"Date" text,"Championship" text,"Surface" text,"Opponent" text,"Score" text) | SELECT "Score" FROM table_44611 WHERE "Opponent" = 'natalia rizhonkova' |
how many male patients had the drug code lipid250i? | CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "M" AND prescriptions.formulary_drug_cd = "LIPID250I" |
What is the average value for 1970, when the Region is East Europe (7 Economies), and when 2000 has a value greater than 2? | CREATE TABLE table_name_12 (region VARCHAR) | SELECT AVG(1970) FROM table_name_12 WHERE region = "east europe (7 economies)" AND 2000 > 2 |
When 70 is the total points what is the rr4 points? | CREATE TABLE table_21489362_2 (rr4_pts VARCHAR,total_pts VARCHAR) | SELECT rr4_pts FROM table_21489362_2 WHERE total_pts = 70 |
Show the total number of passengers of each location in a bar chart, and display in asc by the x-axis. | CREATE TABLE train (Train_ID int,Name text,Time text,Service text)CREATE TABLE station (Station_ID int,Name text,Annual_entry_exit real,Annual_interchanges real,Total_Passengers real,Location text,Main_Services text,Number_of_Platforms int)CREATE TABLE train_station (Train_ID int,Station_ID int) | SELECT Location, SUM(Total_Passengers) FROM station GROUP BY Location ORDER BY Location |
N questions with the shortest title on a given site. | CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE VoteTypes (Id number,Name... | SELECT Id AS "post_link", LENGTH(Title) AS "no._of_characters" FROM Posts WHERE PostTypeId = 1 ORDER BY 'no._of_characters' LIMIT 100 |
when did patient 20000 receive the first anion gap test since 166 months ago? | 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 diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text... | SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'anion gap') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20000) AND DATETIME(labevents.charttime) >= DATETIME(CURRENT_TIME(), '-166... |
What is minimum hours of the students playing in different position Plot them as bar chart, and could you sort by the y axis in descending? | CREATE TABLE College (cName varchar(20),state varchar(2),enr numeric(5,0))CREATE TABLE Player (pID numeric(5,0),pName varchar(20),yCard varchar(3),HS numeric(5,0))CREATE TABLE Tryout (pID numeric(5,0),cName varchar(20),pPos varchar(8),decision varchar(3)) | SELECT pPos, MIN(T2.HS) FROM Tryout AS T1 JOIN Player AS T2 ON T1.pID = T2.pID GROUP BY pPos ORDER BY MIN(T2.HS) DESC |
How many orders have detail 'Second time'? | CREATE TABLE customer_orders (order_details VARCHAR) | SELECT COUNT(*) FROM customer_orders WHERE order_details = "Second time" |
Which first leg had Galatasaray as Team 1? | CREATE TABLE table_name_34 (team_1 VARCHAR) | SELECT 1 AS st_leg FROM table_name_34 WHERE team_1 = "galatasaray" |
Show last names for all student who are on scholarship, and count them by a bar chart, and could you sort in descending by the y-axis? | CREATE TABLE SportsInfo (StuID INTEGER,SportName VARCHAR(32),HoursPerWeek INTEGER,GamesPlayed INTEGER,OnScholarship VARCHAR(1))CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTEGER,city_code VARCHAR(3))CREATE TABLE Video_Games (GameID INTEGER,GN... | SELECT LName, COUNT(LName) FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.OnScholarship = 'Y' GROUP BY LName ORDER BY COUNT(LName) DESC |
Show all ages and corresponding number of students. | CREATE TABLE Student (age VARCHAR) | SELECT age, COUNT(*) FROM Student GROUP BY age |
What was the Attendance when Lincoln City was the Opponents with H/A of A? | CREATE TABLE table_name_20 (attendance VARCHAR,opponents VARCHAR,h___a VARCHAR) | SELECT COUNT(attendance) FROM table_name_20 WHERE opponents = "lincoln city" AND h___a = "a" |
What year was the earliest first elected? | CREATE TABLE table_1341663_19 (first_elected INTEGER) | SELECT MIN(first_elected) FROM table_1341663_19 |
What opponent has a loss of Trachsel (10-11)? | CREATE TABLE table_69379 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" text) | SELECT "Opponent" FROM table_69379 WHERE "Loss" = 'trachsel (10-11)' |
What is the President with a Location of justus lipsius building, brussels, and a Type with scheduled, and a Year larger than 2011, and a Date with 18 19 october? | CREATE TABLE table_name_22 (president VARCHAR,date VARCHAR,year VARCHAR,location VARCHAR,type VARCHAR) | SELECT president FROM table_name_22 WHERE location = "justus lipsius building, brussels" AND type = "scheduled" AND year > 2011 AND date = "18–19 october" |
Give the proportion of what are the ids and names of the companies that operated more than one flight? | CREATE TABLE operate_company (id int,name text,Type text,Principal_activities text,Incorporated_in text,Group_Equity_Shareholding real)CREATE TABLE airport (id int,City text,Country text,IATA text,ICAO text,name text)CREATE TABLE flight (id int,Vehicle_Flight_number text,Date text,Pilot text,Velocity real,Altitude real... | SELECT T1.name, T1.id FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id |
What is the share of votes in the 2000 (2nd) election? | CREATE TABLE table_47454 ("Election" text,"Candidate" text,"Number of votes" text,"Share of votes" text,"Outcome of election" text) | SELECT "Share of votes" FROM table_47454 WHERE "Election" = '2000 (2nd)' |
Find the id and location of circuits that belong to France or Belgium Plot them as bar chart, could you sort in descending by the Y? | CREATE TABLE races (raceId INTEGER,year INTEGER,round INTEGER,circuitId INTEGER,name TEXT,date TEXT,time TEXT,url TEXT)CREATE TABLE constructors (constructorId INTEGER,constructorRef TEXT,name TEXT,nationality TEXT,url TEXT)CREATE TABLE lapTimes (raceId INTEGER,driverId INTEGER,lap INTEGER,position INTEGER,time TEXT,mi... | SELECT location, circuitId FROM circuits WHERE country = "France" OR country = "Belgium" ORDER BY circuitId DESC |
What did the home team score at Western Oval? | CREATE TABLE table_52345 ("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_52345 WHERE "Venue" = 'western oval' |
what is the average number of patients diagnosed with diseases of lips monthly until 2104? | CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,insurance text,language text,marital_status text,ethnicity text,age number)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,ic... | SELECT AVG(t1.c1) FROM (SELECT COUNT(DISTINCT diagnoses_icd.hadm_id) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'diseases of lips') AND STRFTIME('%y', diagnoses_icd.charttime) <= '2104' GROUP BY STRFTIME('%y-%m', di... |
Which team has Ali Daei as head coach? | CREATE TABLE table_29471 ("Team" text,"Head coach" text,"Team captain" text,"Kit maker" text,"Shirt sponsor" text,"Past Season" text) | SELECT "Team" FROM table_29471 WHERE "Head coach" = 'Ali Daei' |
show me the afternoon flights from WASHINGTON to BOSTON | CREATE TABLE flight_fare (flight_id int,fare_id int)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE month (month_number int,month_name text)CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE time_zone (time_zone_code text,time_zone_name te... | 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... |
What is the competition that had a 2-2 result? | CREATE TABLE table_53861 ("Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text) | SELECT "Competition" FROM table_53861 WHERE "Result" = '2-2' |
What was the smallest crowd at junction oval? | CREATE TABLE table_name_61 (crowd INTEGER,venue VARCHAR) | SELECT MIN(crowd) FROM table_name_61 WHERE venue = "junction oval" |
How many years as tallest building was Independence Hall? | CREATE TABLE table_71241 ("Name" text,"Street address" text,"Years as tallest" text,"Height ft (m)" text,"Floors" text,"Architect" text) | SELECT "Years as tallest" FROM table_71241 WHERE "Name" = 'independence hall' |
How many times was the candidates paul tsongas (d) 60.6% paul w. cronin (r) 39.4%? | CREATE TABLE table_18353 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text) | SELECT COUNT("Incumbent") FROM table_18353 WHERE "Candidates" = 'Paul Tsongas (D) 60.6% Paul W. Cronin (R) 39.4%' |
How many points were scored on pole services? | CREATE TABLE table_26124171_1 (points VARCHAR,team VARCHAR) | SELECT points FROM table_26124171_1 WHERE team = "Pole Services" |
let's count the number of times patient 27703 had been prescribed memantine in 2105. | 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 inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE diagnoses_icd... | SELECT COUNT(*) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27703) AND prescriptions.drug = 'memantine' AND STRFTIME('%y', prescriptions.startdate) = '2105' |
Tell me the date that has a week larger than 3 and a result of w 28-27 | CREATE TABLE table_31698 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real) | SELECT "Date" FROM table_31698 WHERE "Week" > '3' AND "Result" = 'w 28-27' |
What is the sum of credit value of courses with more than one prerequisite for each title? Return a bar chart, sort Y from low to high order please. | CREATE TABLE department (dept_name varchar(20),building varchar(15),budget numeric(12,2))CREATE TABLE takes (ID varchar(5),course_id varchar(8),sec_id varchar(8),semester varchar(6),year numeric(4,0),grade varchar(2))CREATE TABLE teaches (ID varchar(5),course_id varchar(8),sec_id varchar(8),semester varchar(6),year num... | SELECT title, SUM(credits) FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY title ORDER BY SUM(credits) |
Which models can perform flops(@ 200mhz) is 3.2 | CREATE TABLE table_19312 ("Model" text,"Year" text,"Die Size (mm 2) [1]" text,"Config core [2]" text,"MTriangles/s [1]" real,"MPixel/s [1]" real,"Bus width (bit)" text,"DirectX" text,"OpenGL" text,"OpenGL ES" text,"GFLOPS(@ 200MHz)" text,"Frequency" real) | SELECT "Model" FROM table_19312 WHERE "GFLOPS(@ 200MHz)" = '3.2' |
What player had the high assists when the Score was l 107 112 (ot)? | CREATE TABLE table_47303 ("Game" real,"Date" text,"Team" text,"Score" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "High assists" FROM table_47303 WHERE "Score" = 'l 107–112 (ot)' |
Which Crowd has an Away team of st kilda? | CREATE TABLE table_51358 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Crowd" FROM table_51358 WHERE "Away team" = 'st kilda' |
what is the last flight from SAN FRANCISCO to DALLAS FORT WORTH | CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)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 ... | 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 WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND CITY_2.city_code = AIR... |
what is the bristol & n. som where the somerset is ashcott and shapwick? | CREATE TABLE table_12043148_2 (bristol_ VARCHAR,_n_som VARCHAR,somerset VARCHAR) | SELECT bristol_ & _n_som FROM table_12043148_2 WHERE somerset = "Ashcott and Shapwick" |
Return a histogram on what are the first names and ids for customers who have two or more accounts?, and show in ascending by the x axis. | 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 Invoices (invoice_number INTEGER,order_id INTEGER,invoice_date DATETIME)CREATE TABLE Customers (customer_id INTEGER,customer_first_name VARCHAR(50),customer... | SELECT T2.customer_first_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.customer_first_name |
Draw a bar chart of product type code versus minimal product price, and rank in desc by the X. | CREATE TABLE Order_Items (order_item_id INTEGER,order_id INTEGER,product_id INTEGER)CREATE TABLE Departments (department_id INTEGER,dept_store_id INTEGER,department_name VARCHAR(80))CREATE TABLE Addresses (address_id INTEGER,address_details VARCHAR(255))CREATE TABLE Customer_Orders (order_id INTEGER,customer_id INTEGER... | SELECT product_type_code, MIN(product_price) FROM Products GROUP BY product_type_code ORDER BY product_type_code DESC |
what are the total number of athletes representing bulgaria ? | CREATE TABLE table_203_211 (id number,"pos." number,"time" text,"athlete" text,"country" text,"venue" text,"date" text) | SELECT COUNT("athlete") FROM table_203_211 WHERE "country" = 'bulgaria' |
How many games have a score of 85-92? | CREATE TABLE table_name_36 (game VARCHAR,score VARCHAR) | SELECT COUNT(game) FROM table_name_36 WHERE score = "85-92" |
Which Livery has a Description of 20t tanker, with a date later than 1941? | CREATE TABLE table_53774 ("Number & name" text,"Description" text,"Current status" text,"Livery" text,"Date" real) | SELECT "Livery" FROM table_53774 WHERE "Description" = '20t tanker' AND "Date" > '1941' |
When the average ratings is 10.3%, what is the average episodes? | CREATE TABLE table_name_32 (episodes INTEGER,average_ratings VARCHAR) | SELECT AVG(episodes) FROM table_name_32 WHERE average_ratings = "10.3%" |
What total number of opened has a stadium of stade de la mosson and is larger than 32,939 capacity? | CREATE TABLE table_13979 ("Stadium" text,"Capacity" real,"City" text,"Region" text,"Home Team" text,"Opened" real) | SELECT COUNT("Opened") FROM table_13979 WHERE "Stadium" = 'stade de la mosson' AND "Capacity" > '32,939' |
Who wrote the episode that had 5.93 million viewers? | CREATE TABLE table_3919 ("Episode #" real,"Series #" real,"Title" text,"Director" text,"Writer" text,"Original airdate" text,"Viewers (millions)" text) | SELECT "Writer" FROM table_3919 WHERE "Viewers (millions)" = '5.93' |
Name the most population hervey bay for when population maryborough of 22,977 and population tiaro less than 3,287 | CREATE TABLE table_68366 ("Year" real,"Population (Region total)" real,"Population (Maryborough)" real,"Population (Hervey Bay)" real,"Population (Woocoo)" real,"Population (Tiaro)" real) | SELECT MAX("Population (Hervey Bay)") FROM table_68366 WHERE "Population (Maryborough)" = '22,977' AND "Population (Tiaro)" < '3,287' |
Return the name of the document that has the most sections. | CREATE TABLE document_structures (document_structure_code text,parent_document_structure_code text,document_structure_description text)CREATE TABLE document_sections (section_id number,document_code text,section_sequence number,section_code text,section_title text)CREATE TABLE document_functional_areas (document_code t... | SELECT t1.document_name FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code GROUP BY t1.document_code ORDER BY COUNT(*) DESC LIMIT 1 |
what was the top four most commonly prescribed drugs in 2102? | CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)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 t... | SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE STRFTIME('%y', prescriptions.startdate) = '2102' GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 4 |
Top New York City JavaScript answerers. | 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 u.DisplayName, u.Reputation, u.WebsiteUrl, COUNT(*) AS JavaScriptAnswers FROM Users AS u, Posts AS p, Posts AS pp WHERE u.Id IN (SELECT Id FROM Users WHERE Location LIKE ('%New York')) AND p.OwnerUserId = u.Id AND pp.Id = p.ParentId AND pp.Tags LIKE ('%<javascript>%') GROUP BY u.DisplayName, u.Reputation, u.Webs... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.