Develop a query to display the retirement age of an employ based on the date of birth. The following additional points are to be considered.
Retirement age is 60 years.
All employee will retire on last day of the retirement month. Example, if someone completes 60 years on 5th May 2016 then retirement day will be 31st May 2016.
Sunday is a holiday, so if last day of the month is a Sunday then previous day or the last working day will be considered as retirement day.
You will develop this by using a single query and without using any scripting language.
For easy understanding we will develop this query in different steps.
First let us calculate the date of completion of 60 years by adding 60 Years to Date of Birth.
For this we will use DATE_ADD() function.