PostGIS: how to retrieve a report of costs by decades from a table
Postgres allow to extract DECADE from a timestamp value, use a CASE statment to sum each one.

SELECT 
    company, 
    sum(case when extract(DECADE from movie_date) = 195 then cost else 0 end) as Total_Decade_50s,
    sum(case when extract(DECADE from movie_date) = 196 then cost else 0 end) as Total_Decade_60s,
    sum(case when extract(DECADE from movie_date) = 197 then cost else 0 end) as Total_Decade_70s,
    sum(case when extract(DECADE from movie_date) = 198 then cost else 0 end) as Total_Decade_80s,
    sum(case when extract(DECADE from movie_date) = 199 then cost else 0 end) as Total_Decade_90s,
    sum(case when extract(DECADE from movie_date) = 200 then cost else 0 end) as Total_Decade_00s,
FROM 
    data_table 
GROUP BY 
    company
ORDER BY 
    company;


In case you get an error on extract sentence, cast your date as timestamp.

extract(DECADE from film_date::timestamp)