Re: Help On Postgresql

From: "Henshall, Stuart - WCP" <SHenshall(at)westcountrypublications(dot)co(dot)uk>
To: "'Jaydip'" <jaydip(at)ontrackindia(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Help On Postgresql
Date: 2001-08-31 10:18:48
Message-ID: E2870D8CE1CCD311BAF50008C71EDE8E01F7468D@MAIL_EXCHANGE
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

a) Either of these should return the yaer (2001). See section 4.7 of the
user guide
SELECT EXTRACT(YEAR FROM TIMESTAMP '2001-02-16 20:38:40');
SELECT date_part('year', TIMESTAMP '2001-02-16 20:38:40');
b) The serial datatype will do this. It is actually just an int4 with a
default value of nextval('<sequence name>').
- Stuart

> -----Original Message-----
> From: Jaydip [SMTP:jaydip(at)ontrackindia(dot)com]
> Sent: Thursday, August 23, 2001 8:51 AM
> To: pgsql-sql(at)postgresql(dot)org
> Subject: Help On Postgresql
>
> Dear Friends
>
> I am Jaydip Dewanji working as a Sr. Programmer for Ontrack Systems Ltd.
>
> I have some questions regarding Postgresql which are listed below:
>
> a) How do I retrieve the Year,Month,Day,Hr,Minute or Second value from a
> Date/DateTime variable.
>
> For Example : i> In Oracle to_char(dt,'yyyy') - for extracting the
> year value from a date variable dt
> ii> In SqlServer datepart(hh,dt) - for extracting
> the Hour value from a date variable dt
>
> b) Can I create an identity column in Postgresql the value of which column
> will start from 1 say and keep
> on incrementing by 1 OR how can I serve my purpose in any other way.
>
>
> Please do let me know if any one of you have any solution.
>
> Regards
>
> Jaydip

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Poole 2001-08-31 14:17:31 Re: 2 tables, joins and same name...
Previous Message Tatsuo Ishii 2001-08-31 00:59:42 Re: Latin-2 sort order