sentence
stringlengths
3
347
sql
stringlengths
18
804
What are the names of all songs that have a lower rating than some song of blues genre?
SELECT song_name FROM song WHERE rating < (SELECT max(rating) FROM song WHERE genre_is = "blues")
How many episodes were directed by Arlene Sanford?
SELECT COUNT(written_by) FROM table_26429658_1 WHERE directed_by = "Arlene Sanford"
Show the industries shared by companies whose headquarters are "USA" and companies whose headquarters are "China".
SELECT Industry FROM Companies WHERE Headquarters = "USA" INTERSECT SELECT Industry FROM Companies WHERE Headquarters = "China"
How many points against did Carmarthen Athletic RFC have when they played 22 games ?
SELECT points_against FROM table_name_32 WHERE played = "22" AND club = "carmarthen athletic rfc"
What is the Japanese orthography for the English name National Farmers Academy?
SELECT japanese_orthography FROM table_11390711_4 WHERE english_name = "National Farmers Academy"
How many athletes over the age of 59 competed in the 2016 Summer Olympics?
SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name = '2016 Summer' AND T2.age > 59
What are the star rating descriptions of the hotels with price above 10000?
SELECT T2.star_rating_description FROM HOTELS AS T1 JOIN Ref_Hotel_Star_Ratings AS T2 ON T1.star_rating_code = T2.star_rating_code WHERE T1.price_range > 10000
What is detail of the student who most recently registered course?
SELECT T2.student_details FROM student_course_registrations AS T1 JOIN students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.registration_date DESC LIMIT 1
What are the first names of the customers with the last name Mertz?
SELECT first_name FROM Staff where last_name = 'Mertz'
What are their full names and the names of the food allergies they have?
SELECT T3.Fname, T3.Lname,T2.Allergy FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy JOIN Student as T3 on T3.StuID = T1.StuID WHERE T2.allergytype = "food" and T3.sex = 'M'
What is the percentage of larceny cases among all cases that happened in Edgewater community?
SELECT CAST(SUM(CASE WHEN T3.title = 'Larceny' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.case_number) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no INNER JOIN FBI_Code AS T3 ON T2.fbi_code_no = T3.fbi_code_no WHERE T1.community_area_name = 'Edgewater'
Against which team was game 21?
SELECT team FROM table_17001658_6 WHERE game = 21
For which countries are there more than four distinct addresses listed?
SELECT country FROM addresses GROUP BY country HAVING count(address_id) > 4
What is the manner of departure for the date of appointment 24 may 2010?
SELECT manner_of_departure FROM table_26998135_2 WHERE date_of_appointment = "24 May 2010"
The name cheung, raymond man-to is listed as a romanised name is cheung, raymond man-to?
SELECT foreign_nationality FROM table_17964087_2 WHERE romanised_name = "Cheung, Raymond Man-to"
what country is Vijay Singh from?
SELECT Country FROM artist where Name = 'Vijay Singh'
Which event had a score of over 673 points?
SELECT event FROM table_name_72 WHERE score > 673
What is the name of the storm with the lowest speed?
SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id Order by Max_speed limit 1
What is the lowest number of blocks for players with height of 206 and more than 356 spikes?
SELECT MIN(block) FROM table_name_69 WHERE height = 206 AND spike > 356
Which player, born in Winter Haven, played 12 minutes per season during the 1980s in the All-Stars?
SELECT DISTINCT T1.firstName, T1.middleName, T1.lastName FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T1.birthCity = 'Winter Haven' AND T2.season_id BETWEEN 1980 AND 1989 AND T2.minutes = 12
What was the winning team when mikhail goikhberg was the winning driver?
SELECT winning_team FROM table_25668203_2 WHERE winning_driver = "Mikhail Goikhberg"
What are the resident details containing the substring 'Miss'?
SELECT other_details FROM Residents WHERE other_details LIKE '%Miss%'
Which show had a part 3 before 2011?
SELECT show FROM table_name_45 WHERE year < 2011 AND episode_title = "part 3"
What is the Date for the actual title archie bunker's place?
SELECT date FROM table_name_42 WHERE actual_title = "archie bunker's place"
What is the average rating star for each reviewer?
SELECT T2.name , avg(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name
What's the title for year n.m.?
SELECT title FROM table_name_43 WHERE year = "n.m."
What is then engine when the notes state srt8?
SELECT engine FROM table_name_91 WHERE notes = "srt8"
in what year the position was the 9th
SELECT season FROM table_29697744_1 WHERE position = "9th"
What was the score when Bolton Wanderers were the away team?
SELECT score FROM table_name_38 WHERE away_team = "bolton wanderers"
what is the location when the designer is glen peloso and the restaurant is joe boo's cookoos?
SELECT location FROM table_name_48 WHERE designer = "glen peloso" AND restaurant_name = "joe boo's cookoos"
Which transfer window was moving from borussia dortmund?
SELECT transfer_window FROM table_name_38 WHERE moving_from = "borussia dortmund"
Which 2012 has a 2007 of 1r, and a 2008 of 1r, and a 2013 of 2r?
SELECT 2012 FROM table_name_75 WHERE 2007 = "1r" AND 2008 = "1r" AND 2013 = "2r"
Find the name of account that has the lowest total checking and saving balance.
SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T2.balance + T3.balance LIMIT 1
Which statuses correspond to both cities that have a population over 1500 and cities that have a population lower than 500?
SELECT Status FROM city WHERE Population > 1500 INTERSECT SELECT Status FROM city WHERE Population < 500
What is the povery rate of the county with market income per capita of $20,518?
SELECT poverty_rate FROM table_22815568_1 WHERE market_income_per_capita = "$20,518"
How many of these are sandwich restaurants?
SELECT count ( * ) FROM Restaurant JOIN Type_Of_Restaurant ON Restaurant.ResID = Type_Of_Restaurant.ResID JOIN Restaurant_Type ON Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID GROUP BY Type_Of_Restaurant.ResTypeID HAVING Restaurant_Type.ResTypeName = 'Sandwich'
Which Opponent was played on 1991-10-13?
SELECT opponent FROM table_name_52 WHERE date = "1991-10-13"
What is the date with Ellis as the decision and St. Louis as the visitor?
SELECT date FROM table_name_27 WHERE decision = "ellis" AND visitor = "st. louis"
What is the name of the venue where the game played had an away team of Melbourne?
SELECT venue FROM table_name_5 WHERE away_team = "melbourne"
Find the salary and manager number for those employees who is working under a manager.
SELECT salary, manager_id FROM employees WHERE manager_id <> "null"
What is the Surface of the match with a Score of 2–6, 6–4, 7–6?
SELECT surface FROM table_name_30 WHERE score = "2–6, 6–4, 7–6"
What country is Stephen Ames from with a place value of t9?
SELECT country FROM table_name_20 WHERE place = "t9" AND player = "stephen ames"
Can you filter that list to show the document name and document structure code with the fewest document structure code entries, or in other words, the least popular structure?
SELECT document_name,document_structure_code FROM documents where document_structure_code = ( select min ( document_structure_code ) from documents )
What was the result on 10/06/1934?
SELECT result FROM table_name_80 WHERE date = "10/06/1934"
Which country has a Col (m) of 1374?
SELECT country FROM table_name_33 WHERE col__m_ = 1374
Show names of teachers that teach at least two courses.
SELECT T2.Name FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name HAVING COUNT(*) >= 2
Return complaint status codes have more than 3 corresponding complaints?
SELECT complaint_status_code FROM complaints GROUP BY complaint_status_code HAVING count(*) > 3
What was the title of the song that peaked the charts at #1 with track 20?
SELECT song_title FROM table_name_78 WHERE chart_peak = "#1" AND track = 20
What is Bob's friend's name?
SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Bob'
what is the location where the record is 1-0
SELECT ahli FROM table_26173058_2 WHERE ramtha = "1-0"
List movie titles with duration over 120 minutes that are in the action category.
SELECT T1.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T3.category_id = T2.category_id WHERE T3.`name` = 'action' AND T1.length > 120
What is the earliest year with a Drama Desk award when the Mineola Twins was a nominated work?
SELECT MIN(year) FROM table_name_90 WHERE award = "drama desk award" AND nominated_work = "the mineola twins"
Which position has new Jersey Devils as the nhl team?
SELECT position FROM table_2897457_3 WHERE nhl_team = "New Jersey Devils"
Find the highest rank of losers in all matches.
SELECT min(loser_rank) FROM matches
Provide eateries' IDs, risk categories and descriptions with violation ID of 103101.
SELECT business_id, risk_category, description FROM violations WHERE violation_type_id = '103101'
And what about the lowest 3?
SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased ASC LIMIT 3
Can you tell me the Matches that has the Rank smaller than 6, and the Years of 1943-62?
SELECT matches FROM table_name_55 WHERE rank < 6 AND years = "1943-62"
Name the most numbers dam and gnis query link for borough or census area for fairbanks north star
SELECT MAX(_number_s_dam_and_gnis_query_link) FROM table_18760137_2 WHERE borough_or_census_area = "Fairbanks North Star"
What is the previous team of the player with 4 NBA years and a pick less than 16?
SELECT previous_team FROM table_name_12 WHERE nba_years_[a_] = "4" AND pick < 16
Who did the argonauts play against during the game that had 19,423 fans in attendance?
SELECT opponent FROM table_name_45 WHERE attendance = "19,423"
Which nationality has left wing as the position and college/junior/team is portland winterhawks (whl)?
SELECT nationality FROM table_2886617_3 WHERE position = "Left Wing" AND college_junior_club_team = "Portland Winterhawks (WHL)"
Show order ids and the total quantity in each order.
SELECT order_id , sum(product_quantity) FROM Order_items GROUP BY order_id
What are all the the participant ids, type code and details?
SELECT Participant_ID , Participant_Type_Code , Participant_Details FROM Participants
What are the first and last name for those employees who works either in department 70 or 90?
SELECT first_name , last_name FROM employees WHERE department_id = 70 OR department_id = 90
What country has a series premier of unknown and mbc action as their TV network?
SELECT country FROM table_name_27 WHERE series_premiere = "unknown" AND tv_network_s_ = "mbc action"
Please indicate the opening day of businesses whose category is pets.
SELECT DISTINCT T4.day_of_week FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business_Hours AS T3 ON T1.business_id = T3.business_id INNER JOIN Days AS T4 ON T3.day_id = T4.day_id WHERE T2.category_name = 'Pets'
How many rounds have goalie as the position?
SELECT SUM(round) FROM table_name_26 WHERE position = "goalie"
How many Losses have a Geelong FL of newtown & chilwell, and more than 11 wins?
SELECT COUNT(losses) FROM table_name_23 WHERE geelong_fl = "newtown & chilwell" AND wins > 11
What languages are only used by a single country with a republic government?
SELECT T2.Language FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.GovernmentForm = "Republic" GROUP BY T2.Language HAVING COUNT(*) = 1
How many accounts are in Bothell as opposed to Kenmore? What is the name of the State that comprises these two cities?
SELECT SUM(IIF(T1.city = 'Bothell', 1, 0)) - SUM(IIF(T1.city = 'Kenmore', 1, 0)) , stateprovincecode FROM Address AS T1 INNER JOIN StateProvince AS T2 ON T1.stateprovinceid = T2.stateprovinceid GROUP BY stateprovincecode
Find the name, checking balance and savings balance of all accounts in the bank sorted by their total checking and savings balance in descending order.
SELECT T2.balance , T3.balance , T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T2.balance + T3.balance DESC
How many Joint Music Awards were there with a RTHK of 1, in a Year before 2006?
SELECT joint_music_award FROM table_name_81 WHERE year < 2006 AND rthk = "1"
In the match where newcastle jets was the away team, what was the crown attendance?
SELECT crowd FROM table_name_79 WHERE away_team = "newcastle jets"
Which Class Pos have Laps smaller than 304, and a Year after 2001?
SELECT class AS pos FROM table_name_79 WHERE laps < 304 AND year > 2001
Who is the Sales Agent for the company 'Eastern Connection'?
SELECT ContactName FROM Customers WHERE CompanyName = 'Eastern Connection' AND ContactTitle = 'Sales Agent'
What place is the player from the United States with a to par of e?
SELECT place FROM table_name_1 WHERE country = "united states" AND to_par = "e"
What is the lowest round that Adam Wiesel was picked?
SELECT MIN(round) FROM table_name_9 WHERE player = "adam wiesel"
What municipality is the Harmon Cove station located in?
SELECT municipality FROM table_name_58 WHERE station = "harmon cove"
WHAT WAS THE SCORE OF THE GAME WITH A 2007-03-06, 20:45 KICKOFF?
SELECT result FROM table_name_50 WHERE kick_off = "2007-03-06, 20:45"
That was very quick, thank you very much :) Then, could you please let me know the average duration (milliseconds) of Latin and Pop?
SELECT AVG ( Milliseconds ) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Latin" OR T1.Name = "Pop"
What are the female names in weddings after 2014?
SELECT T3.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id = T2.people_id JOIN people AS T3 ON T1.female_id = T3.people_id WHERE T1.year > 2014
How many activities does Mark Giuliano participate in?
SELECT count(*) FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID WHERE T1.fname = "Mark" AND T1.lname = "Giuliano"
what is score of a team with tie of 4?
SELECT score FROM table_name_38 WHERE tie_no = "4"
Return the number of routes with destination airport in Italy operated by the airline with name 'American Airlines'.
SELECT count(*) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid JOIN airlines AS T3 ON T1.alid = T3.alid WHERE T2.country = 'Italy' AND T3.name = 'American Airlines'
How many games are free of injury accidents?
SELECT count(*) FROM game WHERE id NOT IN ( SELECT game_id FROM injury_accident )
When was the incumbent from the south carolina 1 district first elected?
SELECT first_elected FROM table_name_56 WHERE district = "south carolina 1"
What is the phone number for the employee in charge of the Portsmouth territory?
SELECT T1.HomePhone FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T3.TerritoryDescription = 'Portsmouth'
Show first name and id for all customers with at least 2 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
Find the percentage of male students enlisted in the fire department.
SELECT CAST(COUNT(T2.name) AS REAL) * 100 / COUNT(T1.name) FROM enlist AS T1 LEFT JOIN male AS T2 ON T1.name = T2.name WHERE T1.organ = 'fire_department'
What is the total number of all football games played by scholarship students?
SELECT sum(gamesplayed) FROM Sportsinfo WHERE sportname = "Football" AND onscholarship = 'Y'
Which Date has a Score of 112–118?
SELECT date FROM table_name_58 WHERE score = "112–118"
What is the name of the category which most users belong to?
SELECT T.category FROM ( SELECT T2.category, COUNT(T1.app_id) AS num FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T2.label_id = T1.label_id GROUP BY T1.app_id, T2.category ) AS T ORDER BY T.num DESC LIMIT 1
What is the away team of the UEFA champions league?
SELECT away FROM table_name_67 WHERE competition = "uefa champions league"
What are the different document types?
SELECT distinct Document_Type_Code FROM Documents
What was the date of the game when the away team was south melbourne?
SELECT date FROM table_name_77 WHERE away_team = "south melbourne"
What was the score for the game against Atlanta?
SELECT score FROM table_name_6 WHERE visitor = "atlanta"
List down the match ID of matches that the "man of the match" award was given to BB McCullum.
SELECT T1.Match_Id FROM Match AS T1 INNER JOIN Player AS T2 ON T2.Player_Id = T1.Man_of_the_Match WHERE T2.Player_Name = 'BB McCullum'
That's great, thank you. Then could you please let me know what is the sum of those two accounts?
SELECT T2.balance + T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T3.balance > ( SELECT avg ( balance ) FROM savings )
Find the name of the activity that has the largest number of student participants.
SELECT T1.activity_name FROM Activity AS T1 JOIN Participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID ORDER BY count(*) DESC LIMIT 1
What are the positions of players whose average number of points scored by that position is larger than 20?
SELECT POSITION FROM player GROUP BY name HAVING avg(Points) >= 20