sentence
stringlengths 3
347
| sql
stringlengths 18
804
|
---|---|
Show the locations shared by shops with open year later than 2012 and shops with open year before 2008. | SELECT LOCATION FROM shop WHERE Open_Year > 2012 INTERSECT SELECT LOCATION FROM shop WHERE Open_Year < 2008 |
Who is the winner for the match on October 7? | SELECT winner FROM table_name_20 WHERE date = "october 7" |
Name the products via wholesale channel of the store under Pacific/Honolulu time zone. | SELECT T FROM ( SELECT DISTINCT CASE WHEN T3.`Time Zone` = 'Pacific/Honolulu' AND T2.`Sales Channel` = 'Wholesale' THEN T1.`Product Name` ELSE NULL END AS T FROM Products T1 INNER JOIN `Sales Orders` T2 ON T2._ProductID = T1.ProductID INNER JOIN `Store Locations` T3 ON T3.StoreID = T2._StoreID ) WHERE T IS NOT NULL |
How many different kinds of information sources are there for injury accidents? | SELECT COUNT(DISTINCT SOURCE) FROM injury_accident |
How many christmas albums were released in 2004? | SELECT COUNT(T1.id) FROM torrents AS T1 INNER JOIN tags AS T2 ON T1.id = T2.id WHERE T2.tag = 'christmas' AND T1.groupYear = 2004 AND T1.releaseType LIKE 'album' |
If the water square milage is 1.701, what is the land square milage? | SELECT land___sqmi__ FROM table_18600760_7 WHERE water__sqmi_ = "1.701" |
What day is class? | SELECT Days FROM COURSE AS T1 JOIN DEPARTMENT AS T2 ON T1.DNO = T2.DNO WHERE T1.CName = "INTRODUCTION TO COMPUTER SCIENCE" |
What is the charge amount of the most expensive charge type? | SELECT max(charge_amount) FROM Charges |
Which away team had a Score of 2–0? | SELECT away_team FROM table_name_53 WHERE score = "2–0" |
Find the name of customers who have both saving and checking account types. | SELECT cust_name FROM customer WHERE acc_type = 'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type = 'checking' |
Find the number of flights landing in the city of Aberdeen or Abilene. | SELECT COUNT(*) FROM Flights AS T1 JOIN Airports AS T2 ON T1.DestAirport = T2.AirportCode WHERE T2.city = "Aberdeen" OR T2.city = "Abilene" |
What are the top 3 companies operating the most cargo flights? | SELECT * FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id where T1.Principal_activities = "Cargo" group BY T1.name order by count ( * ) limit 3 |
What is the average value of the sales order? | SELECT SUM(UnitPrice * Quantity * (1 - Discount)) / COUNT(OrderID) FROM `Order Details` |
How many laps did pere riba ride? | SELECT SUM(laps) FROM table_name_52 WHERE rider = "pere riba" |
Name the date for motogp winner of casey stoner and grand prix of valencian grand prix | SELECT date FROM table_name_15 WHERE motogp_winner = "casey stoner" AND grand_prix = "valencian grand prix" |
What are the names of people in ascending order of height? | SELECT Name FROM People ORDER BY Height |
What is the population of northfield parish that has an area less than 342.4? | SELECT SUM(population) FROM table_name_50 WHERE area_km_2 < 342.4 AND official_name = "northfield" |
What is % of All, when Dennis Kucinich is "5%"? | SELECT _percentage_of_all FROM table_name_52 WHERE dennis_kucinich = "5%" |
Show names of pilots that have more than one record. | SELECT T2.Pilot_name , COUNT(*) FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.pilot_ID = T2.pilot_ID GROUP BY T2.Pilot_name HAVING COUNT(*) > 1 |
What team has 0 points and a contact tired/retired, and 71 laps? | SELECT team FROM table_name_80 WHERE points = 0 AND time_retired = "contact" AND laps = 71 |
What is the total number of population in the year 2005 where the population density 35.9 (/km 2)? | SELECT COUNT(population__2005_) FROM table_1480455_1 WHERE population_density___km_2__ = "35.9" |
Which IHSAA Football Class has a School of wood memorial? | SELECT ihsaa_football_class FROM table_name_71 WHERE school = "wood memorial" |
What are the ids of the problems reported after the date of any problems reported by Rylan Homenick? | SELECT T1.problem_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE date_problem_reported > ( SELECT max(date_problem_reported) FROM problems AS T3 JOIN staff AS T4 ON T3.reported_by_staff_id = T4.staff_id WHERE T4.staff_first_name = "Rylan" AND T4.staff_last_name = "Homenick" ) |
Can you list all driver IDs? | SELECT driverId FROM drivers |
Find the number of people whose age is greater than all engineers. | SELECT COUNT(*) FROM Person WHERE age > (SELECT MAX(age) FROM person WHERE job = 'engineer') |
Show white percentages of cities and the crime rates of counties they are in. | SELECT T1.White, T2.Crime_rate FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID |
Tiger Woods has played less than 21 events and is what rank? | SELECT COUNT(rank) FROM table_name_90 WHERE player = "tiger woods" AND events < 21 |
What is the name and id of the department with the most number of degrees ? | SELECT t2.department_name, t1.department_id FROM degree_programs AS t1 JOIN departments AS t2 ON t1.department_id = t2.department_id GROUP BY t1.department_id ORDER BY COUNT(*) DESC LIMIT 1 |
What is the year and semester with the most courses? | SELECT semester , YEAR FROM SECTION GROUP BY semester , YEAR ORDER BY count(*) DESC LIMIT 1 |
Calculate the average number of students of all universities in 2012. | SELECT AVG(num_students) FROM university_year WHERE year = 2012 |
How many wins has more than 165 against? | SELECT MAX(wins) FROM table_name_80 WHERE against > 165 |
How many of the first 60,000 customers from the place with the highest average income per month have sent a true response to the incentive mailing sent by the marketing department? | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T2.RESPONSE = 'true' ORDER BY T3.INCOME_K DESC LIMIT 1 |
What was the margin of victory when the runner-up was Janet Coles? | SELECT margin_of_victory FROM table_name_48 WHERE runner_s__up = "janet coles" |
How many footnotes did Aruba got on different series code in the year 2002? | SELECT COUNT(T2.SeriesCode) FROM Country AS T1 INNER JOIN FootNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T1.ShortName = 'Aruba' AND T2.Year = 'YR2002' |
Which paper is published in an institution in "USA" and have "Turon" as its second author? | SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "USA" AND t2.authorder = 2 AND t1.lname = "Turon" |
What is the maximal elevation of the summit of the shortest mountain that can be found in the island of Madagaskar? Indicate what type of mountain it is. | SELECT T3.Height, T3.Type FROM island AS T1 INNER JOIN mountainOnIsland AS T2 ON T1.Name = T2.Island INNER JOIN mountain AS T3 ON T3.Name = T2.Mountain WHERE T1.Name = 'Madagaskar' ORDER BY T3.Height DESC LIMIT 1 |
What is the last name of the youngest student? | SELECT LName FROM Student WHERE age = (SELECT min(age) FROM Student) |
How many carries for the player with under 6 yards and an average of over 5? | SELECT COUNT(car) FROM table_name_48 WHERE yards < 6 AND avg > 5 |
What is the age group for figure skating? | SELECT age_groups FROM table_name_40 WHERE sport = "figure skating" |
What is his height? | SELECT Height FROM people where Name = 'Ty Conklin' |
What was the 3rd Party in the Election of 1922? | SELECT 3 AS rd_party FROM table_name_35 WHERE election = "1922" |
Provide the losing team's name in the match ID 336039. | SELECT Team_Name FROM Team WHERE Team_Id = ( SELECT CASE WHEN Team_1 = Match_Winner THEN Team_2 ELSE Team_1 END FROM Match WHERE match_id = 336039 ) |
How many numbers were listed under attendance for March 2? | SELECT COUNT(location_attendance) FROM table_11959669_7 WHERE date = "March 2" |
What are the names of all instructors who have taught a course, as well as the corresponding course id? | SELECT name , course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID = T2.ID |
What is the highest position for less than 42 played? | SELECT MAX(position) FROM table_name_48 WHERE played < 42 |
List all countries of markets in ascending alphabetical order. | SELECT Country FROM market ORDER BY Country ASC |
Who has a walking data of 214.061km? | SELECT athlete FROM table_name_66 WHERE data = "214.061km" |
How many episodes had a production code 120? | SELECT COUNT(series__number) FROM table_27720737_1 WHERE production_code = 120 |
What was arrows racing team's highest points after 1982? | SELECT MAX(points) FROM table_name_51 WHERE entrant = "arrows racing team" AND year > 1982 |
How many lessons taught by staff whose first name has letter 'a' in it? | SELECT count(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE "%a%" |
What is the average height of the male Olympic competitors from Finland? | SELECT AVG(T3.height) FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Finland' AND T3.gender = 'M' |
How many points did the visiting team score at south melbourne? | SELECT away_team AS score FROM table_name_94 WHERE home_team = "south melbourne" |
Name the title that was written by r. scott gemmill | SELECT title FROM table_17356042_1 WHERE written_by = "R. Scott Gemmill" |
Name the overall record for indian river | SELECT overall_record FROM table_name_9 WHERE school = "indian river" |
What are the ids of those? | SELECT project_id FROM Projects WHERE organisation_id IN ( SELECT organisation_id FROM Projects GROUP BY organisation_id ORDER BY count ( * ) DESC LIMIT 1 ) |
What is the total amount of money Mary Smith has spent on film rentals? | SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' |
What are the names of procedures physician John Wen was trained in? | SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" |
How many chapters does the character Demetrius show in the story? | SELECT COUNT(DISTINCT T2.chapter_id) FROM characters AS T1 INNER JOIN paragraphs AS T2 ON T1.id = T2.character_id WHERE T1.CharName = 'Demetrius' |
Identify by conference full name all papers in which a journal was not published but a conference. | SELECT T2.FullName FROM Paper AS T1 INNER JOIN Conference AS T2 ON T1.ConferenceId = T2.Id WHERE T1.ConferenceId != 0 AND T1.JournalId = 0 AND T1.Year != 0 |
What is the weight in pounds of the style that is produced the most by the company? If there are multiple products sharing the same weight, indicate the name of each one of them and their corresponding weights. | SELECT Weight FROM Product WHERE WeightUnitMeasureCode = 'LB' GROUP BY Weight ORDER BY COUNT(Style) DESC LIMIT 1 |
List down the customer IDs and names that start with alphabet "W". | SELECT DISTINCT CustomerID, `Customer Names` FROM Customers WHERE `Customer Names` LIKE 'W%' ORDER BY `Customer Names` DESC |
What are the ages of the oldest and youngest user that were surveyed? Indicate their user id. | SELECT MAX(T1.AnswerText), MIN(T1.AnswerText) , ( SELECT T1.UserID FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 1 ORDER BY T1.AnswerText LIMIT 1 ) AS "youngest id" FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 1 |
What is the age group of most OPPO users? | SELECT T.`group` FROM ( SELECT T1.`group`, COUNT(T1.`group`) AS num FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T2.phone_brand = 'OPPO' GROUP BY T1.`group` ) AS T ORDER BY T.num DESC LIMIT 1 |
State the origin country of the fastest car in the database. | SELECT T3.country FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country ORDER BY T1.horsepower DESC LIMIT 1 |
State the game publisher IDs of the games with a platform ID of 16. | SELECT T.game_publisher_id FROM game_platform AS T WHERE T.platform_id = 16 |
Which episode did the composer win for Outstanding Music Composition for a Series (Original Dramatic Score) with more than 200 votes? | SELECT DISTINCT T1.episode_id FROM Award AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.role = 'composer' AND T1.award = 'Outstanding Music Composition for a Series (Original Dramatic Score)' AND T2.votes > 200; |
what is the throughput (including analysis) when the analysis time is 4 hours? | SELECT throughput__including_analysis_ FROM table_name_77 WHERE analysis_time = "4 hours" |
What is the store email of the store chain South? | SELECT T1.store_email FROM department_stores AS T1 JOIN department_store_chain AS T2 ON T1.dept_store_chain_id = T2.dept_store_chain_id WHERE T2.dept_store_chain_name = "West" |
What is the total when the score of set 1 is 15–11? | SELECT total FROM table_name_5 WHERE set_1 = "15–11" |
Who is the artist with the least number of exhibitions? | SELECT * FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id ORDER BY count ( * ) LIMIT 1 |
What is the album number for the record 情歌没有告诉你, simplified from the traditional Chinese name? | SELECT album_number FROM table_name_66 WHERE chinese__simplified_ = "情歌没有告诉你" |
How many postal points with unique post office types are there in Ohio? | SELECT COUNT(T2.zip_code) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Ohio' AND T2.type = 'Unique Post Office' |
Which label was in the United Kingdom region? | SELECT label FROM table_name_17 WHERE region = "united kingdom" |
What is the fewest number of laps for a Dale Coyne Racing team with a mechanical time/retired and fewer than 5 points? | SELECT MIN(laps) FROM table_name_85 WHERE team = "dale coyne racing" AND time_retired = "mechanical" AND points < 5 |
Give the maximum and minimum weeks on top across all volumes. | SELECT max(Weeks_on_Top) , min(Weeks_on_Top) FROM volume |
What are the first names and ids for customers who have two or more accounts? | SELECT T2.customer_first_name , T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2 |
What's the latest year with a hometown of san carlos, pangasinan? | SELECT MAX(year) FROM table_name_50 WHERE hometown = "san carlos, pangasinan" |
Which week had an attendance of 70,225 | SELECT MIN(week) FROM table_name_27 WHERE attendance = "70,225" |
What are the ids and trade names of the medicine that can interact with at least 3 enzymes? | SELECT T1.id , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 3 |
show names of technicians by order of quality rank of machine they are assigned from worst to best | SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID ORDER BY T2.quality_rank |
What is the Pick # for the Edmonton Eskimos? | SELECT COUNT(pick__number) FROM table_name_14 WHERE cfl_team = "edmonton eskimos" |
What is the nationality of the player from Duke? | SELECT nationality FROM table_name_18 WHERE school_club_team = "duke" |
Which currency pair's average exchange rate for the day is the highest? | SELECT FromCurrencyCode, ToCurrencyCode FROM CurrencyRate ORDER BY AverageRate DESC LIMIT 1 |
What year shows the Entrant of bmw motorsport? | SELECT SUM(year) FROM table_name_15 WHERE entrant = "bmw motorsport" |
Give the location id of West Sussex State. | SELECT DISTINCT LocationID FROM location WHERE State = 'West Sussex' |
Can you tell me the ids of the movies not reviewed by Brittany Harris? | SELECT mID FROM Rating EXCEPT SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = "Brittany Harris" |
What name has the highest followers? | SELECT name FROM user_profiles ORDER BY followers DESC LIMIT 1 |
Tell the number of movies made by Paramount Animation. | SELECT COUNT(T2.movie_id) FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id WHERE T1.company_name = 'Paramount Animation' |
Who were the comptrollers of the parties associated with the delegates from district 1 or district 2? | SELECT T2.Comptroller FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2 |
What is Date, when Away Team is "Liverpool"? | SELECT date FROM table_name_91 WHERE away_team = "liverpool" |
Show the total number of rooms of the apartments in the building with short name "Columbus Square". | SELECT sum(T2.room_count) FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_short_name = "Columbus Square" |
Find the average rank of winners in all matches. | SELECT avg(winner_rank) FROM matches |
Who was the opponent after week 9 with an attendance of 44,020? | SELECT opponent FROM table_name_96 WHERE week > 9 AND attendance = "44,020" |
When dydek (11) has the highest rebounds what is the date? | SELECT date FROM table_18904831_6 WHERE high_rebounds = "Dydek (11)" |
What position did the draft pick number play that was overall pick number 133? | SELECT position FROM table_name_20 WHERE overall = 133 |
list the name of college in az? | SELECT cName FROM College WHERE state = 'AZ' |
How much is the amount of transaction for transaction with id 3 | SELECT amount_of_transaction from transactions where transaction_id = 3 |
What is the most common allergy among patients? | SELECT DESCRIPTION FROM allergies GROUP BY DESCRIPTION ORDER BY COUNT(DESCRIPTION) DESC LIMIT 1 |
What are the names of high schoolers who have a grade of over 5 and have 2 or more friends? | SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id WHERE T2.grade > 5 GROUP BY T1.student_id HAVING count(*) >= 2 |
What is the series name and country of all TV channels that are playing cartoons directed by Ben Jones and cartoons directed by Michael Chang? | SELECT T1.series_name , T1.country FROM TV_Channel AS T1 JOIN cartoon AS T2 ON T1.id = T2.Channel WHERE T2.directed_by = 'Michael Chang' INTERSECT SELECT T1.series_name , T1.country FROM TV_Channel AS T1 JOIN cartoon AS T2 ON T1.id = T2.Channel WHERE T2.directed_by = 'Ben Jones' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.