/select_id_films_id_films_title_films_genre_count_from_films_left_join_reviews_group_by_films.id.sql
Last active
December 21, 2019 00:02
-
-
Save 3v0k4/640caa922a1ec46270345803d2f49450 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=> SELECT films.id, films.title, films.genre, count(*) as number_of_reviews FROM films LEFT JOIN reviews ON films.id = reviews.film_id GROUP BY films.id; | |
id | title | genre | number_of_reviews | |
----+-------------------+----------+------------------- | |
3 | Arrival | scifi | 1 | |
1 | Blade Runner 2049 | thriller | 3 | |
2 | Inception | thriller | 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment