Re: [SQL] function to find difference between in days between two dates

2007-06-14 Thread Pavel Stehule
Hello PostgreSQL hasn't any official function for it. If you need it, you can write own function CREATE FUNCTION date_diff(date, date) returns integer as $$ select $1-$2; $$ language sql; Regards Pavel Stehule 2007/6/14, Ashish Karalkar <[EMAIL PROTECTED]>: Hello all, Is there any function

Re: [SQL] function to find difference between in days between two dates

2007-06-14 Thread A. Kretschmer
am Thu, dem 14.06.2007, um 11:56:15 +0530 mailte Ashish Karalkar folgendes: > Hello all, > > Is there any function to find differences in days between two dates? Yes, age(). Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FF

Re: [SQL] setof or array as input parameter to postgresql 8.2 functions

2007-06-14 Thread Manso Gomez, Ramon
How can delete my suscription to this forums? -Mensaje original- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] En nombre de Jyoti Seth Enviado el: jueves, 14 de junio de 2007 8:04 Para: 'Pavel Stehule' CC: [EMAIL PROTECTED]; pgsql-sql@postgresql.org Asunto: Re: [SQL] setof or array as i

Re: [SQL] function to find difference between in days between two dates

2007-06-14 Thread Pavel Stehule
2007/6/14, A. Kretschmer <[EMAIL PROTECTED]>: am Thu, dem 14.06.2007, um 11:56:15 +0530 mailte Ashish Karalkar folgendes: > Hello all, > > Is there any function to find differences in days between two dates? Yes, age(). there is difference date - date --> integer age(date::timestamp, date

[SQL] Organization of tables

2007-06-14 Thread Salman Tahir
Hi, I have a question regarding the organization of a table I want to create in my database: I have the following setup: Table Fragments (simplified example): Primary key = {mass} Approach (1) fragment | mass (of fragment) | peptide ---++-

Re: [GENERAL] [SQL] function to find difference between in days between two dates

2007-06-14 Thread Pavel Stehule
2007/6/14, Martijn van Oosterhout <[EMAIL PROTECTED]>: On Thu, Jun 14, 2007 at 09:00:12AM +0200, Pavel Stehule wrote: > Hello > > PostgreSQL hasn't any official function for it. If you need it, you > can write own function Not true. Anything that is done by an operator as actually done by a func

Re: [GENERAL] [SQL] function to find difference between in days between two dates

2007-06-14 Thread Pavel Stehule
Hrm, yet Bruce mentions it in one of his documents. http://momjian.us/main/writings/pgsql/data_processing.pdf It may be undocumented, but it get a lot of hits on google :) why google? look to pgsql/src/backend/utils/adt/date.c :-) Regards Pavel Stehule ---(end of br

[SQL] Random Unique Integer

2007-06-14 Thread Campbell, Lance
I have a table T1. It contains a field called F1. Is there a way for me to set the table T1 up such that F1 can be populated with a random integer such that F1 is a unique integer? I would rather not create a stored procedure. Thanks, Lance Campbell Project Manager/Software Archit

Re: [SQL] Random Unique Integer

2007-06-14 Thread Michael Fuhr
On Thu, Jun 14, 2007 at 08:08:26AM -0500, Campbell, Lance wrote: > I have a table T1. It contains a field called F1. Is there a way for > me to set the table T1 up such that F1 can be populated with a random > integer such that F1 is a unique integer? What problem are you trying to solve? The s

Re: [SQL] Organization of tables

2007-06-14 Thread Rodrigo De León
On 6/14/07, Salman Tahir <[EMAIL PROTECTED]> wrote: Any help on how best to structure such data would be mostly appreciated. See: http://en.wikipedia.org/wiki/Database_normalization *** Grossly oversimplified example follows *** CREATE TABLE PEPTIDE( NAME TEXT PRIMARY KEY ); CREATE TABLE FR

Re: [SQL] Random Unique Integer

2007-06-14 Thread Campbell, Lance
I have a web application that is used to create web surveys and web forms. Users can create any number of surveys or forms at any time. The primary key on one of my tables defines the ID for any given form or survey. I do NOT want the number sequential. Since I use the number in the web URL as a

Re: [SQL] Random Unique Integer

2007-06-14 Thread Kristo Kaiv
On 14.06.2007, at 22:40, Campbell, Lance wrote: I have a web application that is used to create web surveys and web forms. Users can create any number of surveys or forms at any time. The primary key on one of my tables defines the ID for any given form or survey. I do NOT want the number s