Temporal Preferences
There are several temporal preferences in PSQL.
Earliest
The desired Date/Time should be as early as possible.
Syntax
PREFERRING <column> EARLIEST [<supremum>, <d>] [, <c>] [<SV-Relation>] |
Example
SELECT * FROM car PREFERRING reg_date EARLIEST; |
Latest
The desired Date/Time should be as late as possible.
Syntax
PREFERRING <column> LATEST [<supremum>, <d>] [, <c>] [<SV-Relation>] |
Example
SELECT * FROM car PREFERRING reg_date LATEST; |
Later / earlier than
The desired Date/Time should be later or earlier than the denoted Date/Time.
Syntax
PPREFERRING <column> LATER THAN <z> [, <d> ] [, <c> ] [<SV-Relation>] <column> EARLIER THAN <z> [, <d> ] [, <c> ] [<SV-Relation>] |
Example
SELECT * FROM car PREFERRING reg_date LATER THAN DATE '2012-12-23'; |
SELECT * FROM car PREFERRING reg_date EARLIER THAN DATE '2012-12-23'; |