This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing few mathematical operators for finding factorial, absolute and negation value in PostgreSQL.
I was reading the official the official page of PostgreSQL and found few interesting operators which we can use for the mathematical purpose.
Check below examples:
! operator for factorial:
1 2 3 4 5 |
SELECT 8 ! AS "8 factorial"; 8 factorial ------------ '40320' |
@ operator for absolute:
1 2 3 4 5 |
SELECT @ '-8.8' AS "absolute value"; absolute values ------------ '40320' |
~ operator for negation:
1 2 3 4 5 |
SELECT ~ CAST('16' AS int8) AS "negation value"; negation value --------------- '-17' |
Leave a Reply