In PostgreSQL, we can use the TO_CHAR()
function to add leading zeros to a number. The function converts the number to a string, using the (optional) format we specify.
Another option is to use the LPAD()
function to pad a number with leading zeros.