If you want to find the square root of any number, then the SQRT() Function is used.

The Select Statement can be used to find the square root of any number as follows:

 

The SQRT() syntax is as follows:

Select SQRT(number);

 

Example:

Select SQRT(25);

SQRT(25)

5.000000

 

You can see the float value because the SQL manipulates the square root in float data type.

The SQRT() Function can be even used to finf the square root values of the records from a table.

 

Let us consider the following Students table:

roll_no

name

total_marks

(out of 600)

percentage

grade

1

Ashok

392

65.33

B

2

Chaitali

454

75.67

A

3

Smriti

502

83.60

A

4

Kaushik

337

56.10

C

 

Example:

Now suppose based on the above table you want to calculate square root of all the total marks, then you can do so by using the following command:

 

Select name, SQRT(total_marks)

From Students;

 

The result will be as follows:

name

SQRT(total_marks)

 

Ashok

19.798

Chaitali

21.307

Smriti

22.405

Kaushik

19.416