Generate the following two result sets:
- Query an alphabetically ordered list of all names in OCCUPATIONS, immediately followed by the first letter of each profession as a parenthetical (i.e.: enclosed in parentheses). For example:
- Query the number of ocurrences of each occupation in OCCUPATIONS. Sort the occurrences in ascending order, and output them in the following format:
There are a total of [occupation_count] [occupation]s.
[occupation_count]is the number of occurrences of an occupation in OCCUPATIONS and
[occupation]is the lowercase occupation name. If more than one Occupation has the same
[occupation_count], they should be ordered alphabetically.
Note: There will be at least two entries in the table for each type of occupation.
There are a total of 2 doctors.
There are a total of 2 singers.
There are a total of 3 actors.
There are a total of 3 professors.
Logic: Be careful of order by asc and the semicolons at the end of each select statement
select concat(Name, concat("(", concat(Substring(occupation, 1, 1), ")"))) as Name
from occupations order by Name asc; /*alphabetical*/select "There are a total of ", count(occupation), concat(lower(occupation),"s.")
from occupations group by occupation order by count(occupation), occupation asc;