title: pivoting/formatting SQL select statement output
body: <p>I have the following SQL tables in Oracle</p>
  
  <pre><code>EVENT
  event_id        event_name
  ----------------------------
  001                A
  002                B
  003                C
  004                D
  005                E
  006                F
  
  EVENTOCCURENCE
  datetime            event_id
  -------------------------------
  21-06-2019            A
  16-03-2019            C
  10-02-2019            A
  02-01-2019            B
  13-09-2019            A
  27-02-2019            C
  04-06-2019            A
  09-01-2019            B
  </code></pre>
  
  <p>I want to retrieve an output which looks like this</p>
  
  <pre><code>event_id        no_of_occurences        Jan    Feb    Mar ....
  ------------------------------------------------------------
  A                    4                   0      1      0
  B                    2                   2      0      0
  C                    2                   0      1      1
  D                    0                   0      0      0
  E                    0                   0      0      0
  F                    0                   0      0      0
  </code></pre>
  
  <p>I have aggregated the data as follows</p>
  
  <pre><code>SELECT
      *
  FROM
           event left
      JOIN (
          SELECT
              to_char(datetime, 'Month'),
              event_id,
              COUNT(*)
          FROM
              eventoccurence
          GROUP BY
              event_id,
              to_char(datetime, 'Month')
      ) o
      ON event.dem_code = o.dem_code;
  </code></pre>
  
  <p>But am unsure how to format it to retrieve the expected output.</p>