programming-examples/sql/SQLMovieDatabase/18. Write a query in SQL to list first and last name of all the directors with number of genres movies they directed with genres name, and arranged.sql

9 lines
458 B
MySQL
Raw Normal View History

2019-11-18 14:05:53 +01:00
/*18. Write a query in SQL to list first and last name of all the directors with number of genres movies they directed with
genres name, and arranged the result alphabetically with the first and last name of the director.*/
SELECT dir_fname,dir_lname, gen_title,count(gen_title)
FROM director
NATURAL JOIN movie_direction
NATURAL JOIN movie_genres
NATURAL JOIN genres
GROUP BY dir_fname, dir_lname,gen_title
ORDER BY dir_fname,dir_lname;