Re: SQL CONSTRAINTS - Constraining time values from two attributes on a table.

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "Maher, Christopher W" <christopher(dot)w(dot)maher(at)intel(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: SQL CONSTRAINTS - Constraining time values from two attributes on a table.
Date: 2001-10-05 20:31:25
Message-ID: web-142742@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Chris,

> Hi,
> I was looking for a solution on how to write a constraint into a '
> create
> table ' expression that would ensure that one ' TIME ' attribute
> value
> called arrival_time (declared as TIME) is allways constrained to have
> a
> value that ensures it is allways after another attribute value called
> departure_time (declared as TIME).
> Any know how this constraint would be written??

Easy:

CONSTRAINT arr_dep_time CHECK ( arrival_time > departure_time )

______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco

Attachment Content-Type Size
unknown_filename text/plain 2 bytes
unknown_filename text/plain 2 bytes
unknown_filename text/plain 2 bytes

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 2001-10-05 20:42:58 Re: temporary views
Previous Message Esteban Gutierrez Abarzua 2001-10-05 19:45:02 sql + C