1.
with t as (
select name, sum(rating), row_number() over(order by sum(rating)) r
from keywords
where profession = 'backend developer'
group by name
)
select *
from t
where r<=10
2.
with t as (
select id, name, sum(rating), row_number() over(order by sum(rating)) r
from keywords
where profession = 'backend developer'
group by id, name
)
select s.id , s.keywordId , s.salary, , sum(freq)
from t left join salaries s on t.id = s.keywordId
where r<=10
group by s.id , s.keywordId , s.salary
3.
select s.id , s.keywordId , s.salary, sum(freq)
from keywords k left join salaries s on k.id = s.keywordId
where profession = 'backend developer'
group by s.id , s.keywordId , s.salary
order by sum(rating)
limit 10