with amounts as (
  select
    tls_version,
    count(*) as count
  from logs
  group by tls_version
),
max as (
  select max(count) as value
  from amounts
)
select
  tls_version,
  count,
  printf('%.' || (count * 30 / max.value) || 'c', '*') as bar
from amounts, max
order by tls_version;
