Pads the left side of a string with characters until it reaches a specified length. Left padding.
STRINGDiperbarui: 13 Jun 2026LPAD(value, length [, pattern])The string to pad
The desired total length
The padding character (default: space)
1 SELECT LPAD('42', 5, '0') as result;
Adds leading zeros.
1 SELECT 2 CONCAT('INV-', LPAD(CAST(invoice_id AS STRING), 6, '0')) as formatted_id 3 FROM `project.dataset.invoices`;
Creates invoice IDs with a consistent format.
| formatted_id |
|---|
| INV-000001 |
| INV-000042 |
Sudah paham LPAD? Latih langsung di browser
Latihan interaktif, langsung di browser.