SQL Solution For HackerRank Problem: Occupations
This another problem from HackerRank / Advanced Select Challenges called Occupations, Here is the SQL solution in MySQL environment.
Problem Description
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, Singer, and Actor, respectively.
Note: Print NULL when there are no more names corresponding to an occupation.
To know the details about the problem visit : Occupations
Solution
Please check the snippet for the sql implementation. If you have different approach in mind feel free to share in the comment below.
Originally posted at: github.com by @Thomas-George-T
Comments
Leave a comment
You are not LoggedIn but you can comment as an anonymous user which requires manual approval. For better experience please Login.