FORMAT(x,d)

Description: Returns the number x formatted with commas and rounded to d decimal places.

Examples:

  • FORMAT(12345.678,2) returns 12,345.68.

  • FORMAT(12345.678,0) returns 12,346.

See also: ROUND(), TRUNCATE()

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.