SQL tutorial | Interview questions | Oracle
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How To Name Query Output Columns?

Go down

How To Name Query Output Columns? Empty How To Name Query Output Columns?

Post by Micheal Sun Jan 17, 2010 3:16 am

Each column in the query output has a default name. If you don't like the default name, you can
specify a new name for any column in the query output by using the AS clause. The following
statement shows you a good example:
SQL> SELECT department_id AS ID, MIN(salary) AS Low,
MAX(salary) AS High, AVG(salary) AS Average
FROM employees GROUP BY department_id HAVING AVG(salary) < 5000;
ID LOW HIGH AVERAGE
---------- ---------- ---------- ----------
30 2500 11000 4150
50 2100 8200 3475.55556
10 4400 4400 4400

Micheal
Admin

Posts : 243
Join date : 2010-01-10

http://sql-tutorial.co.cc

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum