I am trying to sort data in an SQL table and then perform query operations on the sorted data.
Usually the ORDER BY
keyword sorts data from the resulting query. But how do I sort the data first, and then perform query operations on the data?
I tried the following query, which doesn't work.
SELECT NAME FROM (SELECT * FROM TABLE ORDER BY ID) WHERE <query_operation_after_sorting>;
Although the case here is to find the median, the approach I want to have here is to sort the data first and then perform any operations with it, without using any other functions.