-- Pivot the Occupation column in OCCUPATIONS so that each Name is sorted alphabetically and displayed underneath its corresponding Occupation. The output column headers should be Doctor, Professor, ...
MAX(CASE WHEN OCCUPATION = 'Doctor' THEN NAME END) AS DOCTOR, MAX(CASE WHEN OCCUPATION = 'Professor' THEN NAME END) AS PROFESSOR, MAX(CASE WHEN OCCUPATION = 'Singer' THEN NAME END) AS SINGER, MAX(CASE ...