Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql calculate age

SELECT DATEDIFF(CURRENT_DATE, STR_TO_DATE(t.birthday, '%d-%m-%Y'))/365 AS ageInYears
  FROM YOUR_TABLE t 
Comment

mysql get age from date

SELECT YEAR(CURRENT_DATE)-YEAR(t.birthday) AS ageInYears
  FROM YOUR_TABLE t 
Comment

mysql age by birthdate

mysql> SELECT DATE_FORMAT(FROM_DAYS(DATEDIFF(now(),YourDateofBirth)), '%Y')+0 AS Age from AgeCalculationFromDatetime;
Comment

PREVIOUS NEXT
Code Example
Sql :: join multiple tables sql 
Sql :: sql between operator 
Sql :: json with root element in sql server 
Sql :: alter table add check constraint oracle 
Sql :: inner join distinct 
Sql :: date in oracle 
Sql :: enable foreign key checks postgres 
Sql :: current date in sql 
Sql :: sql select rows with different values in one column 
Sql :: como consultar registros duplicados en mysql 
Sql :: sql set 
Sql :: opening xampp mysql in cmd ubuntu 
Sql :: row to json in sql server 
Sql :: get yesterday date ISO in psql 
Sql :: postgresql random phone number 
Sql :: sql cnvert bit to nvarchar 
Sql :: what is datetime in sql server 
Sql :: change column data type sql 
Sql :: how to select random rows from table 
Sql :: between keyword in sql 
Sql :: sql greater than 
Sql :: How to insert data in mysql ? 
Sql :: function in postgresql 
Sql :: How to backup databases using psql 
Sql :: how to print sql query 
Sql :: there is no unique constraint matching given keys for referenced table 
Sql :: tablas bootstrap responsive sql server para datos vivos 
Sql :: drop all triggers oracle 
Sql :: oracle avg 
Sql :: Assign value to variable inside Dynamic SQL 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =