Skip to content
This repository has been archived by the owner. It is now read-only.
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

Median.sql

Starting with Postgres 9.4, use PERCENTILE_CONT instead


Adds a median function to Postgres

Found on postgresonline.com in a comment by Mike.

SELECT median(n) FROM generate_series(1, 5, 1) n;
-- 3

SELECT median(n) FROM generate_series(1, 6, 1) n;
-- 3.5

SELECT median(n) FROM generate_series(1, 0) n;
-- NULL

Installation

Run this SQL

About

Median function for PostgreSQL

Resources

Releases

No releases published

Packages

No packages published