Is this SQL statement legal?
SELECT firstName, lastName
FROM Presidents
WHERE (endTerm-beginTerm)>4;
I need to find Presidents which had a term longer than 4 years.
can i use ‘-‘ in this query?
if not, what is the good way?
the data types are endTerm and beginTerm
Add 4 years onto beginTerm, then compare
This is generally (including using other RDBMS) safer than subtracting or calculating date differences because of how boundaries between periods are handled.