You can copy and paste the LaTeX notation in a LaTeX editor to view the math notation. A good online LaTeX editor tool is HostMath.
Let
Weighted standard deviation is expressed as
CREATE TABLE data (
w real, /* Weight */
x real); /* Random variable */
SELECT sum(w * x) / sum(w) AS weighted_avg FROM data;
Weighted standard deviation is not easy to do in Postgres following the definition above, because we have to store
This equation does not contain
SELECT
sqrt((sum(w * x^2) - (sum(w * x))^2 / sum(w)) / ((count(*) - 1) * sum(w) / count(*))) AS std
FROM data;