Q&A about the site for administrators, end users, developers and designers for Craft CMS
/* select * from Users where Location like '%China%' OR Location like '%USA%' OR Location like '%Pakistan%' */ /* rewrite by using case then */ /* select Id,Location, 'country coming from'= case when Location like '%China%'then 'coming from China' when Location like '%USA%'then 'coming from USA' when Location like '%Pakistan%'then 'coming from Pakistan' else 'coming from elsewhere' end from users */ -- generate frequency distribution table-- /*select count(Id) as 'count' ,Reputation from Users group by Reputation having Reputation > 100 order by Reputation desc */ --select users whos reputation are above averages-- select avg(Reputation) from Users -- second step: find the users who's reputations are above average-- select Id from Users where Reputation > 88