MySQL Calculate Age from Date of Birth Example
Here, I will show you how to work calculate age from date of birth in mysql. you will learn get age from date of birth in mysql. if you want to see an example of mysql calculate age from dob then you are in the right place. We will use mysql calculate age from birthdate. Let's get started with mysql calculate age from date field.
Sometimes, we require to get age from birthdate using mysql select query, we can do it in programming like php,.net and etc framework but if we can do it using mysql query. In bellow example mysql query you can learn how to get age from date field. We can get age value from using mysql DATEDIFF(). So, let's see bellow query.
(DATEDIFF(CURRENT_DATE, STR_TO_DATE(born_date, '%Y-%m-%d'))/365) as age
I hope it can help you...
We are Recommending you
- How to Install MySQL in Ubuntu Server?
- Node JS CRUD with MySQL Tutorial Example
- How to Create a REST API using Node.js and MySQL?
- PHP Import Excel File into MySQL Database Tutorial
- How to Execute MySQL Query in Laravel?
- MySQL Query to Remove Special Characters from String
- Laravel Where Clause with MySQL Function Example
- How to Add MySQL Trigger from Migration in Laravel?
- How to Import CSV File using MySQL?
- How to fetch this week records in MySql ?
- How to Check Empty or Null Data using MySQL Query?
- How to Copy One Table Data into Another Table using MySQL?
- How to count unique domains from email address field in MySQL ?
- Which MySQL Datatype use for Store an IP Address?