how to calculate median on azure databricks delta table using sql

PadamTripathi
New Contributor II

how to calculate median on delta tables in azure databricks using sql ?

select col1, col2, col3, median(col5) from delta table group by col1, col2, col3