/* List total instructor payments by month */
/* Oracle */

select lname, fname, month, sum(gross_pay), sum(tax), sum(net_pay), count(*) as "number of payments"
from payment join instructor using(instructor_id)
             join dates      using(date_id)
group by ROLLUP(lname, fname, month)
order by lname