Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Naming Columns in SQL

Status
Not open for further replies.

ADB1

Programmer
Aug 24, 2001
235
GB
Could someobody please tell me how to name columns in SQL? I have a large select stement where I want to call my columns c1, c2 etc. etc.

What is the syntax for this?

Thanks in advance.

Adam.
 
Use aliases on the columns:

[tt]SELECT col1 col_heading FROM table;[/tt]
 
I have basically built a case statement and want to call it 'description'. Could you tell me where/how I would name the columns rather than have the whole of the case statement as the column title?

Thanks,

Adam.
 
Code:
SQL> select to_char(sysdate) from dual;

TO_CHAR(S
---------
20-MAY-03

SQL> select to_char(sysdate) TODAY from dual;

TODAY
---------
20-MAY-03
The second select assigns an alias to the column. This seems to be what you are asking for. Good Luck!

Code:
select * from Life where Brain is not null
Consultant/Custom Forms & PL/SQL - Oracle 8.1.7 - Windows 2000
[sup]When posting code, please use TGML to help readability. Thanks![sup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top