When working with MySQL, you might occasionally encounter situations where you need to pad a bunch of numbers with leading zeros.
Perhaps you have a requirement that all numbers have three digits, but in the data you’ve been supplied, the numbers range from a single digit, to two, and maybe three digits. Your requirement might be to pad all numbers with leading zeros, but only to make up for any shortfall in the three digit requirement.
The LPAD()
function does exactly what you want in this scenario.