GROUP BY to group the records by the id column.SUM aggregate function combined with an IF statement to select the revenue for the corresponding month.id and one column for each month's revenue.
erDiagram
Department {
int id
int revenue
varchar month
id month PK
}