I have a table consisting of one column (BIRTH_DATE). How could I use sysdate to subtract from all the rows of my BIRTH_DATE and GROUP BY them together?
to be more clear:
Here is what I have fetched, now I would like to add an AGE Column to the below Table for all rows
ID Birth_Date
___ ___________
1 02-JAN-63
2 23-OCT-31
3 30-DEC-35
4 06-MAY-83
Thanks in advance!
To get a person's age according to the usual criterion (i.e. according to the number of calendar years that have passed since their birth), taking into account leap years, you can use the MONTHS_BETWEEN operator:
SELECT id, MONTHS_BETWEEN(sysdate, birth_date) / 12 age FROM my_table;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With