PostgreSQL Tutorial PostgreSQL Advanced PostgreSQL Database Account Management PostgreSQL References
PostgreSQL Tutorial PostgreSQL Advanced PostgreSQL Database Account Management PostgreSQL References

PostgreSQL CBRT() Function



The PostgreSQL CBRT() function returns the cube root of a given number.

Syntax

CBRT(number)

Parameters

number Required. Specify the number.

Return Value

Returns the cube root of a given number.

Example 1:

The example below shows the usage of CBRT() function.

SELECT CBRT(2);
Result: 1.2599210498948734

SELECT CBRT(3);
Result: 1.4422495703074083

SELECT CBRT(10);
Result: 2.1544346900318834

SELECT CBRT(50);
Result: 3.6840314986403864

SELECT CBRT(100);
Result: 4.641588833612778

SELECT CBRT(-64);
Result: -4

Example 2:

Consider a database table called Sample with the following records:

Datax
Data 10.5
Data 21
Data 35
Data 410
Data 550

The statement given below can be used to calculate the cube root of column x.

SELECT *, CBRT(x) AS CBRT_Value FROM Sample;

This will produce the result as shown below:

DataxCBRT_Value
Data 10.50.7937005259840998
Data 211
Data 351.7099759466766968
Data 4102.1544346900318834
Data 5503.6840314986403864

❮ PostgreSQL Functions