@yauheni said in Easy peasy:

Explanation:

Let's take all numbers from left including current number and then do same for right.

(select sum(Frequency) from Numbers where Number<=n.Number) as left

(select sum(Frequency) from Numbers where Number<=n.Number) as right

Now if difference between Left and Right less or equal to Frequency of the current number that means this number is median.

Ok, what if we get two numbers satisfied this condition? Easy peasy - take AVG(). Ta-da!

What a brilliant solution!