title: SQL Query Count results as zero event record is not exist
body: <p>I have an issue to an SQL Query (Oracle database).</p>
  <p>I have two tables. One table is &quot;ACCIDENTS &quot; and the other is &quot;REASONS&quot;. This second is table has some predefined default values.</p>
  <pre><code> - REASONS -
  
  Reason 1
  Reason 2
  Reason 3
  Reason 4
  </code></pre>
  <p>Now in the ACCIDENTS table we insert some accidents and reasons from the previous table like below</p>
  <pre><code> - ACCIDENTS -
  
  Accident 1  - Reason 1
  Accident 2  - Reason 1
  Accident 3  - Reason 4
  
  </code></pre>
  <p><strong>All I want to get the count of accidents GROUP BY all 4 reasons even if a reason does not exist in ACCIDENTS table. In this case I want to get Count = 0 like below:</strong></p>
  <pre><code>REASONS   COUNT (of Accidents)
  Reason 1    2
  Reason 2    0
  Reason 3    0
  Reason 4    1
  </code></pre>
  <p>Unsuccessfully I have already tried different type of JOIN tables but I don't get as results Reason 2 and Reason 3 because they don't exist in ACCIDENTS table. Every time the result is:</p>
  <pre><code>REASONS   COUNT (of Accidents)
  Reason 1    2
  Reason 4    1
  </code></pre>
  <p>Any solutions/thoughts ?</p>
  <p>Thanks in advance!</p>
  <hr />
  <p><strong>UPDATE !</strong></p>
  <p>This is the query:</p>
  <pre><code>SELECT R.REASON_NAME AS REASON, COUNT(A.ID) AS COUNT_OF_ACCIDENTS
  FROM ACCIDENTS A
  RIGHT JOIN REASONS R ON R.ID = A.REASON_ID
  WHERE EXTRACT(YEAR FPOM A.DATE_OF_ACCIDENT) = 2017
  GROUP BY R.REASON_NAME
  </code></pre>
  <p>If i remove the WHERE statement then I get all REASONS correctly but the Where for Year in Accidents table is mandatory.</p>