Resort Manager’s Details in SQL

Question:

Resort Manager’s Details

Managements wants to know the manager of each resort. 

Display resortid , resort name,  manager name and his phone. Sort the output in ascending order of resort id. Give alias to manager name as MANAGERNAME and phone as PHONENO.

If manager is not available then display manager name  ‘NA’. If phone number is not available then display as ‘NA’.

Code:

Main.sql

select resort.resortID, resort.resortName,
nvl2(manager.name, manager.name, 'NA') as MANAGERNAME,
nvl2(manager.phone, manager.phone, 'NA') as PHONENO from resort
left join manager on resort.managerid=manager.managerid
order by resort.resortID;

Recommended:

1 thought on “Resort Manager’s Details in SQL”

Leave a Comment

Your email address will not be published. Required fields are marked *