pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: James Olin Oden <joden@lee.k12.nc.us>
To: D'Arcy J.M. Cain <darcy@druid.net>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] can a column be aliased?
Date: Mon, 3 Aug 1998 13:35:17 -0400
Message-ID: <81Aug2.122437edt.35713@gateway.lee.k12.nc.us> (raw)
References: <m0z3OEW-00006FC@druid.net>




D'Arcy J.M. Cain wrote:

> Thus spake James Olin Oden
> > I know this is probably a strange question, but can you give a column
> > name an alias?  The reason I ask is because I have recently realized I
>
> SELECT table1.oid AS custnum, table2.oid AS salesman FROM ...
>

OK, I get that, but what if you want to say:

   SELECT table1.custnum, table1.name, table2.invoicenum from table1, table2

      WHERE table1.custnum = table2.custnum;

and without using the AS clause table1.custnum is pointing to table1.oid?
The idea is in perhaps the creation of the table to do something like the AS
clause, so that I don't have to "know" later that custnum (the key field) is
actually the oid column.  The end result with this is to hide the
implementation details of the database from those querying it.  I might be
really reaching, but it would be nice if something like this is a
available...james


> --
> D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
> http://www.druid.net/darcy/                |  and a sheep voting on
> +1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.






view thread (7+ messages)  latest in thread

Message-ID: <81Aug2.122437edt.35713@gateway.lee.k12.nc.us>
Permalink:  ../81Aug2.122437edt.35713@gateway.lee.k12.nc.us/
Also on:    postgresql.org/message-id/81Aug2.122437edt.35713@gateway.lee.k12.nc.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: joden@lee.k12.nc.us, darcy@druid.net
  Subject: Re: [SQL] can a column be aliased?
  In-Reply-To: <81Aug2.122437edt.35713@gateway.lee.k12.nc.us>
  References: <m0z3OEW-00006FC@druid.net> <81Aug2.122437edt.35713@gateway.lee.k12.nc.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox