Flash cards
Review the key moves
1/4
Core idea
What is the main idea behind MySQL FORMAT() Function?
Lesson checks
Practice each idea before moving on
Short Mimo-style checks built from this lesson's code, terms, and sequence.
1Quick choice
Which statement best captures the main point of this lesson?
2Fill blank
Complete the missing token from the example code.
___ FORMAT(250500.5634, 2);3Order
Put the learning moves in the order that makes the concept easiest to apply.
The FORMAT() function formats a number to a format like "#,###,###.
Definition and Usage
MySQL FORMAT() Function
Example
SELECT FORMAT(250500.5634, 2);Definition and Usage
The FORMAT() function formats a number to a format like "#,###,###.##", rounded to a specified number of decimal places, then it returns the result as a string.
Syntax
FORMAT(
number
,
decimal_places
)Parameter Values
| Parameter | Description |
|---|---|
| number | Required. The number to be formatted |
| decimal_places | Required. The number of decimal places for number. If this parameter is 0, this function returns a string with no decimal places |
Technical Details
| Works in: | From MySQL 4.0 |
|---|