title: SQL query to put a number in a column and put an incremented number when there is a new text in a column
body: <p>I have a query <code>SELECT * from TABLE</code> which gives the result as below table:</p>
  <p><a href="https://i.stack.imgur.com/kAiVw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kAiVw.png" alt="enter image description here" /></a></p>
  <p>Expected column is as below:</p>
  <p><a href="https://i.stack.imgur.com/HsGCs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HsGCs.png" alt="enter image description here" /></a></p>
  <p>I want to frame a new column like whenever we get the value as <code>0</code> then the number should be incremented by <code>1</code>. I tried <code>DENSE_RANK()</code> , <code>ROW_NUMBER()</code> but couldn't get the exact result which mentioned. Is that possible in PostgreSQL.</p>