Calculate median in PostgreSQL

PHOTO EMBED

Wed Aug 18 2021 21:04:17 GMT+0000 (UTC)

Saved by @ofatunde #sql

## replace "sale" with variable name and "sales" with table name
SELECT PERCENTILE_CONT(0.5) WITHIN GROUP(ORDER BY sale) FROM sales;
content_copyCOPY

https://ubiq.co/database-blog/calculate-median-postgresql/