• + 0 comments

    -- with CTE with tab1 as( SELECT Name, LEFT(Occupation,1) as oc FROM OCCUPATIONS order by Name asc) SELECT Concat(Name,'(',oc,')') FROM tab1 ; with tab2 as( SELECT Count(Occupation) as occ, Occupation FROM OCCUPATIONS GROUP BY Occupation) SELECT Concat('There are a total of ',occ,' ',LOWER(Occupation),'s.') FROM tab2 ORDER BY occ