Re: referencing column names properly

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: "Sill-II, Stephen" <Stephen(dot)Sill-II(at)ost(dot)dot(dot)gov>
Cc: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: referencing column names properly
Date: 2003-02-09 05:50:22
Message-ID: 20030209055022.GA6860@wallace.ece.rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sat, Feb 08, 2003 at 06:34:31PM -0500, Sill-II, Stephen wrote:
> I have a table called logs with several columns whose names have '-' in
> them, e.g. User-Name
>
> I'm having trouble referencing these columns with SELECT statements.
>
> What would the proper way to address these in a statement like this?
>
> SELECT User-Name, max(Date), max(Time) from logs;

SELECT "User-Name", max("Date"), max("Time") from logs;

Assuming the MulTiCasIng you show is also in the table. SQL lets you
put anything at all in an identifier (table or column name) as long
as you quote it with double-quotes (")

Ross

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Sill-II, Stephen 2003-02-09 14:18:05 Re: referencing column names properly
Previous Message Bruno Wolff III 2003-02-09 04:38:49 Re: referencing column names properly