Subtracting 30 Years from Current Date in Oracle SQL
oracle, sql
Solution
Use `Add_MONTHS` to add `(- 12 * 30)`.
SELECT Name, DOB
FROM Employee
WHERE DOB <= ADD_MONTHS(SYSDATE, -(12 * 30));
Problem
I need to write a query in which I select all people who have a date of birth over 30 years ago. Unfortunately, as I am using Oracle I cannot use the `DATEADD()` function. I have currently got this, but obviously this isn't dynamic and won't change as the years pass: ``` SELECT Name, DOB FROM Employee WHERE DOB <= DATE '1985-01-01'; ```