• + 0 comments

    MySQL: select case when occupation = 'Doctor' then concat(name,'(D)') when occupation = 'Actor' then concat(name,'(A)') when occupation = 'Professor' then concat(name,'(P)') when occupation = 'Singer' then concat(name,'(S)') end from occupations order by name; select case when occupation = 'Doctor' then concat('There are a total of ',count(occupation),' ',lower(occupation),'s.') when occupation = 'Actor' then concat('There are a total of ',count(occupation),' ',lower(occupation),'s.') when occupation = 'Professor' then concat('There are a total of ',count(occupation),' ',lower(occupation),'s.') when occupation = 'Singer' then concat('There are a total of ',count(occupation),' ',lower(occupation),'s.') end from occupations group by occupation order by count(occupation),occupation;