How To Name Query Output Columns in Oracle?
Submitted by: AdministratorEach 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,
2 MAX(salary) AS High, AVG(salary) AS Average
3 FROM employees GROUP BY department_id
4 HAVING AVG(salary) < 5000;
<pre> ID LOW HIGH AVERAGE
---------- ---------- ---------- ----------
30 2500 11000 4150
50 2100 8200 3475.55556
10 4400 4400 4400</pre>
Submitted by: Administrator
SQL> SELECT department_id AS ID, MIN(salary) AS Low,
2 MAX(salary) AS High, AVG(salary) AS Average
3 FROM employees GROUP BY department_id
4 HAVING AVG(salary) < 5000;
<pre> ID LOW HIGH AVERAGE
---------- ---------- ---------- ----------
30 2500 11000 4150
50 2100 8200 3475.55556
10 4400 4400 4400</pre>
Submitted by: Administrator
Read Online Oracle Database Job Interview Questions And Answers
Top Oracle Database Questions
☺ | How To Write Date and Time Interval Literals in Oracle? |
☺ | How To Use Values from Other Tables in UPDATE Statements using Oracle? |
☺ | How Much Memory Your 10g XE Server Is Using? |
☺ | How To Recover a Dropped Table in Oracle? |
☺ | How Oracle Handles Dead Locks? |
Top DB Oracle Categories
☺ | Oracle PL-SQL Interview Questions. |
☺ | Oracle DBA Interview Questions. |
☺ | Oracle D2K Interview Questions. |
☺ | OCI Interview Questions. |
☺ | Forms Reports Interview Questions. |