13、Obtain a list, in alphabetical order, of actors who've had at least 30 starring roles.
答案:
SELECT name FROM casting JOIN actor ON (actorid=actor.id) WHERE ord=1 GROUP BY name HAVING COUNT(*)>=30;
14、List the films released in the year 1978 ordered by the number of actors in the cast, then by title
答案:
SELECT title,COUNT(actorid) FROM casting JOIN actor ON (actor.id=casting.actorid) JOIN movie ON (movie.id=casting.movieid) WHERE yr='1978' GROUP BY title ORDER BY COUNT (actorid) DESC,title;
15、List all the people who have worked with 'Art Garfunkel'.
答案:
SELECT DISTINCT name FROM actor WHERE id IN (SELECT actorid FROM casting WHERE movieid IN
(SELECT movieid FROM casting WHERE actorid =
(SELECT id FROM actor WHERE name='Art Garfunkel')))
AND actor.name<>'Art Garfunkel';