Skip site navigation (1) Skip section navigation (2)

Re: Simple Query HELP!!!

From: 71062(dot)1056(at)compuserve(dot)com (--CELKO--)
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Simple Query HELP!!!
Date: 2001-09-24 03:49:13
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
Please write DDL and not narrative.  here is my guess at what you are
trying to do.  What you posted was not a table because you had no key.
 TEXT is not the datatype to use for names -- unless they are thousand
of characters long!!
Recording age as an integer is useless -- give us the birthday and we
can always compute their age.  Is this what you meant to post?

(name CHAR(30) NOT NULL PRIMARY KEY, -- not big enough for TEXT
 age INTEGER NOT NULL, -- should be birthdate instead
 company CHAR(30) NOT NULL);

>> ... create a query than get me a list with the seniors per company,
for example :<<

SELECT, P1.age,
  FROM People AS P1
       (SELECT *
          FROM People AS P2
         WHERE =
           AND P1.age < P2.age);

 This says there is nobody older than the P1 person in the same

In response to


pgsql-sql by date

Next:From: Stephan SzaboDate: 2001-09-24 04:57:11
Subject: Re: outer joins strangeness
Previous:From: Frederick KlauschenDate: 2001-09-24 03:01:16
Subject: How to enter lists into database.

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group