Databases: date and time functions

Databases: date and time functions

Door: Arnout van der Vorst

Unfortunately databases don’t all use the same SQL language. In most cases, the notation of SQL queries is roughly the same, however in some cases there are differences, for instance when working with dates and times:

  • SQL Server: getdate()
  • Oracle: sysdate
  • Solid: now()
  • mySQL: now()
  • Access: now

Calculation with dates on various databases also differs. SQL Server has the DateAdd funtion, Oracle has overloaded operators so you can use + to increase dates by default with a number of days. Solid has a particular notation: SELECT {fn timestampadd(SQL_TSI_DAY, 30, now())}, which gets us the current date + 30 days. mySQL uses a similar notation but doesn’t require the {fn} syntax:
SELECT TIMESTAMPADD(DAY, 30, now()).

Arnout van der Vorst

Geschreven door:
Arnout van der Vorst

Maak kennis met Arnout van der Vorst, de inspirerende Identity Management Architect bij Tools4ever sinds het jaar 2000. Na zijn studie Hogere Informatica aan de Hogeschool van Utrecht is hij begonnen als Supportmedewerker bij Tools4ever. Daarna heeft Arnout zich opgewerkt tot een sleutelfiguur in het bedrijf.  Zijn bijdragen strekken zich uit van klantondersteuning tot strategische pre-sales activiteiten, en hij deelt zijn kennis via webinars en artikelen.

Anderen bekeken ook

De vooroordelen van Single Sign On

De vooroordelen van Single Sign On

29 november 2011

RBAC: sleutelrol, beheer en evolutie

RBAC: sleutelrol, beheer en evolutie

15 maart 2011

SAP koppeling met Active Directory

SAP koppeling met Active Directory

06 september 2012

Single Sign On met terminal emulatie (VAX64, AS/400, Linux, SSH)

Single Sign On met terminal emulatie (VAX64, AS/400, Linux, SSH)

14 oktober 2010

User- en toegangsbeheer in cloud applicaties: een uitdaging

User- en toegangsbeheer in cloud applicaties: een uitdaging

04 september 2012