← Back to profile

SQL project · PostgreSQL + Tableau

IMDb, genre by genre

How have genres and viewer ratings evolved over the years within the content industry for English-language titles, and how might that differ across regions and languages? The first pass, queried in PostgreSQL and drawn in Tableau.

PostgreSQL Tableau Data via IMDb non-commercial datasets English-language titles
10
genre buckets
from raw IMDb genre strings
4
tables joined
1910–2024
years charted
2.1–8.9
rating scale
avg. rating, out of 10
EN
language filter
1 of N
research questions
answered so far

How the data was prepared

Queried straight from a local PostgreSQL server (macOS Sonoma) against IMDb's non-commercial dataset tables, using DataGrip. Each title's comma-separated genre string is split into individual rows, joined against ratings and region/language metadata, then filtered to English-language titles in known regions before export to Tableau.

SQL techniques used

CTEsUNNESTSTRING_TO_ARRAY Multi-table JOINGROUP BYCOUNT / AVG
01

How have genres and their ratings evolved over time?

Genres are unnested from IMDb's raw comma-separated strings and rolled up into 10 buckets, then plotted by year against average rating. Documentary holds the deepest, most sustained color, meaning consistently higher average ratings across nearly the full century, while Horror & Thriller stays lighter throughout, rating consistently lower even as its volume of titles grows in later decades. Animation tells a different story: it peaked in the 1950s–60s (~7.1) and has drifted gently downward ever since, settling around 6.8 in the 2020s as output volume climbed sharply.

Tableau chart: IMDb rating analysis of English language content over the years, showing average rating by genre bucket per year from 1910 to 2024 as a color-coded strip chart
Avg. rating by genre bucket, per year · English-language titles, known regions only
+ View SQL
WITH GenreExpansions AS (
    SELECT
        imdb_basic.tconst,
        UNNEST(STRING_TO_ARRAY(genres, ',')) AS genre_split,
        startyear,
        averagerating
    FROM imdb_basic JOIN imdb_ratings ON imdb_basic.tconst = imdb_ratings.tconst
)
SELECT
    genre_split,
    startyear,
    COUNT(tconst) AS title_count,
    AVG(averagerating) AS average_rating
FROM GenreExpansions
JOIN imdb_akas ON imdb_akas.titleid = GenreExpansions.tconst
JOIN imdb_country_codes ON imdb_country_codes.region_code = imdb_akas.region
WHERE language = 'en' AND region_name != 'Unknown'
GROUP BY genre_split, startyear
ORDER BY genre_split, startyear;

Where this goes next

This first pass answers the English-language half of the question: genre and rating patterns hold up across the full 1910–2024 span. Documentary rates highest on average (7.17) and Horror lowest (5.41), a gap that's stable across the whole period, not a recent artifact. Animation sits in between but has drifted down slowly since its mid-century peak (~7.1 in the 1950s–60s to 6.80 in the 2020s), a gentle multi-decade decline rather than a sudden drop.

The stated objective is broader, comparing these trends across regions and languages, not just English. That comparison is the natural next query against the same joined tables.

View the repository on GitHub ↗