class 2---- 03-27-2024

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 useers 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 info'
      else 'coming from other countries'
      end 
from Users
*/


-- Aggregation Function --

-- generate a frequency table for reputation --

select count(Id) as 'countReputation', Reputation
from Users
group by Reputation
having Reputation >100 
order by Reputation desc

Enter Parameters

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