Re: Help On Postgresql

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Jaydip <jaydip(at)ontrackindia(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Help On Postgresql
Date: 2001-08-30 17:49:17
Message-ID: Pine.BSF.4.21.0108301043170.53788-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, 23 Aug 2001, Jaydip wrote:

> 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

I'm not sure what versions all of these came in at, but:
There is a to_char which should be somewhat compatible with oracle's,
as well as a datepart (whose part names are like 'year', 'month', ...)
and extract(<part> from 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.

Look at sequences and the serial pseudo-type.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jeff Eckermann 2001-08-30 18:16:13 Re: Help On Postgresql
Previous Message Arne Weiner 2001-08-30 17:46:50 Re: Help On Postgresql