Mysql Query From Binary to Uuid

From binary to uuid

SELECT
  LOWER(
    CONCAT(
      LEFT(HEX(binary_field), 8),
      '-',
      MID(HEX(binary_field), 9, 4),
      '-',
      MID(HEX(binary_field), 13, 4),
      '-',
      MID(HEX(binary_field), 17, 4),
      '-',
      RIGHT(HEX(binary_field), 12)
    )
  ) AS uuid
FROM some_table