Format string dengan placeholder seperti C printf. Sangat fleksibel untuk formatting output.
VARCHARDiperbarui: 12 Jul 2026PRINTF(format_string, arg1, arg2, ...)Format string dengan placeholders (%d, %s, %f, etc.)
Nilai untuk mengisi placeholders
1 SELECT PRINTF('Hello %s, you have %d items', 'John', 5);
Simple string formatting.
1 SELECT PRINTF('Price: $%,.2f', 1234567.89);
Format currency dengan decimals.
1 SELECT 2 PRINTF('|%10s|', 'hello') AS right_align, 3 PRINTF('|%-10s|', 'hello') AS left_align, 4 PRINTF('|%010d|', 42) AS zero_pad;
Different alignment options.
1 SELECT PRINTF( 2 '%s: %8.2f (%+.1f%%)', 3 product_name, 4 revenue, 5 growth_rate 6 ) AS report_line 7 FROM sales_summary;
Format untuk report line.
Sudah paham PRINTF? Latih langsung di browser
Latihan interaktif, langsung di browser.