The ROUND() function rounds numbers to the nearest integer or to a specified number of decimal places.
The following illustrates the syntax of the ROUND() function:
Let's explore some examples to see how the ROUND() function works.
In this example, we round decimal numbers to integers:
The query will return the nearest integer for all provided values.
Suppose you have a table named Product that stores product prices with multiple decimal places. You want to round the prices to two decimal places for display.
We use the ROUND() function to round the Price column when retrieving the data.
The result will display the product names along with their prices rounded to two decimal places.