'Passing simple unique id's for my users and products

I have a model in my application for users and products . I want to create a unique id in the database which is by order of creation eg 1 , 2, 3

More like a unique id bt based on count like each user or product is created it gets a unique id bt either 1 or 2 increasing upto even thousands Increasing from the last number



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source