Sort by

recency

|

5593 Discussions

|

  • + 0 comments
    SET NOCOUNT ON;
    
    (SELECT CONCAT(NAME, "(", LEFT(OCCUPATION,1), ")") AS OC
    FROM OCCUPATIONS
    )
    
    UNION 
    
    (SELECT CONCAT("There are a total of ", COUNT(OCCUPATION) OVER(PARTITION BY OCCUPATION)," ", LOWER(OCCUPATION),"s.") AS OC 
    FROM OCCUPATIONS
    ); 
    
    go
    
  • + 0 comments

    EASIEST WAY OF WRITING THIS QUERY DYNAMICALLY!!

    SELECT NAME || '(' || SUBSTR(OCCUPATION, 1, 1) || ')' FROM OCCUPATIONS ORDER BY NAME;

    SELECT
    'There are a total of ' || COUNT(STAR) || ' ' || LOWER(OCCUPATION) || 's.' FROM OCCUPATIONS GROUP BY OCCUPATION ORDER BY COUNT(STAR) ASC, OCCUPATION ASC;

  • + 0 comments

    EASIEST Query:

    SELECT 
        CONCAT(NAME, '(', SUBSTR(OCCUPATION, 1, 1), ')') AS RESULT
    FROM 
        OCCUPATIONS ORDER BY NAME;
    
    
    SELECT  
        CONCAT('There are a total of ', COUNT(*), ' ', LOWER(OCCUPATION), 's.') AS RESULT
    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), ' ', 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; select concat('There are a total of ', count(),' ', lower(occupation),'s.') from occupations group by occupation order by count() asc, occupation asc;