Q&A for Ubuntu users and developers
-- Developer Profiles in Israel
-- Users with Israel in their location
--select count (Id) as Users_With_Valid_AccId from Users where Id>0
--select count (Id) as Number_of_Users from Users
--select distinct count (Id) as Number_of_Users from Users where Id>0
--select * from Users where Location = 'South Africa' order by Reputation desc
--select count(UserId) from Badges where Name = 'Enlightened' and year (Date) = 2016
select max (UserId) from Badges where Name = 'Enlightened' and year (Date) = 2016
--SELECT YEAR(CreationDate) [Year], Count(Id) [Users_Created]
--WHERE YEAR(CreationDate) > 2009
--GROUP BY YEAR(CreationDate)
--ORDER BY 1
--select * from PostTypes
--select * from Posts where Posts.OwnerDisplayName = 'Mat Mannion'
--select count(Posts.Id) as Questions_Asked from Posts
--inner join PostTypes on Posts.PostTypeId = PostTypes.Id
--where PostTypes.Name = 'Question'
--AND Posts.OwnerDisplayName = 'Mat Mannion'
select max (Users.Reputation) as Reputation_Count, Users.DisplayName as Most_Reputable, max (Badges.UserId)
inner join Badges on Users.Id = Badges.UserId
where Users.Location = 'South Africa'
and Badges.Name = 'Enlightened'
and year (Badges.Date) = 2016
group by Users.DisplayName
order by Reputation_Count desc