SELECT 
  player_id,
  (data->>'online_time')::int AS online_time
FROM "player_info"
-- 替换?操作符，用jsonb_exists函数判断online_time字段是否存在
WHERE 
  jsonb_exists(data, 'online_time')  -- 等价于 data ? 'online_time'，无占位符冲突
  AND (data->>'online_time')::int > 0
-- 按在线时间降序排序
ORDER BY online_time DESC;