In this post, I am sharing the easy and finest way for calculating Age from Date of Birth of MySQL.
As a database architecture, I never suggest to store calculated Age into database because this is ever changing information base on time.
We should store only the Date of Birth into our database system and whenever it requires to show Age, we should calculate Age using Date of Birth.
I have found many complex solutions to calculate Age, but here I am sharing one of the easiest way.
First, create a table with sample data:
CREATE TABLE tbl_UserAge
INSERT INTO tbl_UserAge
Calculating Age for all data:
,TIMESTAMPDIFF(YEAR,DOB,CURDATE()) AS UserAge