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.
- Prepare
- SQL
- Advanced Select
- The PADS
- Discussions
The PADS
The PADS
Sort by
recency
|
5445 Discussions
|
Please Login in order to post a comment
with cte as ( select name, concat("(",substring(occupation,1,1),")") as first from occupations order by name ) select concat(name,first) from cte; with cte2 as( select count(occupation)as occupation_cnt, lower(occupation) as loccupation from OCCUPATIONS group by occupation order by occupation_cnt, loccupation ) select concat("There are a total of ", occupation_cnt," ",loccupation,"s.") from cte2;
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),occupation; Oracle
mysql
SELECT CONCAT(name, '(', LEFT(occupation, 1), ')') FROM occupations order by name;
SELECT CONCAT('There are a total of ', count.cnt, ' ', count.occupation, 's.') as str FROM ( SELECT LOWER(occupation) as occupation, COUNT(*) as cnt FROM occupations GROUP BY Occupation ) AS count order by cnt, occupation
SELECT Name || '(' || LEFT(Occupation, 1) || ')' AS FormattedName FROM OCCUPATIONS ORDER BY Name;
SELECT 'There are a total of ' || COUNT(Occupation) || ' ' || LOWER(Occupation) || 's.' AS Summary FROM OCCUPATIONS GROUP BY Occupation ORDER BY COUNT(Occupation), Occupation;
My solution: