Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: as in SQL
The 'as' is used to stipulate what follows is a column alias (but the as is
optional).
eg select to_char(datefield,'dd-mon-yy hh24') as TIME
or
select to_char(datefield,'dd-mon-yy hh24')TIME
either way renames the column to TIME instead of to_char(datefield,'dd-mon-yy hh24').
Hope it helps.
In article <75cafk$bql$1_at_kraken.itc.gu.edu.au>,
c.undieseastwood_at_gu.edu.au (Chris Eastwood) wrote:
> HiYa
>
> I am interested in a piece of SQL that I have just seen, I don't understand
> the need for the AS clause in the select statement.
>
> IE
>
> CREATE TABLE bill
> (
> VERS,
> CAT_NAME,
> ITEM_TYPE,
> ITEM,
> OLD_ITEM,
> ACCNBR_ACC,
> SECMASK1,
> OLD_SECMASK1,
> SECMASK2
> )
> AS <--- I understand this one ...
> SELECT
> VERS,
> CAT_NAME,
> ITEM_TYPE,
> replace(ITEM,'98','99') as ITEM, <---- but not this
> ITEM AS OLD_ITEM,
> ACCNBR_ACC,
> replace(SECMASK1, '98','99') as SECMASK1, <--- or this
> SECMASK1 as OLD_SECMASK1,
> SECMASK2
> FROM
> blah blah blah
> );
>
> surely the table bill would be created the positional order of the
> colum names?? Even then the column could be aliased.
>
> Thanks
>
> See Ya
> (when bandwidth gets better ;-)
>
> Chris Eastwood
> Photographer, Programmer email ua.ude.ug.cti_at_doowtsae.c
> Motorcyclist and dingbat WWW http://chrise.itc.gu.edu.au
>
> please remove undies for reply
> ************************************************************************
> Ohhh ... you work all day, slave over a hot stove all night
> yet you *still* have time for sadomasochism ... how do you do it?
>
> A little man hurts me.
>
> <ding>
> Oh Mister Mean ... Oh Mister Mean
> 15 Minutes with him and you'll be blue and green
> Studded belts and leather whips
> Bondage trousers on his hips
> Wack and punish as you dust with Mister Mean
> Ohhhh he whips me around the house in minutes ... lets get cracking ...
>
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Fri Dec 18 1998 - 07:48:34 CST
![]() |
![]() |