Postgres - sequential counting numeric field (Italian counting)
<p>I am building a system to generate transport documents.
The table has the following fields:</p>

<pre><code>ID - Numeric And primary key
Reference_Client - Numeric reference to the customer
Date- Current Date
Code
</code></pre>

<p>In Italy, every transport document has sequential number. <code>Code</code> needs to start from 0 and increments for each <code>Date</code>.</p>

<p>How can I set <code>Code</code> to obtain automatically incremented number?</p>

<p><a href="https://i.stack.imgur.com/fJpUI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fJpUI.png" alt="screen shot of a table of data showing rows of data where the sequence number restarts at 1 on each new date"></a></p>