http://dev.mysql.com/doc/refman/5.0/...ction_variance

Per il calcolo della mediana vedi il commento sottostante.