hello SQL

0

Please login or register to vote for this query.

(click on this box to dismiss)

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

-- select user coming from India,China and USA --
-- after checking the logical model,the user table has all information we need --
/*select *
from Users
where Location like'%China' 
OR
Location like '%India'
OR
Location like '%USA'
 */
 
 --rewrite by using case then --
/*select Id,Location, 'country coming from'=
case when location like '%India' then 'coming from India'
     when location like '%China' then 'coming from China'
     when location like '%USA' then  'coming from USA'
     when Location is null then 'no location information'
     else 'coming from other countries'
     end
from Users      
*/

-- generate a frequency table for reputation
select count(Id) as 'count', Reputation
from Users
group by Reputation
order by Reputation desc

Enter Parameters

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