[Dbix-class] Removing rows older than a given number of minutes ...

Darren Duncan darren at darrenduncan.net
Sun Jan 24 08:35:40 GMT 2010


Octavian Rasnita wrote:
> Is the following SQL
> 
> < TIMEDIFF( NOW(), ? SECONDS
> 
> a standard SQL code supported by more databases?
> 
> Until now I was using SQL codes like
> 
> < now() - interval ? second
> 
> but I am not sure if the keyword "interval" is used in other databases 
> than MySQL.
> 
> Thanks.
> 
> Octavian

Dates and times are some of the least standardized though commonly used types 
and operators in SQL.  So you generally have to assume that each DBMS does it 
their own way and work accordingly, though some similarities may exist.

Also, the INTERVAL keyword is in the SQL standard; it is badly named though, 
given that an INTERVAL in SQL isn't an interval (pair of ordered endpoints) at 
all, but rather is a duration (an amount of time).

-- Darren Duncan



More information about the DBIx-Class mailing list