input
stringlengths
191
7.13k
output
stringlengths
19
578
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the titles of items whose rating is higher than the average review rating of all items. ...
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating > (SELECT avg(rating) FROM review);
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the titles of items that received any rating below 5. [/INST]
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the titles of items that received both a rating higher than 8 and a rating below 5. [/IN...
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating > 8 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the names of items whose rank is higher than 3 and whose average rating is above 5. [/IN...
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rank > 3 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id HAVING avg(T2.rating) > 5;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the name of the item with the lowest average rating. [/INST]
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id ORDER BY avg(T2.rating) LIMIT 1;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: List the titles of all items in alphabetic order . [/INST]
SELECT title FROM item ORDER BY title;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the name of the user who gives the most reviews. [/INST]
SELECT T1.name FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id ORDER BY count(*) DESC LIMIT 1;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the name and id of the item with the highest average rating. [/INST]
SELECT T1.title , T1.i_id FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id ORDER BY avg(T2.rating) DESC LIMIT 1;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the name and id of the good with the highest average rank. [/INST]
SELECT T1.title , T1.i_id FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id ORDER BY avg(T2.rank) DESC LIMIT 1;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: For each user, return the name and the average rating of reviews given by them. [/INST]
SELECT T1.name , avg(T2.rating) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: For each user, find their name and the number of reviews written by them. [/INST]
SELECT T1.name , count(*) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the name of the user who gave the highest rating. [/INST]
SELECT T1.name FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id ORDER BY T2.rating DESC LIMIT 1;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the name of the source user with the highest average trust score. [/INST]
SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.source_u_id GROUP BY T2.source_u_id ORDER BY avg(trust) DESC LIMIT 1;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find each target user's name and average trust score. [/INST]
SELECT T1.name , avg(trust) FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id GROUP BY T2.target_u_id;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the name of the target user with the lowest trust score. [/INST]
SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id ORDER BY trust LIMIT 1;
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the names of the items that did not receive any review. [/INST]
SELECT title FROM item WHERE i_id NOT IN (SELECT i_id FROM review);
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the names of users who did not leave any review. [/INST]
SELECT name FROM useracct WHERE u_id NOT IN (SELECT u_id FROM review);
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the number of users who did not write any review. [/INST]
SELECT count(*) FROM useracct WHERE u_id NOT IN (SELECT u_id FROM review);
Tables: item, review, useracct, trust Columns: item.i_id, item.title, review.a_id, review.u_id, review.i_id, review.rating, review.rank, useracct.u_id, useracct.name, trust.source_u_id, trust.target_u_id, trust.trust Question: Find the number of items without any review. [/INST]
SELECT count(*) FROM item WHERE i_id NOT IN (SELECT i_id FROM review);
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT count(*) FROM player;
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT Player_name FROM player ORDER BY Votes ASC;
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT Gender , Occupation FROM player;
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT Player_name , residence FROM player WHERE Occupation != "Researcher";
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT Sponsor_name FROM player WHERE Residence = "Brandon" OR Residence = "Birtle";
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT Player_name FROM player ORDER BY Votes DESC LIMIT 1;
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT Occupation , COUNT(*) FROM player GROUP BY Occupation;
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT Occupation FROM player GROUP BY Occupation ORDER BY COUNT(*) DESC LIMIT 1;
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT Residence FROM player GROUP BY Residence HAVING COUNT(*) >= 2;
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT T3.Player_name , T2.coach_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_ID = T3.Player_ID;
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT T3.Player_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_ID = T3.Player_ID WHERE T2.Rank = 1;
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT T3.Player_name , T3.gender FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_ID = T3.Player_ID WHERE T1.Starting_year > 2011;
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT T3.Player_name , T2.coach_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_ID = T3.Player_ID ORDER BY T3.Votes DESC;
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT Player_name FROM player WHERE Player_ID NOT IN (SELECT Player_ID FROM player_coach);
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT Residence FROM player WHERE gender = "M" INTERSECT SELECT Residence FROM player WHERE gender = "F";
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT T1.club_id , T1.club_name, count(*) FROM club AS T1 JOIN coach AS T2 ON T1.club_id = T2.club_id GROUP BY T1.club_id;
Tables: player, club, coach, player_coach, match_result Columns: player.Player_ID, player.Sponsor_name, player.Player_name, player.Gender, player.Residence, player.Occupation, player.Votes, player.Rank, club.Club_ID, club.Club_name, club.Region, club.Start_year, coach.Coach_ID, coach.Coach_name, coach.Gender, coach.Clu...
SELECT T1.club_id , T1.gold FROM match_result AS T1 JOIN coach AS T2 ON T1.club_id = T2.club_id GROUP BY T1.club_id ORDER BY count(*) DESC LIMIT 1;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT count(*) FROM gymnast;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT count(*) FROM gymnast;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT Total_Points FROM gymnast ORDER BY Total_Points DESC;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT Total_Points FROM gymnast ORDER BY Total_Points DESC;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT Total_Points FROM gymnast ORDER BY Floor_Exercise_Points DESC;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT Total_Points FROM gymnast ORDER BY Floor_Exercise_Points DESC;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT avg(Horizontal_Bar_Points) FROM gymnast;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT avg(Horizontal_Bar_Points) FROM gymnast;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT Name FROM People ORDER BY Name ASC;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT Name FROM People ORDER BY Name ASC;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID WHERE T2.Hometown != "Santo Domingo";
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID WHERE T2.Hometown != "Santo Domingo";
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT Age FROM people ORDER BY Height DESC LIMIT 1;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT Age FROM people ORDER BY Height DESC LIMIT 1;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT Name FROM People ORDER BY Age DESC LIMIT 5;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT Name FROM People ORDER BY Age DESC LIMIT 5;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT T1.Total_Points FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T2.Age ASC LIMIT 1;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT T1.Total_Points FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T2.Age ASC LIMIT 1;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT avg(T2.Age) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT avg(T2.Age) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID WHERE T1.Total_Points > 57.5;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID WHERE T1.Total_Points > 57.5;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT T2.Hometown , COUNT(*) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT T2.Hometown , COUNT(*) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown ORDER BY COUNT(*) DESC LIMIT 1;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown ORDER BY COUNT(*) DESC LIMIT 1;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown HAVING COUNT(*) >= 2;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown HAVING COUNT(*) >= 2;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T2.Height ASC;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T2.Height ASC;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT DISTINCT Hometown FROM people EXCEPT SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT DISTINCT Hometown FROM people EXCEPT SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT Hometown FROM people WHERE Age > 23 INTERSECT SELECT Hometown FROM people WHERE Age < 20;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT Hometown FROM people WHERE Age > 23 INTERSECT SELECT Hometown FROM people WHERE Age < 20;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT count(DISTINCT Hometown) FROM people;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT count(DISTINCT Hometown) FROM people;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT T2.Age FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T1.Total_Points DESC;
Tables: gymnast, people Columns: gymnast.Gymnast_ID, gymnast.Floor_Exercise_Points, gymnast.Pommel_Horse_Points, gymnast.Rings_Points, gymnast.Vault_Points, gymnast.Parallel_Bars_Points, gymnast.Horizontal_Bar_Points, gymnast.Total_Points, people.People_ID, people.Name, people.Age, people.Height, people.Hometown Questi...
SELECT T2.Age FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T1.Total_Points DESC;
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: Find the total savings balance of all accounts except the account with name ‘Brown’. [/INST]
SELECT sum(T2.balance) FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T1.name != 'Brown';
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: What is the total balance of savings accounts not belonging to someone with the name Brown? [/INST]
SELECT sum(T2.balance) FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T1.name != 'Brown';
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: How many accounts are there in total? [/INST]
SELECT count(*) FROM accounts;
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: Count the number of accounts. [/INST]
SELECT count(*) FROM accounts;
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: What is the total checking balance in all accounts? [/INST]
SELECT sum(balance) FROM checking;
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: Find the total balance across checking accounts. [/INST]
SELECT sum(balance) FROM checking;
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: Find the average checking balance. [/INST]
SELECT avg(balance) FROM checking;
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: What is the average balance in checking accounts? [/INST]
SELECT avg(balance) FROM checking;
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: How many accounts have a savings balance above the average savings balance? [/INST]
SELECT count(*) FROM savings WHERE balance > (SELECT avg(balance) FROM savings);
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: Find the number of accounts with a savings balance that is higher than the average savings balance. [/INST]
SELECT count(*) FROM savings WHERE balance > (SELECT avg(balance) FROM savings);
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: Find the name and id of accounts whose checking balance is below the maximum checking balance. [/INST]
SELECT T1.custid , T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT max(balance) FROM checking);
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: What are the customer id and name corresponding to accounts with a checking balance less than the largest checking balance? [/INST]
SELECT T1.custid , T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT max(balance) FROM checking);
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: What is the checking balance of the account whose owner’s name contains the substring ‘ee’? [/INST]
SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T1.name LIKE '%ee%';
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: Find the balance of the checking account belonging to an owner whose name contains 'ee'. [/INST]
SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T1.name LIKE '%ee%';
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: Find the checking balance and saving balance in the Brown’s account. [/INST]
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 T1.name = 'Brown';
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: What are the checking and savings balances in accounts belonging to Brown? [/INST]
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 T1.name = 'Brown';
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: Find the names of accounts whose checking balance is above the average checking balance, but savings balance is below the average savings balance. [/INST]
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);
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: What are the names of accounts with checking balances greater than the average checking balance and savings balances below the average savings balance? [/INST]
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);
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: Find the checking balance of the accounts whose savings balance is higher than the average savings balance. [/INST]
SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T1.name IN (SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T2.balance > (SELECT avg(balance) FROM savings));
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: What are the balances of checking accounts belonging to people with savings balances greater than the average savings balance? [/INST]
SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T1.name IN (SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T2.balance > (SELECT avg(balance) FROM savings));
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: List all customers’ names in the alphabetical order. [/INST]
SELECT name FROM accounts ORDER BY name;
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: What are the names of all the customers in alphabetical order? [/INST]
SELECT name FROM accounts ORDER BY name;
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: Find the name of account that has the lowest total checking and saving balance. [/INST]
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;
Tables: ACCOUNTS, SAVINGS, CHECKING Columns: ACCOUNTS.custid, ACCOUNTS.name, SAVINGS.custid, SAVINGS.balance, CHECKING.custid, CHECKING.balance Question: What is the name corresponding to the accoung with the lowest sum of checking and savings balances? [/INST]
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;