SELECT
id,
gamename,
total_play_time_median,
user_total_play_time,
cast(user_total_play_time AS numeric) / total_play_time_median AS total_play_time_ratio,
AVG(user_total_play_time / total_play_time_median) OVER() AS total_play_time_ratio_avg
FROM
gamelist g
INNER JOIN
(
SELECT
game,
total_play_time AS user_total_play_time
FROM
userreview
WHERE
uid = 'ユーザーID'
AND play = true
AND total_play_time IS NOT NULL
) AS user_total_play_time
ON g.id = user_total_play_time.game
ORDER BY
furigana
;
SQLはSQL実行フォームで実行できます。