Sort by

recency

|

5512 Discussions

|

  • + 0 comments

    -> select Concat(Name,'(',Substring(occupation,1,1),')') as N from occupations order by name;

    -> select 'There are a total of', + count(occupation), lower(concat(occupation,'s.')) from occupations group by occupation order by count(occupation), occupation ;

  • + 0 comments

    select concat(name,'(',(left(occupation, 1)),')') from OCCUPATIONS order by name;

    select concat('There are a total of ' , count(occupation),' ', case when occupation = 'Doctor' then 'doctors' when occupation = 'Singer' then 'singers' when occupation = 'Actor' then 'actors' when occupation = 'Professor' then 'professors'

             end,'.')
    

    from occupations group by occupation order by count(occupation) asc, occupation asc

  • + 0 comments

    This works for me:

    SELECT Name || '(' || SUBSTR(Occupation, 1, 1) || ')' AS name_occupation
    FROM OCCUPATIONS
    ORDER BY Name ASC;
    
    SELECT 'There are a total of ' || COUNT(*) || ' ' || LOWER(Occupation) || 's.'
    AS total_occupations
    FROM OCCUPATIONS
    GROUP BY Occupation
    ORDER BY COUNT(*) ASC, LOWER(Occupation);
    
  • + 0 comments

    Hope the below solution helps-

    SELECT CONCAT(Name, "(",LEFT(Occupation, 1),")") FROM OCCUPATIONS
    Order by Name;
    SELECT CONCAT("There are a total of ", COUNT(*)," ", LOWER(OCCUPATION),'s.') FROM OCCUPATIONS
    GROUP BY OCCUPATION
    ORDER BY COUNT(*), OCCUPATION;
    
  • + 0 comments

    SELECT Name || '' || '('|| '' || SUBSTR(Occupation,1,1) || '' || ')' FROM OCCUPATIONS order by name asc;

    select 'There are a total of' || ' ' || count(Occupation) || ' ' || lower(Occupation) || '' || 's' from OCCUPATIONS group by occupation order by count(occupation),occupation asc;