|
@@ -0,0 +1,36 @@
|
|
1
|
+# Persistence
|
|
2
|
+
|
|
3
|
+## Part 1: SQL
|
|
4
|
+
|
|
5
|
+The following lab is to be completed using the H2 Console. Once you have figured out the correct queries for each step, save a copy in a file called `src/main/resources/script.sql`. This will be how you submit this assignment. If at any time you need to reset the database, you can restart your Spring Boot server.
|
|
6
|
+
|
|
7
|
+### Campy movie database
|
|
8
|
+
|
|
9
|
+Add the following movies to the `movies` table using an insert statement:
|
|
10
|
+
|
|
11
|
+| Title | Runtime | Genre | IMDB Score | Rating |
|
|
12
|
+| ----- | ------- | ----- | ----------- | ----- |
|
|
13
|
+| Howard the Duck | 110 | Sci-Fi | 4.6 | PG |
|
|
14
|
+| Lavalantula | 83 | Horror | 4.7 | TV-14 |
|
|
15
|
+| Starship Troopers | 129 | Sci-Fi | 7.2 | PG-13 |
|
|
16
|
+| Waltz With Bashir | 90 | Documentary | 8.0 | R |
|
|
17
|
+| Spaceballs | 96 | Comedy | 7.1 | PG |
|
|
18
|
+| Monsters Inc. | 92 | Animation | 8.1 | G |
|
|
19
|
+
|
|
20
|
+Add a few more movies of your choosing.
|
|
21
|
+
|
|
22
|
+Create a query to find all movies in the Sci-Fi genre.
|
|
23
|
+
|
|
24
|
+Create a query to find all films that scored at least a 6.5 on IMDB
|
|
25
|
+
|
|
26
|
+For parents who have young kids, but who don't want to sit through long children's movies, create a query to find all of the movies rated G or PG that are less than 100 minutes long.
|
|
27
|
+
|
|
28
|
+Create a query to show the average runtimes of movies rated below a 7.5, grouped by their respective genres.
|
|
29
|
+
|
|
30
|
+There's been a data entry mistake; Starship Troopers is actually rated R, not PG-13. Create a query that finds the movie by its title and changes its rating to R.
|
|
31
|
+
|
|
32
|
+This time let's find the average, maximum, and minimum IMDB score for movies of each rating.
|
|
33
|
+
|
|
34
|
+That last query isn't very informative for ratings that only have 1 entry. use a `HAVING COUNT(*) > 1` clause to only show ratings with multiple movies showing.
|
|
35
|
+
|
|
36
|
+Let's make our movie list more child-friendly. Delete all entries that have a rating of R. Remember to record your query in `script.sql`.
|