sentence
stringlengths 3
347
| sql
stringlengths 18
804
|
---|---|
What are the names of accounts with checking balances greater than the average checking balance and savings balances below the average savings balance? | SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance > (SELECT avg(balance) FROM checking) INTERSECT SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT avg(balance) FROM savings) |
List player's first name and last name who received salary from team Washington Nationals in both 2005 and 2007? | SELECT T2.name_first , T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2005 AND T3.name = 'Washington Nationals' INTERSECT SELECT T2.name_first , T2.name_last FROM salary AS T1 JOIN player AS T2 ON T1.player_id = T2.player_id JOIN team AS T3 ON T3.team_id_br = T1.team_id WHERE T1.year = 2007 AND T3.name = 'Washington Nationals' |
How many airlines are there? | SELECT count ( * ) FROM airlines |
What's the United States team that played for the Grizzlies in 1995-1996? | SELECT school_club_team FROM table_name_51 WHERE nationality = "united states" AND years_for_grizzlies = "1995-1996" |
What is the date of enrollment in the course named "advanced database"? | SELECT T2.date_of_enrolment FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "advanced database" |
Please give the order number and product name of the order which has the lowest unit price. | SELECT T1.OrderNumber, T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE REPLACE(T1.`Unit Price`, ',', '') = ( SELECT REPLACE(T1.`Unit Price`, ',', '') FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID ORDER BY REPLACE(T1.`Unit Price`, ',', '') LIMIT 1 ) |
What is the highest attendance for the match against west ham united at the venue of a? | SELECT MAX(attendance) FROM table_name_42 WHERE venue = "a" AND opponent = "west ham united" |
What is the elevation and height for Halfbeak? | SELECT elevation_ + _height FROM table_name_21 WHERE name = "halfbeak" |
Which title has 147 as no. in series? | SELECT title FROM table_2818164_7 WHERE no_in_series = 147 |
What is the last date of the staff leaving the projects? | SELECT date_to FROM Project_Staff ORDER BY date_to DESC LIMIT 1 |
How many pairs of positively correlated genes are both non-essential? | SELECT COUNT(T2.GeneID2) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr > 0 AND T1.Essential = 'Non-Essential' |
What is the total trip duration made within Palo Alto city? Convert the duration to hour. | SELECT CAST(SUM(T1.duration) AS REAL) / 3600 FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'Palo Alto' |
Where were less than 72 goals made and more than 40 assists made? | SELECT venue FROM table_name_74 WHERE goals < 72 AND assists > 40 |
Provide the ranking system ID of the Center for World University Rankings. | SELECT id FROM ranking_system WHERE system_name = 'Center for World University Rankings' |
what is the City Population of Attock District | SELECT city_population FROM district where District_name = "Attock District" |
What is the venue of the match on 5 April 2000? | SELECT venue FROM table_name_45 WHERE date = "5 april 2000" |
What was the earliest year that had a location of Brookline, Massachusetts? | SELECT MIN(year) FROM table_name_78 WHERE location = "brookline, massachusetts" |
List all the directions of the trains that have empty cars. | SELECT T2.direction FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.load_num = 0 |
Sort all the distinct product names in alphabetical order. | SELECT DISTINCT product_name FROM product ORDER BY product_name |
Which player gradyated from Florida State? | SELECT player FROM table_name_76 WHERE school_club_team = "florida state" |
On what Date is the Blue Coalition 8,80%? | SELECT date FROM table_name_62 WHERE blue_coalition = "8,80%" |
Under which categories is Yelp_Business no. 1? | SELECT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id WHERE T2.business_id = 1 |
Can you display only the number of rooms currently in the table? | SELECT room_number FROM classroom WHERE capacity > 50 |
find the check in and out for the code 10105 | SELECT checkin, checkout FROM Reservations WHERE code = 10105 |
In which year were howard cosell and jack whitaker reporters and s analyst is bill hartack? | SELECT MIN(year) FROM table_22514845_4 WHERE reporters = "Howard Cosell and Jack Whitaker" AND s_analyst = "Bill Hartack" |
Find the emails of the user named "Mary". | SELECT email FROM user_profiles WHERE name = 'Mary' |
What is the minimum 2010 population of Edgewater? | SELECT MIN(population__2010_) FROM table_249512_2 WHERE place_name = "Edgewater" |
Name the date for game 8 | SELECT date FROM table_21091157_1 WHERE game = 8 |
If the Original Air Date is 10January2008, what directors released on that date? | SELECT director FROM table_11642945_1 WHERE original_air_date = "10January2008" |
How many trips stated from a station in Mountain View and ended at one in Palo Alto? | SELECT count(*) FROM station AS T1 JOIN trip AS T2 JOIN station AS T3 JOIN trip AS T4 ON T1.id = T2.start_station_id AND T2.id = T4.id AND T3.id = T4.end_station_id WHERE T1.city = "Mountain View" AND T3.city = "Palo Alto" |
How many movie lists were created by user 83373278 when he or she was a subscriber? | SELECT COUNT(*) FROM lists_users WHERE user_id = 83373278 AND user_subscriber = 1 |
What is the average quantity of Ikura ordered in one order? | SELECT CAST(SUM(T2.Quantity) AS REAL) / COUNT(T2.OrderID) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductName = 'Ikura' |
Give the web site address for the school in "PA" state with the highest latitude. | SELECT DISTINCT T1.site FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.state = T1.state WHERE T2.state_abbr = 'PA' AND T1.lat_y = ( SELECT MAX(T1.lat_y) FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.state = T1.state WHERE T2.state_abbr = 'PA' ) |
Calculate the percentage of recipes with no cholesterol included and have a cooking time less than 20 minutes among all recipes. | SELECT CAST(SUM(CASE WHEN T1.cook_min < 20 AND T2.cholestrl = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id |
Who was the winner of Stage 9 when then general classification was Danilo Di Luca? | SELECT winner FROM table_name_60 WHERE general_classification = "danilo di luca" AND stage = "9" |
What is the position for Jani Lajunen? | SELECT position FROM table_name_78 WHERE player = "jani lajunen" |
Calculate the percentage of country which gained independence as republic after 1970. | SELECT CAST(SUM(CASE WHEN Government = 'republic' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Country) FROM politics WHERE STRFTIME('%Y', Independence) > '1970' |
Show the status shared by cities with population bigger than 1500 and smaller than 500. | SELECT Status FROM city WHERE Population > 1500 INTERSECT SELECT Status FROM city WHERE Population < 500 |
What club had 0 goals? | SELECT club FROM table_name_4 WHERE goals = 0 |
How many tries for did the club with a 3 losing bonus and 45 points have? | SELECT tries_for FROM table_name_12 WHERE losing_bonus = "3" AND points = "45" |
what is the product type code for red jeans | SELECT distinct ( product_type_code ) FROM products WHERE product_name = "red jeans" |
What is the maximum total amount paid by a customer? List the customer id and amount. | SELECT customer_id , sum(amount_paid) FROM Payments GROUP BY customer_id ORDER BY sum(amount_paid) DESC LIMIT 1 |
Show the different countries and the number of members from each. | SELECT Country , COUNT(*) FROM member GROUP BY Country |
Which Time has a Grid of 19? | SELECT time FROM table_name_59 WHERE grid = 19 |
Count the number of exhibitions that happened in or after 2005. | SELECT count(*) FROM exhibition WHERE YEAR >= 2005 |
How many students does LORIA ONDERSMA teaches? | SELECT COUNT(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "LORIA" AND T2.lastname = "ONDERSMA" |
What is the latest year when the best finish is 2 and the scoring average is less than 71.24? | SELECT MAX(year) FROM table_name_51 WHERE best_finish = "2" AND scoring_average < 71.24 |
What was the record on the game played on July 1? | SELECT record FROM table_18894744_6 WHERE date = "July 1" |
What is the winning coach total number if the top team in regular season (points) is the Kansas City Spurs (110 points)? | SELECT COUNT(winning_coach) FROM table_237757_3 WHERE top_team_in_regular_season__points_ = "Kansas City Spurs (110 points)" |
List the names of all the distinct customers who bought a keyboard. | SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id JOIN products AS T4 ON T3.product_id = T4.product_id WHERE T4.product_name = "keyboard" |
What year did was the Inside Soap Awards won? | SELECT AVG(year) FROM table_name_41 WHERE result = "won" AND award = "inside soap awards" |
what is the date when the location attendance is energysolutions arena 19,911? | SELECT date FROM table_27715173_8 WHERE location_attendance = "EnergySolutions Arena 19,911" |
How many users who have joined Yelp since "2005" but have no fans? | SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year = 2005 AND user_fans LIKE 'None' |
What is the room number of Chemistry? | SELECT Room FROM DEPARTMENT WHERE DName = "Chemistry" |
What is GDP 2012 Millions of Euro, when Population in Millions is less than 1.3, and when GDP (Nominal) Per Capita 2012 Euro is 20,700(p)? | SELECT gdp_2012_millions_of_euro FROM table_name_51 WHERE population_in_millions < 1.3 AND gdp__nominal__per_capita_2012_euro = "20,700(p)" |
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 artist cam from uruguay | SELECT artist FROM table_name_81 WHERE country = "uruguay" |
What is the evening gown score for the contestant from Mississippi? | SELECT evening_gown FROM table_name_4 WHERE state = "mississippi" |
What was the population in Stanthorpe in the year when the population in Rosenthal was 1548? | SELECT MAX(population__stanthorpe_) FROM table_12584173_1 WHERE population__rosenthal_ = 1548 |
How many "cute" type of compliments does user No. 57400 get? | SELECT COUNT(T1.compliment_type) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type LIKE 'cute' AND T2.user_id = 57400 |
Name the class A with school year of 2004-05 | SELECT class_a FROM table_name_59 WHERE school_year = "2004-05" |
Position of running back involves which college? | SELECT college FROM table_name_57 WHERE position = "running back" |
What tournament has a 2010 of 1r, and a 2008 of 1r? | SELECT tournament FROM table_name_4 WHERE 2010 = "1r" AND 2008 = "1r" |
Can you tell me which one of them do not have TV Lounge? | SELECT dorm_name FROM dorm EXCEPT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' |
What are the distinct positions of the players from a country whose capital is Dublin? | SELECT DISTINCT T2.Position FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T1.Capital = "Dublin" |
How many nominations have Billy Kimball received in 2010 for The simpson 20s: Season 20? | SELECT COUNT(award_id) FROM Award WHERE person = 'Billy Kimball' AND SUBSTR(year, 1, 4) = '2010' AND result = 'Nominee'; |
What payment method did that customer use? | SELECT t1.payment_method FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id GROUP BY t1.customer_name ORDER BY sum ( t3.order_quantity ) LIMIT 1 |
What player has 72-67-71=210 as the score? | SELECT player FROM table_name_41 WHERE score = 72 - 67 - 71 = 210 |
How many trains have 'Express' in their names? | SELECT count(*) FROM train WHERE name LIKE "%Express%" |
List at least 10 students who have no payment due and are enlisted in Fire Department organization. | SELECT T1.name FROM no_payment_due AS T1 INNER JOIN enlist AS T2 ON T2.name = T1.name WHERE T1.bool = 'neg' AND T2.organ = 'fire_department' LIMIT 10 |
What name has 50 as the number? | SELECT name FROM table_name_54 WHERE number = "50" |
Find all manufacturers' names and their headquarters, sorted by the ones with highest revenue first. | SELECT name , headquarter FROM manufacturers ORDER BY revenue DESC |
Based on all user compliments, find the percentage of low number of compliments on all compliments ID. | SELECT CAST(SUM(CASE WHEN number_of_compliments = 'Low' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(user_id) FROM Users_compliments |
How many male engineers are there? | SELECT count ( * ) from person where gender = "male" and job = "engineer" |
what was the opponent on november 14, 2005? | SELECT opponent FROM table_name_91 WHERE date = "november 14, 2005" |
List down the game ID of games with genre ID 2. | SELECT T.id FROM game AS T WHERE T.genre_id = 2 |
Tell me Regional Population and GDP for City ID 2 ? | SELECT regional_population, GDP FROM city WHERE city_id = 2 |
Tell me the previous rank for italy with points more than 100 | SELECT Previous AS rank FROM table_name_92 WHERE nationality = "italy" AND points > 100 |
How many votes did Yvetta Kadakas & Ivo Linna, who had less than 4 draws, have? | SELECT SUM(votes) FROM table_name_93 WHERE draw < 4 AND artist = "yvetta kadakas & ivo linna" |
what is the highest pick number of the CFL team, the winnipeg blue bombers? | SELECT MAX(pick__number) FROM table_name_42 WHERE cfl_team = "winnipeg blue bombers" |
What genders can be residents of Dorm-plex 2000? | SELECT gender from dorm where dorm_name = "Dorm-plex 2000" |
What is the highest enrollment schools that joined the mac in 1997? | SELECT MAX(enrollment) FROM table_261906_2 WHERE joined_mac = 1997 |
For which tournament was the margin of victory 7 strokes? | SELECT tournament FROM table_name_50 WHERE margin_of_victory = "7 strokes" |
Describe the product names delivered in 2021 for the customer "Sundial". | SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.DeliveryDate LIKE '%/%/21' AND T1.`Customer Names` = 'Sundial ' THEN T3.`Product Name` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products T3 ON T3.ProductID = T2._ProductID ) WHERE T IS NOT NULL |
what investing dragons aired on episode 10? | SELECT investing_dragon_s_ FROM table_name_31 WHERE episode = "episode 10" |
What Tournament had a Score of 6–3, 2–6, 6–3? | SELECT tournament FROM table_name_13 WHERE score = "6–3, 2–6, 6–3" |
What are the x and y coordinates of all the images with a prediction relationship class id of 98? | SELECT T2.X, T2.Y FROM IMG_REL AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.IMG_ID = T2.IMG_ID WHERE T1.PRED_CLASS_ID = 98 |
In which county can you find the city with the highest number of females? | SELECT T4.county FROM zip_data AS T3 INNER JOIN country AS T4 ON T3.zip_code = T4.zip_code GROUP BY T4.county ORDER BY T3.female_population DESC LIMIT 1 |
What is the name of the menu with the highest number of pages? | SELECT T1.name FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id GROUP BY T2.menu_id ORDER BY COUNT(T2.page_number) DESC LIMIT 1 |
Which guest performer has a track length of 5:49? | SELECT guest_performer FROM table_name_8 WHERE time = "5:49" |
and the role code with the least employees? | SELECT role_code FROM Employees GROUP BY role_code ORDER BY count ( * ) ASC LIMIT 1 |
What is the Friday 4 June if the Wednesday 2 June is 20' 50.62 108.608mph? | SELECT fri_4_june FROM table_25220821_3 WHERE wed_2_june = "20' 50.62 108.608mph" |
Who constructed the car that has a Time/Retired of +2:06.0? | SELECT constructor FROM table_name_67 WHERE time_retired = "+2:06.0" |
Of the matches in all seasons of the Bundesliga division, how many of them ended with a tie? | SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.FTR = 'D' |
Find the names of the clubs that have at least a member from the city with city code "HOU". | SELECT DISTINCT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.city_code = "HOU" |
What is Country , when Rider is Lindsay Porter? | SELECT country FROM table_name_63 WHERE rider = "lindsay porter" |
Count the number of climbers. | SELECT count(*) FROM climber |
Find the titles of all movies not reviewed by Chris Jackson. | SELECT DISTINCT title FROM Movie EXCEPT SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Chris Jackson' |
What date has the competition of uefa euro 2012 qualifying? | SELECT date FROM table_name_77 WHERE competition = "uefa euro 2012 qualifying" |
4512 is the enrollment what is the team nickname? | SELECT team_nickname FROM table_28211213_2 WHERE enrollment = 4512 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.