how to append prefix if the size of the data is less than 6
SELECT Cust_Id,
CASE
WHEN LEN(Cust_Id)<6
THEN CONCAT((SELECT REPLICATE('0',(SELECT LEN(Cust_Id) - 6 ) )), Cust_Id)
ELSE Cust_Id
END as Cust_Id
FROM Customers
how to append prefix if the size of the data is less than 6
SELECT Cust_Id,
CASE
WHEN LEN(Cust_Id)<6
THEN CONCAT((SELECT REPLICATE('0',(SELECT LEN(Cust_Id) - 6 ) )), Cust_Id)
ELSE Cust_Id
END as Cust_Id
FROM Customers
you could try using mysql lpad function
https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_lpad