interaction_utterance
sequencelengths
0
6
interaction_query
sequencelengths
0
6
final_utterance
stringlengths
19
224
final_query
stringlengths
22
577
db_id
stringclasses
140 values
[ "Give me movies that are directed by James Cameron.", "What about those that also produced after 2000 at the same time?" ]
[ "SELECT title FROM MOVIE WHERE director = 'James Cameron'", "SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR > 2000" ]
What is the name of the movie produced after 2000 and directed by James Cameron?
SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR > 2000
movie_1
[ "Give me the name of all reviewers.", "Whose name contains \"Mike\"?", "What about his id?" ]
[ "SELECT name FROM Reviewer", "SELECT name FROM Reviewer WHERE name LIKE \"%Mike%\"", "SELECT rID FROM Reviewer WHERE name LIKE \"%Mike%\"" ]
What is the id of the reviewer whose name has substring “Mike”?
SELECT rID FROM Reviewer WHERE name LIKE "%Mike%"
movie_1
[ "What are the ratings?", "Show me the lowest and highest stars." ]
[ "SELECT * FROM Rating", "SELECT max(stars) , min(stars) FROM Rating" ]
What is the lowest and highest rating star?
SELECT max(stars) , min(stars) FROM Rating
movie_1
[ "Show me the name of all movies.", "What about their ratings?", "Only show those with a rating of 4 or 5.", "Give me all years that have any of those movies in the order of year." ]
[ "SELECT title FROM movie", "SELECT t1.title, t2.stars FROM Movie AS t1 JOIN Rating AS t2 on t1.mID = t2.mID", "SELECT t1.title, t2.stars FROM Movie AS t1 JOIN Rating AS t2 on t1.mID = t2.mID WHERE t2.stars >= 4", "SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1.year" ]
Find all years that have a movie that received a rating of 4 or 5, and sort them in increasing order of year.
SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1.year
movie_1
[ "Show me the names of all movies.", "What about those with 5 star rating?", "Who directed those movies?" ]
[ "SELECT title FROM movie", "SELECT t1.title FROM movie AS t1 JOIN Rating AS t2 ON t1.mID = t2.mID where t2.stars = 5", "SELECT T1.director , T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5" ]
What are the names of directors who directed movies with 5 star rating? Also return the title of these movies.
SELECT T1.director , T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5
movie_1
[ "Who are all the reviewers?", "What is their highest rating?", "What is their lowest rating?", "What about their average rating?" ]
[ "SELECT name FROM Reviewer", "SELECT T2.name , max(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name", "SELECT T2.name , min(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name", "SELECT T2.name , avg(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name" ]
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
movie_1
[ "What are the title of all movies?", "What about those without any rating?" ]
[ "SELECT title FROM movie", "SELECT title FROM Movie WHERE mID NOT IN (SELECT mID FROM Rating)" ]
Find the titles of all movies that have no ratings.
SELECT title FROM Movie WHERE mID NOT IN (SELECT mID FROM Rating)
movie_1
[ "What are the titles of all movies?", "Which one is the oldest?", "What is its average rating stars?" ]
[ "SELECT title FROM movie", "SELECT title FROM movie WHERE Year = (SELECT min(YEAR) FROM Movie)", "SELECT avg(T1.stars) , T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT min(YEAR) FROM Movie)" ]
What is the average rating stars and title for the oldest movie?
SELECT avg(T1.stars) , T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT min(YEAR) FROM Movie)
movie_1
[ "What are the titles of all movies?", "Which one is the most recent?" ]
[ "SELECT title FROM movie", "SELECT title FROM movie WHERE Year = (SELECT max(YEAR) FROM Movie)" ]
What is the name of the most recent movie?
SELECT title FROM Movie WHERE YEAR = (SELECT max(YEAR) FROM Movie)
movie_1
[ "What are the titles of all movies?", "Which one is the most recent?", "What is its highest rating stars?" ]
[ "SELECT title FROM movie", "SELECT title FROM movie WHERE Year = (SELECT max(YEAR) FROM Movie)", "SELECT max(T1.stars) , T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT max(YEAR) FROM Movie)" ]
What is the maximum stars and year for the most recent movie?
SELECT max(T1.stars) , T2.year FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT max(YEAR) FROM Movie)
movie_1
[ "Show me the movies directed by Steven Spielberg.", "What about their years?", "Show me the movies that were created after all of the above movies." ]
[ "SELECT title FROM Movie WHERE director = \"Steven Spielberg\"", "SELECT title, year FROM Movie WHERE director = \"Steven Spielberg\"", "SELECT title FROM Movie WHERE YEAR > (SELECT max(YEAR) FROM Movie WHERE director = \"Steven Spielberg\")" ]
What are the names of movies whose created year is after all movies directed by Steven Spielberg?
SELECT title FROM Movie WHERE YEAR > (SELECT max(YEAR) FROM Movie WHERE director = "Steven Spielberg")
movie_1
[ "Show me the movies directed by James Cameron.", "What about their rating stars?", "Show me the average of them.", "Give me the titles and directors of movies whose star is greater than that." ]
[ "SELECT title FROM Movie WHERE director = \"James Cameron\"", "SELECT T1.stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.director = \"James Cameron\"", "SELECT avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.director = \"James Cameron\"", "SELECT T2.title , T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars > (SELECT avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.director = \"James Cameron\")" ]
What are the titles and directors of the movies whose star is greater than the average stars of the movies directed by James Cameron?
SELECT T2.title , T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars > (SELECT avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.director = "James Cameron")
movie_1
[ "What are the titles of all movies?", "Show me their reviewer's name, stars, and rating date.", "Sort them first by reviewer name, then by movie title, and lastly by number of stars." ]
[ "SELECT title FROM movie", "SELECT T3.name , T2.title , T1.stars , T1.ratingDate FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID", "SELECT T3.name , T2.title , T1.stars , T1.ratingDate FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID ORDER BY T3.name , T2.title , T1.stars" ]
Return reviewer name, movie title, stars, and rating date. And sort the data first by reviewer name, then by movie title, and lastly by number of stars.
SELECT T3.name , T2.title , T1.stars , T1.ratingDate FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID ORDER BY T3.name , T2.title , T1.stars
movie_1
[ "Show me the names of all the reviewers.", "What about the ratings they have contributed?", "Show me the reviewers who have contributed three or more ratings." ]
[ "SELECT name FROM Reviewer", "SELECT * FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID", "SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T1.rID HAVING COUNT(*) >= 3" ]
Find the names of all reviewers who have contributed three or more ratings.
SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T1.rID HAVING COUNT(*) >= 3
movie_1
[ "Show me the ratings for Gone with the Wind.", "Give me the names of reviewers who gave those ratings." ]
[ "SELECT * FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.title = 'Gone with the Wind'", "SELECT DISTINCT T3.name FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.title = 'Gone with the Wind'" ]
Find the names of all reviewers who rated Gone with the Wind.
SELECT DISTINCT T3.name FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.title = 'Gone with the Wind'
movie_1
[ "Show me all the ratings given by Sarah Martinez.", "What movies are those ratings about?", "Show me the directors of those movies." ]
[ "SELECT * FROM rating AS t1 JOIN Reviewer AS t2 on t1.rID = t2.rID where t2.name = \"Sarah Martinez\"", "SELECT distinct t1.title FROM Movie as t1 JOIN Rating as t2 on t1.mID = t2.mID JOIN Reviewer AS t3 on t2.rID = t3.rID WHERE t3.name = \"Sarah Martinez\"", "SELECT DISTINCT T2.director 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 = 'Sarah Martinez'" ]
Find the names of all directors whose movies are rated by Sarah Martinez.
SELECT DISTINCT T2.director 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 = 'Sarah Martinez'
movie_1
[ "Show me the titles of all the movies.", "What about the name of their reviewers and directors?", "Show those who have the same names.", "Give me the reviewer name, movie title, and number of stars." ]
[ "SELECT title FROM Movie", "SELECT T3.name, T2.title, T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID", "SELECT T3.name, T2.title, T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.director = T3.name", "SELECT DISTINCT T3.name , T2.title , T1.stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.director = T3.name" ]
For any rating where the name of reviewer is the same as the director of the movie, return the reviewer name, movie title, and number of stars.
SELECT DISTINCT T3.name , T2.title , T1.stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.director = T3.name
movie_1
[ "Give me the names of all reviewers.", "Show me the title of all movies together in a single list." ]
[ "SELECT name FROM Reviewer", "SELECT name FROM Reviewer UNION SELECT title FROM Movie" ]
Return all reviewer names and movie names together in a single list.
SELECT name FROM Reviewer UNION SELECT title FROM Movie
movie_1
[ "Give me the ratings given by Chris Jackson.", "What movies are they about?", "Show me the movies other than those." ]
[ "SELECT * FROM rating as t1 JOIN reviewer as t2 on t1.rID = t2.rID and t2.name = 'Chris Jackson'", "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'", "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'" ]
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'
movie_1
[ "What are all the directors?", "How many movies did each of them direct?", "Show me those who directed more than one movie.", "Show me their directed movies' titles, in the order of director name, then movie title." ]
[ "SELECT DISTINCT director FROM Movie", "SELECT count(*), director FROM Movie group by director", "SELECT director FROM Movie group by director having count(*) > 1", "SELECT T1.title , T1.director FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title != T2.title ORDER BY T1.director , T1.title" ]
For all directors who directed more than one movie, return the titles of all movies directed by them, along with the director name. Sort by director name, then movie title.
SELECT T1.title , T1.director FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title != T2.title ORDER BY T1.director , T1.title
movie_1
[ "What are all the directors?", "How many movies did each of them direct?", "Show me those who directed more than one movie.", "Give me the titles and produced years of all movies directed by them." ]
[ "SELECT DISTINCT director FROM Movie", "SELECT count(*), director FROM Movie group by director", "SELECT director FROM Movie group by director having count(*) > 1", "SELECT T1.title , T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title != T2.title" ]
For directors who had more than one movie, return the titles and produced years of all movies directed by them.
SELECT T1.title , T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title != T2.title
movie_1
[ "What are all the directors?", "How many movies did each of them direct?", "Show me those who directed exactly one movie." ]
[ "SELECT DISTINCT director FROM Movie", "SELECT count(*), director FROM Movie group by director", "SELECT director FROM Movie group by director having count(*) = 1" ]
What are the names of the directors who made exactly one movie?
SELECT director FROM Movie GROUP BY director HAVING count(*) = 1
movie_1
[ "What are all the directors?", "How many movies did each of them direct?", "Show me those who directed exactly one movie other than NULL." ]
[ "SELECT DISTINCT director FROM Movie", "SELECT count(*), director FROM Movie group by director", "SELECT director FROM Movie WHERE director != \"null\" GROUP BY director HAVING count(*) = 1" ]
What are the names of the directors who made exactly one movie excluding director NULL?
SELECT director FROM Movie WHERE director != "null" GROUP BY director HAVING count(*) = 1
movie_1
[ "What are all the directors?", "How many movie reviews does each of them get?" ]
[ "SELECT DISTINCT director FROM Movie", "SELECT count(*) , T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director" ]
How many movie reviews does each director get?
SELECT count(*) , T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director
movie_1
[ "What are all the movies?", "What are their average ratings?", "Give me the movies with the highest average rating." ]
[ "SELECT title FROM Movie", "SELECT T2.title , avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID", "SELECT T2.title , avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY avg(T1.stars) DESC LIMIT 1" ]
Find the movies with the highest average rating. Return the movie titles and average rating.
SELECT T2.title , avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY avg(T1.stars) DESC LIMIT 1
movie_1
[ "What are all the movies?", "What are their average ratings?", "Give me the movies with the lowest average rating." ]
[ "SELECT title FROM Movie", "SELECT T2.title , avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID", "SELECT T2.title , avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY avg(T1.stars) LIMIT 1" ]
What are the movie titles and average rating of the movies with the lowest average rating?
SELECT T2.title , avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY avg(T1.stars) LIMIT 1
movie_1
[ "Show me the titles all the movies.", "What are their ratings?", "Show me the names and years of the movies that has the top 3 rating star." ]
[ "SELECT title FROM Movie", "SELECT T2.title , T1.stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID", "SELECT T2.title , T2.year FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID ORDER BY T1.stars DESC LIMIT 3" ]
What are the names and years of the movies that has the top 3 highest rating star?
SELECT T2.title , T2.year FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID ORDER BY T1.stars DESC LIMIT 3
movie_1
[ "What are all the directors excluding NULL?", "What about the highest rating their movies have ever received?", "Also give me those movies' title." ]
[ "SELECT distinct director FROM Movie WHERE director != \"null\"", "SELECT T2.director , max(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE director != \"null\" GROUP BY director", "SELECT T2.title , T1.stars , T2.director , max(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE director != \"null\" GROUP BY director" ]
For each director, return the director's name together with the title of the movie they directed that received the highest rating among all of their movies, and the value of that rating. Ignore movies whose director is NULL.
SELECT T2.title , T2.director , max(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE director != "null" GROUP BY director
movie_1
[ "What are the name of all the reviewers?", "What are the least rating stars they ever gave?", "Also show me the title of the movies that correspond to those rating stars." ]
[ "SELECT name from Reviewer", "SELECT min(stars) FROM Rating GROUP BY rID", "SELECT T2.title , T1.rID , T1.stars , min(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.rID" ]
Find the title and star rating of the movie that got the least rating star for each reviewer.
SELECT T2.title , T1.rID , T1.stars , min(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.rID
movie_1
[ "Who are all the directors?", "What about the lowest rating their movies have ever received?", "Also give me those movies' title." ]
[ "SELECT distinct director FROM Movie", "SELECT T2.director , min(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY director", "SELECT T2.title , T1.stars , T2.director , min(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T2.director" ]
Find the title and score of the movie with the lowest rating among all movies directed by each director.
SELECT T2.title , T1.stars , T2.director , min(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T2.director
movie_1
[ "What are the names of all movies?", "How many ratings did each of them have?", "Give me the name of the movie that has the most ratings." ]
[ "SELECT title FROM Movie", "SELECT count(*) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY t1.mID", "SELECT T2.title , T1.mID FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY count(*) DESC LIMIT 1" ]
What is the name of the movie that is rated by most of times?
SELECT T2.title , T1.mID FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY count(*) DESC LIMIT 1
movie_1
[ "What are the name of all movies?", "What rating star did each of them have?", "Give me the movies that have rating star between 3 and 5." ]
[ "SELECT title FROM Movie", "SELECT T2.title, T1.stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID", "SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars BETWEEN 3 AND 5" ]
What are the titles of all movies that have rating star is between 3 and 5?
SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars BETWEEN 3 AND 5
movie_1
[ "What are the names of all the reviewers?", "Who had given ratings higher than 3 stars?" ]
[ "SELECT name FROM Reviewer", "SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars > 3" ]
Find the names of reviewers who had given higher than 3 stars ratings.
SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars > 3
movie_1
[ "What are the name of all the reviewers?", "What are the movies that are reviewed by Brittany Harris?", "Show me the average rating star for all other movies except those." ]
[ "SELECT name FROM Reviewer", "SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = \"Brittany Harris\"", "SELECT mID , avg(stars) FROM Rating WHERE mID NOT IN (SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = \"Brittany Harris\") GROUP BY mID" ]
Find the average rating star for each movie that are not reviewed by Brittany Harris.
SELECT mID , avg(stars) FROM Rating WHERE mID NOT IN (SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = "Brittany Harris") GROUP BY mID
movie_1
[ "What are the name of all the reviewers?", "What are the ids of the movies that are reviewed by Brittany Harris?", "Show me the ids of movies except those." ]
[ "SELECT name FROM Reviewer", "SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = \"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 are the ids of the movies that are 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"
movie_1
[ "What are the rating star for all the movies?", "Give me the average rating star for each movie.", "Only show those that received at least 2 ratings." ]
[ "SELECT mID, stars FROM Rating", "SELECT mID , avg(stars) FROM Rating GROUP BY mID", "SELECT mID , avg(stars) FROM Rating GROUP BY mID HAVING count(*) >= 2" ]
Find the average rating star for each movie that received at least 2 ratings.
SELECT mID , avg(stars) FROM Rating GROUP BY mID HAVING count(*) >= 2
movie_1
[ "What are all the ratings?", "Show me the ids of reviewers who gave 4 star.", "Give me the ids of reviewers except those." ]
[ "SELECT * FROM Rating", "SELECT distinct rID FROM Rating WHERE stars = 4", "SELECT rID FROM Rating EXCEPT SELECT rID FROM Rating WHERE stars = 4" ]
find the ids of reviewers who did not give 4 star.
SELECT rID FROM Rating EXCEPT SELECT rID FROM Rating WHERE stars = 4
movie_1
[ "Show me the name of all the movies.", "What about those that were made after 2000?", "Please also include those that were reviewed by Brittany Harris." ]
[ "SELECT title FROM Movie", "SELECT title FROM Movie where year > 2000", "SELECT DISTINCT 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 = 'Brittany Harris' OR T2.year > 2000" ]
What are names of the movies that are either made after 2000 or reviewed by Brittany Harris?
SELECT DISTINCT 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 = 'Brittany Harris' OR T2.year > 2000
movie_1
[ "Show me the name of all the movies.", "What about those that were made before 1980?", "Please also include those that were directed by James Cameron." ]
[ "SELECT title FROM Movie", "SELECT title FROM Movie where year < 1980", "SELECT title FROM Movie WHERE director = \"James Cameron\" OR YEAR < 1980" ]
What are names of the movies that are either made before 1980 or directed by James Cameron?
SELECT title FROM Movie WHERE director = "James Cameron" OR YEAR < 1980
movie_1
[ "Show me the name of all the reviewers.", "What about the rating star they had given?", "Show me the reviewers who had rated 3 star and 4 star." ]
[ "SELECT name FROM Reviewer", "SELECT T2.name, T1.stars FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID", "SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars = 3 INTERSECT SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars = 4" ]
What are the names of reviewers who had rated 3 star and 4 star?
SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars = 3 INTERSECT SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars = 4
movie_1
[ "List the ratings for all of the reviews.", "What was the average rating?", "Include the maximum as well." ]
[ "SELECT rating FROM review", "SELECT avg(rating) FROM review", "SELECT avg(rating) , max(rating) FROM review" ]
Find the average and maximum rating of all reviews.
SELECT avg(rating) , max(rating) FROM review
epinions_1
[ "Show all items.", "Which ones received reviews?", "How about those that did not receive any reviews?", "How many unreviewed items were there?" ]
[ "SELECT title FROM item", "SELECT title FROM item WHERE i_id IN (SELECT i_id FROM review)", "SELECT title FROM item WHERE i_id NOT IN (SELECT i_id FROM review)", "SELECT count(*) FROM item WHERE i_id NOT IN (SELECT i_id FROM review)" ]
Find the number of items that did not receive any review.
SELECT count(*) FROM item WHERE i_id NOT IN (SELECT i_id FROM review)
epinions_1
[ "List the ratings of all goods.", "Include the names of the goods.", "How many received a rating of 10?", "What are the names of these goods?" ]
[ "SELECT rating FROM review", "SELECT T1.title, T2.rating FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id", "SELECT count(*) FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating = 10", "SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating = 10" ]
Find the names of goods that receive a rating of 10.
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating = 10
epinions_1
[ "What is the average rating of all items?", "How many items have a rating lower than the average?", "How about higher than the average?", "What are the names of those items?" ]
[ "SELECT avg(rating) FROM review", "SELECT count(*) FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < (SELECT avg(rating) FROM review)", "SELECT count(*) FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating > (SELECT avg(rating) FROM review)", "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)" ]
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)
epinions_1
[ "List the title and rating for each item.", "Order by increasing rating.", "How many received a rating below 5?", "What are the names of these items?" ]
[ "SELECT T1.title, T2.rating FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id", "SELECT T1.title, T2.rating FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id ORDER BY T2.rating ASC", "SELECT count(*) FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5", "SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5" ]
Find the titles of items that received any rating below 5.
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating < 5
epinions_1
[ "What is the title and rating for each item?", "Which ones received a rating higher than 8?", "Out of those items, which ones also received a rating less than 5?" ]
[ "SELECT T1.title, T2.rating FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id", "SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rating > 8", "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" ]
Find the titles of items that received both a rating higher than 8 and a rating below 5.
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
epinions_1
[ "What items were ranked?", "How many have a rank that is greater than 3?", "List the names of these items.", "Out of these items, which ones also have an average rating that is above 5?" ]
[ "SELECT DISTINCT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id", "SELECT count(DISTINCT T1.title) FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rank > 3", "SELECT DISTINCT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rank > 3", "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" ]
Find the names of items whose rank is higher than 3 and whose average rating is above 5.
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
epinions_1
[ "List the names of all items", "Show the average rating of each one as well.", "Order by increasing average rating.", "Which one has the lowest?" ]
[ "SELECT title FROM item", "SELECT T1.title, avg(T2.rating) FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id", "SELECT T1.title, avg(T2.rating) 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)", "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" ]
Find the name of the item with the lowest average rating.
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
epinions_1
[ "What are the names of all users?", "How many reviews were given by each user?", "Order by the number of reviews given, from the greatest to the least.", "Who gave the most reviews?" ]
[ "SELECT name FROM useracct", "SELECT T1.name, count(*) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id", "SELECT T1.name, count(*) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id ORDER BY count(*) DESC", "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" ]
Find the name of the user who gives the most reviews.
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
epinions_1
[ "List the name of each item that received a rating.", "Include the item ID as well.", "Order items by decreasing average rating.", "Which item had the highest? Include its ID as well." ]
[ "SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id", "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", "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", "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" ]
Find the name and id of the item with the highest average rating.
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
epinions_1
[ "Which items have a rank?", "Also include their IDs.", "Order them by average rank from highest to lowest.", "What is the name and ID of the item that received the highest average rank?" ]
[ "SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id", "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", "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)", "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" ]
Find the name and id of the good with the highest average rank.
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
epinions_1
[ "List the names of all users.", "Only show those who gave reviews.", "Include the ratings given by each of them.", "Only show their name and the average rating given by each of them." ]
[ "SELECT name FROM useracct", "SELECT DISTINCT T1.name FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id", "SELECT T1.name, T2.rating FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id", "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" ]
For each user, return the name and the average rating of reviews given by them.
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
epinions_1
[ "What are the names of the users?", "How many wrote reviews?", "List their names?", "Include the number of reviews written by each of them." ]
[ "SELECT name FROM useracct", "SELECT count(DISTINCT T1.name) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id", "SELECT DISTINCT T1.name FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id", "SELECT T1.name , count(*) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id" ]
For each user, find their name and the number of reviews written by them.
SELECT T1.name , count(*) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id
epinions_1
[ "List the names of users who gave ratings.", "Include the ratings that they gave as well.", "Order by highest to lowest rating.", "Who gave the highest rating?" ]
[ "SELECT DISTINCT T1.name FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id", "SELECT T1.name, T2.rating FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id", "SELECT T1.name FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id ORDER BY T2.rating DESC", "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" ]
Find the name of the user who gave the highest rating.
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
epinions_1
[ "What are all of the users’ names?", "Only show the names of source users.", "Order them by decreasing average trust score.", "Who has the highest average trust score?" ]
[ "SELECT name FROM useracct", "SELECT DISTINCT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.source_u_id", "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", "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" ]
Find the name of the source user with the highest average trust score.
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
epinions_1
[ "List the names of all target users.", "Include the trust scores for each target user.", "List the name and average trust score for each target user." ]
[ "SELECT DISTINCT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id", "SELECT T1.name , T2.trust FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id", "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" ]
Find each target user's name and average trust score.
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
epinions_1
[ "What are the names of all users?", "Only show the target users.", "Order them by increasing trust score.", "Who has the lowest trust score?" ]
[ "SELECT name FROM useracct", "SELECT DISTINCT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id", "SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id ORDER BY trust", "SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id ORDER BY trust LIMIT 1" ]
Find the name of the target user with the lowest trust score.
SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id ORDER BY trust LIMIT 1
epinions_1
[ "List the names of all items.", "How many did not receive any reviews?", "List their names." ]
[ "SELECT title FROM item", "SELECT count(*) FROM item WHERE i_id NOT IN (SELECT i_id FROM review)", "SELECT title FROM item WHERE i_id NOT IN (SELECT i_id FROM review)" ]
Find the names of the items that did not receive any review.
SELECT title FROM item WHERE i_id NOT IN (SELECT i_id FROM review)
epinions_1
[ "What are all of the users’ names?", "How many wrote reviews?", "How many did not write reviews?", "List their names." ]
[ "SELECT name FROM useracct", "SELECT count(*) FROM useracct WHERE u_id IN (SELECT u_id FROM review)", "SELECT count(*) FROM useracct WHERE u_id NOT IN (SELECT u_id FROM review)", "SELECT name FROM useracct WHERE u_id NOT IN (SELECT u_id FROM review)" ]
Find the names of users who did not leave any review.
SELECT name FROM useracct WHERE u_id NOT IN (SELECT u_id FROM review)
epinions_1
[ "Which cities have customer_type_code of \"Good Credit Rating\"?", "Which ones do not?", "Give the counts of the town city groups of customers in that first query.", "Just return the town city with the least number." ]
[ "SELECT DISTINCT town_city FROM customers WHERE customer_type_code = \"Good Credit Rating\"", "SELECT DISTINCT town_city FROM customers WHERE customer_type_code != \"Good Credit Rating\"", "SELECT town_city, count(*) FROM customers WHERE customer_type_code = \"Good Credit Rating\" GROUP BY town_city", "SELECT town_city FROM customers WHERE customer_type_code = \"Good Credit Rating\" GROUP BY town_city ORDER BY count(*) LIMIT 1" ]
Which city has the least number of customers whose type code is "Good Credit Rating"?
SELECT town_city FROM customers WHERE customer_type_code = "Good Credit Rating" GROUP BY town_city ORDER BY count(*) LIMIT 1
customer_complaints
[ "Which product ids have received complaints?", "What are the names of those products?", "Speaking of those names, count the number of complaints about them." ]
[ "SELECT DISTINCT product_id from complaints", "SELECT DISTINCT t1.product_name FROM products AS t1 JOIN complaints AS t2 ON t1.product_id = t2.product_id", "SELECT t1.product_name , count(*) FROM products AS t1 JOIN complaints AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_name" ]
List the name of all products along with the number of complaints that they have received.
SELECT t1.product_name , count(*) FROM products AS t1 JOIN complaints AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_name
customer_complaints
[ "Which customer ids have filed complaints?", "What are the emails of these customers?", "Sum the complaints of each customer email address.", "Find the email of the customer who has filed the most complaints." ]
[ "SELECT DISTINCT customer_id from complaints", "SELECT DISTINCT t1.email_address FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id", "SELECT t1.email_address, count(*) FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id", "SELECT t1.email_address FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id ORDER BY count(*) DESC LIMIT 1" ]
Find the email of the customer who has filed the most complaints.
SELECT t1.email_address FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id ORDER BY count(*) DESC LIMIT 1
customer_complaints
[ "Which customer id filed the least number of complaints? How many?", "Which product names did this customer complain about?" ]
[ "SELECT customer_id, count(*) from complaints GROUP by customer_id ORDER BY count(*) ASC LIMIT 1", "SELECT DISTINCT t1.product_name FROM products AS t1 JOIN complaints AS t2 ON t1.product_id = t2.product_id JOIN customers AS t3 GROUP BY t3.customer_id ORDER BY count(*) LIMIT 1" ]
Which products has been complained by the customer who has filed least amount of complaints?
SELECT DISTINCT t1.product_name FROM products AS t1 JOIN complaints AS t2 ON t1.product_id = t2.product_id JOIN customers AS t3 GROUP BY t3.customer_id ORDER BY count(*) LIMIT 1
customer_complaints
[ "What is the customer id of the customer who has filed the most recent complaint?", "What is this customers city?", "How about their phone number?" ]
[ "SELECT customer_id from complaints ORDER BY date_complaint_raised DESC LIMIT 1", "SELECT t1.town_city FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.date_complaint_raised DESC LIMIT 1", "SELECT t1.phone_number FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.date_complaint_raised DESC LIMIT 1" ]
What is the phone number of the customer who has filed the most recent complaint?
SELECT t1.phone_number FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.date_complaint_raised DESC LIMIT 1
customer_complaints
[ "Find the email of the customers who have never filed a complaint before.", "Also the phone number." ]
[ "SELECT email_address FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM complaints)", "SELECT email_address , phone_number FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM complaints)" ]
Find the email and phone number of the customers who have never filed a complaint before.
SELECT email_address , phone_number FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM complaints)
customer_complaints
[ "What are the phone numbers of customers?", "How about staff?", "Union those." ]
[ "SELECT phone_number FROM customers", "SELECT phone_number FROM staff", "SELECT phone_number FROM customers UNION SELECT phone_number FROM staff" ]
Find the phone number of all the customers and staff.
SELECT phone_number FROM customers UNION SELECT phone_number FROM staff
customer_complaints
[ "Order the product records by descending price.", "Just show the product names and category codes.", "Only for the most expensive product." ]
[ "SELECT * FROM products ORDER BY product_price DESC", "SELECT product_name , product_category_code FROM products ORDER BY product_price DESC", "SELECT product_name , product_category_code FROM products ORDER BY product_price DESC LIMIT 1" ]
Find the name and category of the most expensive product.
SELECT product_name , product_category_code FROM products ORDER BY product_price DESC LIMIT 1
customer_complaints
[ "Which product ids have never been complained about?", "Which ones have been complained about?", "Find the prices of products which has never received a single complaint." ]
[ "SELECT product_id FROM products WHERE product_id NOT IN (SELECT product_id FROM complaints)", "SELECT DISTINCT product_id FROM complaints", "SELECT product_price FROM products WHERE product_id NOT IN (SELECT product_id FROM complaints)" ]
Find the prices of products which has never received a single complaint.
SELECT product_price FROM products WHERE product_id NOT IN (SELECT product_id FROM complaints)
customer_complaints
[ "What is the name of the cheapest product?", "Show records where this product was complained about.", "Find the last name of the staff member who processed a complaint of this cheapest product." ]
[ "SELECT product_name FROM products ORDER BY product_price ASC LIMIT 1", "SELECT * from complaints WHERE product_id in (SELECT product_id FROM products ORDER BY product_price ASC LIMIT 1)", "SELECT last_name from staff where staff_id in (SELECT staff_id from complaints WHERE product_id in (SELECT product_id FROM products ORDER BY product_price ASC LIMIT 1))" ]
Find the last names of the staff members who processed complaints about the cheapest product.
SELECT last_name from staff where staff_id in (SELECT staff_id from complaints WHERE product_id in (SELECT product_id FROM products ORDER BY product_price ASC LIMIT 1))
customer_complaints
[ "Count the various complaint status codes.", "Only show counts greater than 3." ]
[ "SELECT complaint_status_code, count(*) FROM complaints GROUP BY complaint_status_code", "SELECT complaint_status_code FROM complaints GROUP BY complaint_status_code HAVING count(*) > 3" ]
Which complaint status has more than 3 records on file?
SELECT complaint_status_code FROM complaints GROUP BY complaint_status_code HAVING count(*) > 3
customer_complaints
[ "What are the email addresses of the staff?", "Find the last name of the staff whose email address contains \"wrau\"." ]
[ "SELECT email_address FROM staff", "SELECT last_name FROM staff WHERE email_address LIKE \"%wrau%\"" ]
Find the last name of the staff whose email address contains "wrau".
SELECT last_name FROM staff WHERE email_address LIKE "%wrau%"
customer_complaints
[ "What is the most common customer type?", "How many are there in this group?" ]
[ "SELECT customer_type_code FROM customers GROUP BY customer_type_code ORDER BY count(*) DESC LIMIT 1", "SELECT count(*) FROM customers GROUP BY customer_type_code ORDER BY count(*) DESC LIMIT 1" ]
How many customers are there in the customer type with the most customers?
SELECT count(*) FROM customers GROUP BY customer_type_code ORDER BY count(*) DESC LIMIT 1
customer_complaints
[ "What is the id of the first complaint?", "Which staff id was there for it?", "What was the last name of this staff member?" ]
[ "SELECT complaint_id from complaints ORDER by date_complaint_raised ASC LIMIT 1", "SELECT staff_id from complaints ORDER by date_complaint_raised ASC LIMIT 1", "SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id ORDER BY t2.date_complaint_raised LIMIT 1" ]
What is the last name of the staff who has handled the first ever complaint?
SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id ORDER BY t2.date_complaint_raised LIMIT 1
customer_complaints
[ "Which complaints have type Product Failure?", "Which complaint statuses are among those records?", "Count the occurrences of each complaint status in the above." ]
[ "SELECT * from complaints where complaint_type_code = \"Product Failure\"", "SELECT DISTINCT complaint_status_code from complaints WHERE complaint_status_code in (SELECT complaint_status_code from complaints where complaint_type_code = \"Product Failure\")", "SELECT complaint_status_code , count(*) FROM complaints WHERE complaint_type_code = \"Product Failure\" GROUP BY complaint_status_code" ]
Find the number of complaints with Product Failure type for each complaint status.
SELECT complaint_status_code , count(*) FROM complaints WHERE complaint_type_code = "Product Failure" GROUP BY complaint_status_code
customer_complaints
[ "What are the staff ids of the top 5 staff who have handled the greatest number of complaints?", "What are their first names?" ]
[ "SELECT staff_id from complaints GROUP BY staff_id ORDER BY count(*) LIMIT 5", "SELECT t1.first_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id GROUP BY t2.staff_id ORDER BY count(*) LIMIT 5" ]
What are the first names of the top 5 staff who have handled the greatest number of complaints?
SELECT t1.first_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id GROUP BY t2.staff_id ORDER BY count(*) LIMIT 5
customer_complaints
[ "Give the names and ratings of Restaurants.", "Sort by descending order.", "Just give the most highly rated restaurant name and rating." ]
[ "SELECT ResName , Rating FROM Restaurant", "SELECT ResName , Rating FROM Restaurant ORDER BY Rating DESC", "SELECT ResName , Rating FROM Restaurant ORDER BY Rating DESC LIMIT 1;" ]
Which restaurant has highest rating? List the restaurant name and its rating.
SELECT ResName , Rating FROM Restaurant ORDER BY Rating DESC LIMIT 1;
restaurant_1
[ "List the last names, first names, and ages of students.", "Narrow that down to last name \"Smith\" and first name \"Linda\"", "What is the age of student Linda Smith?" ]
[ "SELECT LName, Fname, Age from student", "SELECT LName, Fname, Age from student WHERE Fname = \"Linda\" AND Lname = \"Smith\";", "SELECT Age FROM Student WHERE Fname = \"Linda\" AND Lname = \"Smith\";" ]
What is the age of student Linda Smith?
SELECT Age FROM Student WHERE Fname = "Linda" AND Lname = "Smith";
restaurant_1
[ "What is Linda Smith's Major?", "How about Linda Smith's Adivisor?", "Give her gender." ]
[ "SELECT Major FROM Student WHERE Fname = \"Linda\" AND Lname = \"Smith\";", "SELECT Advisor FROM Student WHERE Fname = \"Linda\" AND Lname = \"Smith\";", "SELECT Sex FROM Student WHERE Fname = \"Linda\" AND Lname = \"Smith\";" ]
What is the gender of the student Linda Smith?
SELECT Sex FROM Student WHERE Fname = "Linda" AND Lname = "Smith";
restaurant_1
[ "Give the student id of linda smith.", "Now for Tracy Kim.", "Which city does student Linda Smith live in?" ]
[ "SELECT StuID FROM Student WHERE Fname = \"Linda\" AND Lname = \"Smith\";", "SELECT StuID FROM Student WHERE Fname = \"Tracy\" AND Lname = \"Kim\";", "SELECT city_code FROM Student WHERE Fname = \"Linda\" AND Lname = \"Smith\";" ]
Which city does student Linda Smith live in?
SELECT city_code FROM Student WHERE Fname = "Linda" AND Lname = "Smith";
restaurant_1
[ "Give the distinct advisors of students.", "Which of those advises the most students?", "Give the count, too." ]
[ "SELECT DISTINCT advisor from student", "SELECT Advisor FROM Student GROUP BY Advisor ORDER BY count(Advisor) DESC LIMIT 1;", "SELECT Advisor , count(*) FROM Student GROUP BY Advisor ORDER BY count(Advisor) DESC LIMIT 1;" ]
Which Advisor has most of students? List advisor and the number of students.
SELECT Advisor , count(*) FROM Student GROUP BY Advisor ORDER BY count(Advisor) DESC LIMIT 1;
restaurant_1
[ "Give distinct majors.", "Which has the most number of students?", "Which has the least?", "Give the count to prove it." ]
[ "SELECT DISTINCT major from student", "SELECT Major FROM Student GROUP BY Major ORDER BY count(Major) DESC LIMIT 1;", "SELECT Major FROM Student GROUP BY Major ORDER BY count(Major) ASC LIMIT 1;", "SELECT Major , count(*) FROM Student GROUP BY Major ORDER BY count(Major) ASC LIMIT 1;" ]
Which major has least number of students? List the major and the number of students.
SELECT Major , count(*) FROM Student GROUP BY Major ORDER BY count(Major) ASC LIMIT 1;
restaurant_1
[ "Which major has between 2 and 30 number of students?", "Count that, too." ]
[ "SELECT Major FROM Student GROUP BY Major HAVING count(Major) BETWEEN 2 AND 30;", "SELECT Major , count(*) FROM Student GROUP BY Major HAVING count(Major) BETWEEN 2 AND 30;" ]
Which major has between 2 and 30 number of students? List major and the number of students.
SELECT Major , count(*) FROM Student GROUP BY Major HAVING count(Major) BETWEEN 2 AND 30;
restaurant_1
[ "What are the student ids of students majoring in 600?", "Only show those whose age is 18.", "Just show the first and last names." ]
[ "SELECT StuID from student where Major = 600;", "SELECT StuID FROM Student WHERE Age > 18 AND Major = 600;", "SELECT Fname , Lname FROM Student WHERE Age > 18 AND Major = 600;" ]
Which student's age is older than 18 and is majoring in 600? List each student's first and last name.
SELECT Fname , Lname FROM Student WHERE Age > 18 AND Major = 600;
restaurant_1
[ "Give information for students older than 18.", "List all female students older than 18 who are not majoring in 600. List students' first name and last name." ]
[ "SELECT * FROM Student WHERE Age > 18", "SELECT Fname , Lname FROM Student WHERE Age > 18 AND Major != 600 AND Sex = 'F';" ]
List all female students older than 18 who are not majoring in 600. List students' first name and last name.
SELECT Fname , Lname FROM Student WHERE Age > 18 AND Major != 600 AND Sex = 'F';
restaurant_1
[ "How many types of restaurant have the name \"Sandwich\"?", "What are the names of restaurants with the type \"Sandwich\"?", "Give the count of that." ]
[ "SELECT count(*) from Restaurant_Type where ResTypeName = \"Sandwich\"", "SELECT Restaurant.ResName 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'", "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'" ]
How many restaurant is the Sandwich type restaurant?
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'
restaurant_1
[ "How many times did Linda Smith visit a restaurant?", "For those visits, how long did she spend?" ]
[ "SELECT count(*) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID WHERE Student.Fname = \"Linda\" AND Student.Lname = \"Smith\";", "SELECT sum(Spent) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID WHERE Student.Fname = \"Linda\" AND Student.Lname = \"Smith\";" ]
How long does student Linda Smith spend on the restaurant in total?
SELECT sum(Spent) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID WHERE Student.Fname = "Linda" AND Student.Lname = "Smith";
restaurant_1
[ "How many visits did Subway receive?", "Give the student ids for these visits.", "Do any of these correspond to the student Linda Smith? How many?" ]
[ "SELECT count(*) FROM Visits_Restaurant JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Restaurant.ResName = \"Subway\";", "SELECT StuID FROM Visits_Restaurant JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Restaurant.ResName = \"Subway\";", "SELECT count(*) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = \"Linda\" AND Student.Lname = \"Smith\" AND Restaurant.ResName = \"Subway\";" ]
How many times has the student Linda Smith visited Subway?
SELECT count(*) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = "Linda" AND Student.Lname = "Smith" AND Restaurant.ResName = "Subway";
restaurant_1
[ "How long did Linda Smith spend at Subway?", "What time did she arrive?" ]
[ "SELECT Spent FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = \"Linda\" AND Student.Lname = \"Smith\" AND Restaurant.ResName = \"Subway\";", "SELECT TIME FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = \"Linda\" AND Student.Lname = \"Smith\" AND Restaurant.ResName = \"Subway\";" ]
When did Linda Smith visit Subway?
SELECT TIME FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = "Linda" AND Student.Lname = "Smith" AND Restaurant.ResName = "Subway";
restaurant_1
[ "What was the restaraunt id with the least amount of time spent?", "Give the name of this restaraunt and sum of time spent." ]
[ "SELECT Visits_Restaurant.ResID FROM Visits_Restaurant JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID GROUP BY Restaurant.ResID ORDER BY sum(Visits_Restaurant.Spent) ASC LIMIT 1;", "SELECT Restaurant.ResName , sum(Visits_Restaurant.Spent) FROM Visits_Restaurant JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID GROUP BY Restaurant.ResID ORDER BY sum(Visits_Restaurant.Spent) ASC LIMIT 1;" ]
At which restaurant did the students spend the least amount of time? List restaurant and the time students spent on in total.
SELECT Restaurant.ResName , sum(Visits_Restaurant.Spent) FROM Visits_Restaurant JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID GROUP BY Restaurant.ResID ORDER BY sum(Visits_Restaurant.Spent) ASC LIMIT 1;
restaurant_1
[ "What is the start and end dates of all policies?", "For the policies of \"Dayana Robel\"?", "What about the policy type code instead." ]
[ "SELECT Start_Date, End_Date FROM policies", "SELECT Start_Date, End_Date FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t2.customer_details = \"Dayana Robel\"", "SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t2.customer_details = \"Dayana Robel\"" ]
Find all the policy type codes associated with the customer "Dayana Robel"
SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t2.customer_details = "Dayana Robel"
insurance_and_eClaims
[ "What are the policy type codes?", "What are the least frequent ones?", "Most frequent?" ]
[ "SELECT policy_type_code FROM policies", "SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) ASC LIMIT 1", "SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1" ]
Which type of policy is most frequently used? Give me the policy type code.
SELECT policy_type_code FROM policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1
insurance_and_eClaims
[ "What are the policies?", "Which ones have been used only once?", "How about more than twice?" ]
[ "SELECT * FROM policies", "SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*) = 1", "SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*) > 2" ]
Find all the policy types that are used by more than 2 customers.
SELECT policy_type_code FROM policies GROUP BY policy_type_code HAVING count(*) > 2
insurance_and_eClaims
[ "What are the claim type codes in the claim headers?", "The amounts paid?", "What is the sum of that?", "Show the average as well." ]
[ "SELECT Claim_Type_Code FROM claim_headers", "SELECT Amount_piad FROM claim_headers", "SELECT sum(Amount_piad) FROM claim_headers", "SELECT sum(amount_piad) , avg(amount_piad) FROM claim_headers" ]
Find the total and average amount paid in claim headers.
SELECT sum(amount_piad) , avg(amount_piad) FROM claim_headers
insurance_and_eClaims
[ "What are the claim documents?", "Which was created most recently?", "Show the claim headers for this as well.", "What is the total claim amount for these?" ]
[ "SELECT * FROM claims_documents", "SELECT * FROM claims_documents WHERE created_date = (SELECT created_date FROM claims_documents ORDER BY created_date LIMIT 1)", "SELECT * FROM claim_headers AS t1 JOIN claims_documents AS t2 ON t1.claim_header_id = t2.claim_id WHERE t2.created_date = (SELECT created_date FROM claims_documents ORDER BY created_date LIMIT 1)", "SELECT sum(t1.amount_claimed) FROM claim_headers AS t1 JOIN claims_documents AS t2 ON t1.claim_header_id = t2.claim_id WHERE t2.created_date = (SELECT created_date FROM claims_documents ORDER BY created_date LIMIT 1)" ]
Find the total amount claimed in the most recently created document.
SELECT sum(t1.amount_claimed) FROM claim_headers AS t1 JOIN claims_documents AS t2 ON t1.claim_header_id = t2.claim_id WHERE t2.created_date = (SELECT created_date FROM claims_documents ORDER BY created_date LIMIT 1)
insurance_and_eClaims
[ "What was the smallest policy amount paid?", "Claim amount instead?", "Which was the policy for this?", "For the largest claim amount instead?", "Which customer owns this policy?" ]
[ "SELECT min(amount_piad) FROM claim_headers", "SELECT min(amount_claimed) FROM claim_headers", "SELECT * FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id WHERE t1.amount_claimed = (SELECT min(amount_claimed) FROM claim_headers)", "SELECT * FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id WHERE t1.amount_claimed = (SELECT max(amount_claimed) FROM claim_headers)", "SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_claimed = (SELECT max(amount_claimed) FROM claim_headers)" ]
What is the name of the customer who has made the largest amount of claim in a single claim?
SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_claimed = (SELECT max(amount_claimed) FROM claim_headers)
insurance_and_eClaims
[ "What is the largest claim amount?", "What was the policy for this?", "What about for the smallest payment amount instead?", "Who owned this policy?" ]
[ "SELECT max(amount_claimed) FROM claim_headers", "SELECT * FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id WHERE t1.amount_claimed = (SELECT max(amount_claimed) FROM claim_headers)", "SELECT * FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id WHERE t1.amount_piad = (SELECT min(amount_piad) FROM claim_headers)", "SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_piad = (SELECT min(amount_piad) FROM claim_headers)" ]
What is the name of the customer who has made the minimum amount of payment in one claim?
SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_piad = (SELECT min(amount_piad) FROM claim_headers)
insurance_and_eClaims
[ "Who are the customers?", "What are their policies?", "Who doesn't have policies?" ]
[ "SELECT customer_details FROM customers", "SELECT * FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id", "SELECT customer_details FROM customers EXCEPT SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id" ]
Find the names of customers who have no policies associated.
SELECT customer_details FROM customers EXCEPT SELECT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id
insurance_and_eClaims
[ "What is the least frequent claim outcome?", "Most frequent?", "Show for claim status instead." ]
[ "SELECT Claim_Outcome_Code FROM claims_processing GROUP BY Claim_Outcome_Code ORDER BY count(Claim_Outcome_Code) ASC LIMIT 1", "SELECT Claim_Outcome_Code FROM claims_processing GROUP BY Claim_Outcome_Code ORDER BY count(Claim_Outcome_Code) DESC LIMIT 1", "SELECT t2.claim_status_name FROM claims_processing AS t1 JOIN claims_processing_stages AS t2 ON t1.claim_stage_id = t2.claim_stage_id GROUP BY t1.claim_stage_id ORDER BY count(*) DESC LIMIT 1" ]
What is the name of the claim processing stage that most of the claims are on?
SELECT t2.claim_status_name FROM claims_processing AS t1 JOIN claims_processing_stages AS t2 ON t1.claim_stage_id = t2.claim_stage_id GROUP BY t1.claim_stage_id ORDER BY count(*) DESC LIMIT 1
insurance_and_eClaims
[ "Who are the customers?", "Only show their names.", "Of these, which one contain \"III\"", "Containing \"Diana\" instead?" ]
[ "SELECT * FROM customers", "SELECT customer_details FROM customers", "SELECT customer_details FROM customers WHERE customer_details LIKE \"%III%\"", "SELECT customer_details FROM customers WHERE customer_details LIKE \"%Diana%\"" ]
Find the names of customers whose name contains "Diana".
SELECT customer_details FROM customers WHERE customer_details LIKE "%Diana%"
insurance_and_eClaims
[ "What are all the start and end dates of the policies?", "Give me the policy types instead.", "Just the deputy policies.", "Which customers have this policy? Give their names." ]
[ "SELECT Start_Date, End_Date FROM policies", "SELECT policy_type_code FROM policies", "SELECT policy_type_code FROM policies WHERE policy_type_code = \"Deputy\"", "SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = \"Deputy\"" ]
Find the names of the customers who have an deputy policy.
SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = "Deputy"
insurance_and_eClaims