about summary refs log tree commit diff
path: root/todo-lists
diff options
context:
space:
mode:
Diffstat (limited to 'todo-lists')
-rw-r--r--todo-lists/imdb/scratch.sql15
1 files changed, 15 insertions, 0 deletions
diff --git a/todo-lists/imdb/scratch.sql b/todo-lists/imdb/scratch.sql
index 9ddba8e9106e..6835c73bd87c 100644
--- a/todo-lists/imdb/scratch.sql
+++ b/todo-lists/imdb/scratch.sql
@@ -48,3 +48,18 @@ WHERE isCartoon = true;
 SELECT *
 FROM Movies
 WHERE isCartoon = true AND requiresSubtitles = false;
+
+-- show the movies from the directors that show up on the list more than once.
+SELECT *
+FROM Movies
+WHERE director in (
+  SELECT director
+  FROM (
+    SELECT director, COUNT(*) as num
+    FROM Movies
+    GROUP BY director
+    HAVING num > 1
+    ORDER BY num DESC
+  )
+)
+ORDER BY director, rating DESC, year DESC;