Check out example codes for "postgresql reset serial counter after deleting content". It will help you in understanding the concepts better.
Code Example 1
ALTER SEQUENCE product_id_seq RESTART WITH 1453
Learn ReactJs, React Native from akashmittal.com