SQRT() Function in SQL

Last Updated : 9 Sep, 2026

The SQRT() function in SQL is a mathematical function used to return the square root of a non-negative number.

  • Useful for mathematical and statistical calculations.
  • Returns a decimal value when the square root is not a whole number.

Syntax

SQRT(number)
  • number: The non-negative number whose square root you want to find.

Note: The SQRT() function is supported by MySQL, SQL Server, PostgreSQ and Oracle. SQLite supports SQRT() when its math functions are enabled.

Examples

Below are some examples of the SQRT() function to understand how it is used with numeric values.

Example 1: Find the Square Root of a Number

In this example, we will calculate the square root of 25.

Query:

SELECT SQRT(25) AS square_root;

Output:

5

Example 2: Find the Square Root of a Decimal Number

In this example, we will calculate the square root of 12.25.

Query:

SELECT SQRT(12.25) AS square_root;

Output:

3.5

Example 3: Use SQRT() on a Table Column

Let us create a numbers table containing numeric values.

26

Now, we can use the SQRT() function to calculate the square root of each value.

Query:

SELECT number_id,
value,
SQRT(value) AS square_root
FROM numbers;

Output:

27
  • Calculates the square root of each value in the value column.
  • Returns the results as square_root.
Comment