I’m brand new to Derby (and basically databases in general) and am trying to get my feet wet with Derby via Eclipse using Java.
What I’m trying to do is generate a report of all entries currently in the Derby database from the last 30 seconds since the report has been generated.
I managed to get what I wanted in MySQL with the following:
SELECT * FROM table WHERE datetime > (now() – interval 30 second)
Is there an equivalent or similar functionality in Derby?
Unfortunately Derby does not support standard (ANSI) SQL date arithmetics. You need to use the JDBC escape functions:
For a complete list of functions see the Reference Manual: http://db.apache.org/derby/docs/10.8/ref/rrefjdbc88908.html