Returns the difference between two dates in the specified unit.
Syntax
TIMESTAMPDIFF(unit, d1, d2)Example
Enter values below to update the example in real time.
employee_id→birth_date→employees→-- 나이 계산 (년)
SELECT employee_id, TIMESTAMPDIFF(YEAR, birth_date, CURDATE()) AS age
FROM employees;