I tried this but how to calculate for leap years.
SELECT
FLOOR(DATEDIFF(NOW(), date_of_birth) / 365.25) as years,
FLOOR(MOD(DATEDIFF(NOW(), date_of_birth), 365.25) / 30.4375) as months,
MOD(DATEDIFF(NOW(), date_of_birth), 30.4375) as days
FROM employees;
Can anyone please help
See https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_timestampdiff
Re your comment:
If MySQL date functions didn't handle leap years, they'd be pretty useless, right? In fact, they do know how to handle leap years.
Thus there are 11 leap years between 1980 and today (I am writing this on 2023-01-30).