patternsqlMinor
What does the vertical pipe slash operator do?
Viewed 0 times
thewhatoperatorslashpipedoesvertical
Problem
I'm wondering what pipe slash
The statement works and it definitely changes the value:
What does the pipe-slash operator
|/ does in,SET equal_area_radius = |/area/pi();The statement works and it definitely changes the value:
SELECT |/125.555/pi(); -- returns: 6.32181918120139
SELECT 125.555/pi(); -- returns: 39.9653977598058What does the pipe-slash operator
|/ do?Solution
The
So
|/ operator calculates the square rootpostgres> select |/16, sqrt(16);
?column? | sqrt
----------+------
4 | 4
(1 row)So
|/125.555/pi() is equivalent to sqrt(125.555/pi())Code Snippets
postgres> select |/16, sqrt(16);
?column? | sqrt
----------+------
4 | 4
(1 row)Context
StackExchange Database Administrators Q#226690, answer score: 5
Revisions (0)
No revisions yet.