I’ve got an SQLite database that will need to contain products. Those products have a fixed-format composite product number, consisting of category, group and product numbe
Since 3.8.3 (2014) You can use printf as:
SELECT printf('%04d', product_number) AS product_number FROM table;
Change the 4 to however many digits you need. This would return 0001 for product_number 1.