Calculating the median in SQL requires a bit more work than using a built-in function. Unlike some other aggregate functions like `AVG` or `SUM`, SQL doesn't directly provide a `MEDIAN` function. This means we need to find a way to determine the middle value in a sorted dataset. One common approach is to use the `PERCENTILE_CONT` function, which returns the value at a specific percentile. To find the median, we use the 50th percentile. Alternatively, we can use a combination of `ORDER BY` and `ROW_NUMBER` to rank the data and then identify the middle value. This method is more flexible, but requires more code.