4.20

Show how to define a view tot_credits(year,num_credits), giving the total number of credits taken in each year.


CREATE VIEW tot_credits(year,num_credits) AS (
    SELECT year, SUM(credits)
    FROM takes NATURAL JOIN course
    GROUP BY year
    ORDER BY year ASC
)