SELECT a.* , count(b.Id) OVER (PARTITION BY a.Id) avg_...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Vegetarianism

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


SELECT 
    a.* ,
    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

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results