Sort by

recency

|

5702 Discussions

|

  • + 0 comments

    Nice problem for beginners learning SQL formatting. Using functions to extract the first letter of the occupation and ordering the results correctly is the key part. Overall, it’s a clean and interesting practice exercise. @Dinosaur Game

  • + 0 comments

    SELECT CONCAT(NAME,"(",(SELECT LEFT(OCCUPATION,1)),")") FROM OCCUPATIONS ORDER BY NAME ASC;

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

  • + 0 comments

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

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

  • + 0 comments

    MySQL: select concat(Name, '(', substring(Occupation,1,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;

  • + 0 comments

    In MySQL Server:

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