0
I have always used the primary key itself as the default identification code for each record in a database table. Once the table has been used by several users, and each one has its own registered products, it will no longer be possible to maintain that standard sequence (one by one) for each user, since the code maintains the primary key sequence. In this way, I would like to check a more optimized and practical way to generate sequential code for each user. When creating a new column for each user’s sequential code, I thought of the following possibilities:
When recording each user’s product, check its generated code (starting with 1, obviously) and then store in a user’s parameter field the next code to be used by it.
Or, when engraving the product, fetch the code of the last product recorded in the table, and then increment + 1 for the new product. (I don’t think a proper way, because by deleting products, it could reuse erased code).
What they recommend to me?
thanks for the support!
– Eduardo