5.10

Using the relation from Exercise 5.9, write an SQL query to generate a report showing the number of shares traded, number of trades, and total dollar volume broken down by year, each month of each year, and each trading day.


SELECT year,month,day,SUM(shares_traded) AS shares,
    SUM(num_trades) AS trades,
    SUM(dollar_volume) AS total_volume
FROM nyse
GROUP BY ROLLUP(year,month,day);