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
|
5632 Discussions
|
Please Login in order to post a comment
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
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;
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;
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