SQL median function

Moderator: NorbertKrupa

Post Reply
User avatar
Posts: 93
Joined: Wed Jan 25, 2012 4:53 am

SQL median function

Post by usli06 » Wed Apr 20, 2016 10:12 pm

Is there a SQL function to calculate the median of a number set?

User avatar
Site Admin
Site Admin
Posts: 1825
Joined: Sat Jan 21, 2012 4:58 am

Re: SQL median function

Post by JimKnicely » Thu Apr 21, 2016 2:41 am

There is!

In my favorite Vertica client tool vsql, you can use a wild card search to find a function using the \df meta-command:

Code: Select all

dbadmin=> \df *median*
                         List of functions
 procedure_name | procedure_return_type  | procedure_argument_types
 median         | Float                  | Float
 median         | Float                  | Integer
 median         | Float                  | Numeric
 median         | Interval Day to Second | Interval Day to Second
 median         | Interval Year to Month | Interval Year to Month
(5 rows)
Jim Knicely


Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

Post Reply

Return to “New to Vertica SQL”