We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The PADS
You are viewing a single comment's thread. Return to all 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;