Re: SQL Date help

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: waheed_rahuman <waheed_rahuman(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: SQL Date help
Date: 2001-03-26 08:58:06
Message-ID: 20010326105806.C19983@ara.zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, Mar 26, 2001 at 12:24:07PM +0400, waheed_rahuman wrote:
>
>
> Hi,
>
> I am a newbie to SQL and postgresql too.
> please guide me in the following...

Any problem with documentation?

> 1.How i can create date while i am inserting into the table ,in which the
> field is date data type.(date should not be a current date and its should be
> created
> as in java date(int,int,int)

INSERT INTO xxx VALUES (now());
INSERT INTO xxx VALUES ('2000-01-01');

> 2. How i can compare the date field.

via standard operators, en example '<' '>' '=' 'between' ..etc.

> For example ,
> how i can get the all the records between to two dates

SELECT .... WHERE col BETWEEN '2000-01-01' AND '2001-01-01';

Please(!), see

http://www.postgresql.org/users-lounge/docs/7.0/user/datatype.htm
http://www.postgresql.org/users-lounge/docs/7.0/user/operators.htm
http://www.postgresql.org/users-lounge/docs/7.0/user/operators2373.htm

Karel

--
Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
http://home.zf.jcu.cz/~zakkr/

C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Norbert Schollum 2001-03-26 09:24:32 Functions and Triggers
Previous Message Mathijs Brands 2001-03-26 08:33:38 Calling Java from psql (was Re: requesting help)