SQL, get median of all columns in each row #eg21

Judy - Aug 9 - - Dev Community

In PostgreSQL database, table T has multiple numeric columns:

Image description
We want to find the median of all column values in each row. Below is the expected result:

Image description
Write the following SPL code:

Image description
new()function creates a new two-dimensional table; ~ represents the current record; array() function converts field values of a record to a sequence.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player