The query selects those marks for which the number of marks less than it,is equal to the number of marks greater than it.
For example, consider marks as $1,2,3,4,5$ then this query will return $3$.
Another Example $1,2,3,4,5,6,7,8,9,10,11$ will return $6$
So it will return the middle most value that is median.