Sort by

recency

|

5632 Discussions

|

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

    select (case when occupation = 'Doctor' then name +'(D)' when occupation = 'Actor' then name +'(A)' when occupation = 'Singer' then name +'(S)' when occupation = 'Professor' then name +'(P)' end ) from occupations order by name;

    select ('There are a total of '+convert(varchar(4),count())+' '+ lower(occupation)+'s.') from occupations group by occupation order by count() , occupation

  • + 0 comments

    SELECT CONCAT(NAME, '(', LEFT(OCCUPATION, 1), ')') FROM OCCUPATIONS ORDER BY NAME; SELECT CONCAT('There are a total of ', COUNT(OCCUPATION), ' ', LOWER(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;

    with occ_count as ( SELECT Occupation, count() as occr FROM OCCUPATIONS group by Occupation order by count(), Occupation )

    select concat("There are a total of ", occr," ", lower(Occupation),"s." ) from occ_count;

  • + 0 comments

    Concat: is a function that joins (concatenates) multiple strings together.

    LEFT: to extract a specified number of characters from the left (beginning) side of a string.

    LOWER: Converts the occupation name to lowercase

    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) ASC,  Occupation ASC;