Format string dengan placeholder menggunakan {} syntax. Lebih modern dari PRINTF.
VARCHARDiperbarui: 12 Jul 2026FORMAT(format_string, arg1, arg2, ...)Format string dengan {} placeholders
Nilai untuk mengisi placeholders
1 SELECT FORMAT('Hello {}, you have {} items', 'John', 5);
Sequential placeholder replacement.
1 SELECT FORMAT('{1} said hello to {0}', 'Bob', 'Alice');
Menggunakan index untuk reorder.
1 SELECT 2 FORMAT('Price: {:,.2f}', 1234567.89) AS price, 3 FORMAT('Change: {:+.1%}', 0.156) AS percent;
Format numbers dengan specifiers.
1 SELECT FORMAT( 2 'Order #{}: {} x {} = {}', 3 order_id, 4 quantity, 5 product_name, 6 FORMAT('{:,.2f}', total) 7 ) AS order_summary 8 FROM orders;
Build readable order summary.
Sudah paham FORMAT? Latih langsung di browser
Latihan interaktif, langsung di browser.