Resolved: AVG's salaries are about the same, but what about the other benchmarks?
SELECT
e.gender,
COUNT(e.gender) AS num_of_gender,
AVG(s.salary) AS salary_mean,
MAX(s.salary) AS max_salary,
MIN(s.salary) AS min_salary
FROM
employees e
JOIN
salaries s ON e.emp_no = s.emp_no
GROUP BY e.gender;
# The median might give us a clearer idea.
Hi Jorge!
Thanks for reaching out!
Could you please support your question with further explanation about these benchmarks you are asking for? This can help us assist you better. Thank you.
Looking forward to your answer.
Best,
Tsvetelin
Basically i was wondering if there is a direct way to compute the median of a numeric column in MySQL, or maybe in other SQL engines?
Hi Jorge!
Thanks for reaching out.
Currently, there is no pre-defined function in MySQL calculating the median of a set of values. Nor there is one in PostgreSQL or Microsoft SQL Server, apparently. It is up to the user to write/create such a function.
Hope this helps.
Best,
Martin