Q&A for those committed to a vegan or vegetarian lifestyle and anyone interested in learning more
--8. Using a SQL join, add a column to display the number
--of unique Badges earned by the users identified in question 3.
--SELECT a., count(distinct b.Id) as count_ditinct_badge
--FROM Users a join Badges b on a.Id = b.UserId
--where a.Reputation >= 550000
--group by a.
--order by Reputation desc
count(b.Id) OVER (PARTITION BY a.Id) avg_department_salary
FROM Users a join Badges b on a.Id = b.UserId
where a.Reputation >= 550000
order by Reputation desc