SQL ROUND()

stuartmosquera's avatar
Published Oct 24, 2025
Contribute to Docs

The SQL math function ROUND() returns the number rounded to the given number of decimal places. If no decimal places are provided, the number is rounded without decimals.

Note: In some RDBMS like SQL Server, there may be an optional third parameter to truncate instead of round.

  • Learn to analyze data with SQL and prepare for technical interviews.
    • Includes 9 Courses
    • With Certificate
    • Beginner Friendly.
      17 hours
  • In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.
    • Beginner Friendly.
      5 hours

Syntax

ROUND(number, decimals)

Parameters:

  • number: The number to be rounded.
  • decimals (optional): The total number of decimal places to round to.

Return value:

Returns the number rounded to the given number of decimal places.

Example 1

In this example, the ROUND() function is used with a single argument:

SELECT ROUND(25.50);

The output this code generates is:

ROUND(25.50)
26

Note: When no decimal places are provided, ROUND() returns the nearest integer.

Example 2

In this example, the following data is given in the sales table:

id total
1 123.456
2 987.654

The ROUND() function is used with the second optional argument decimals, setting the number of decimal places to 1:

SELECT id, ROUND(total, 1) AS total_rounded FROM sales;

This SQL statement rounds the total values and puts the results into a column named total_rounded using the AS keyword.

The output will be:

id total_rounded
1 123.5
2 987.7

All contributors

Contribute to Docs

Learn SQL on Codecademy

  • Learn to analyze data with SQL and prepare for technical interviews.
    • Includes 9 Courses
    • With Certificate
    • Beginner Friendly.
      17 hours
  • In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.
    • Beginner Friendly.
      5 hours