MySQL Query to find the age of a person whose date of birth is stored in a column called “dob” in a table called “persons”

SELECT TIMESTAMPDIFF(YEAR, dob, CURDATE()) AS age FROM persons;

This query will return the age in years. If you want to get the age in months or days, you should use MONTH or DAY instead of YEAR in TIMESTAMPDIFF function.

To get the age in months:
SELECT TIMESTAMPDIFF(MONTH, dob, CURDATE()) AS age FROM persons;
To get the age in days:
SELECT TIMESTAMPDIFF(DAY, dob, CURDATE()) AS age FROM persons;