SQLWays Product Page - Migration to PostgreSQL Free Evaluation

PostgreSQL Data Types - INTERVAL

Versions: PostgreSQL 8.x and 7.x

PostgreSQL - INTERVAL
Syntax INTERVAL[(p)]
Data Period of time; Interval value is a string in single quotes with the following syntax:

'[@] value unit { value unit … }'

@ is optional, value is a number, unit is microsecond, millisecond, second, minute, hour, day, week, month, year, decade, century, millennium
or their plural form (years, days etc) and abbreviations (min, sec)
Parameters p is the number of digits in the fractional part of second, 0 ⇐ p ⇐ 6
Default p is 6
Range -178000000 to 178000000 years
Storage Size 12 bytes
Standards ANSI SQL

An example of INTERVAL:

'1 day 3 hours 31 min 24 sec'

Quantities of days, hours, minutes, and seconds can be specified without explicit unit markings. For example, the previous interval string is equal to

'1 3:31:24'

PostgreSQL INTERVAL - Equivalents in Other Databases

Database Data Type and Conversion
Oracle INTERVAL YEAR(p) TO MONTH INTERVAL DAY(p1) TO SECOND(p2)
Informix INTERVAL year-month INTERVAL day-time
HP Neoview INTERVAL year-month INTERVAL day-time

Related Data Types in PostgreSQL

Data Types
Datetime DATE TIME(p) TIMESTAMP(p)
Oracle SQL Server IBM DB2 MySQL PostgreSQL Sybase ASE Sybase ASA Informix DS Teradata HP Neoview Interbase/Firebird


SQLWays Product Page - Migration to PostgreSQL Free Evaluation

Discussion

Enter your comment:
WMTQP
 
sqlways/postgresql/data-types/interval.txt · Last modified: April 25, 2012, 04:46:37 AM (external edit)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki