Re: SQLPLUS Tricky Question...Where are the SQL Gurus ??
Date: 1995/08/04
Message-ID: <3vseqj$nk6_at_hdxx05.telecom.ptt.nl>#1/1
Darryl Snedeker x52168 <dsnedeke> wrote:
>break on report;
>compute sum of salary on report;
>
>select deptno, employee_name, salary
>from emp
>order by deptno, employee_name;
>
>The above script, as you know, will produce a listing of all employees and will
>order by department number. For each department, a sum of salaries will be
>computed. The string 'Sum ' will appear on the same line as each total.
>
>How do I change this string 'Sum' to appear as another literal string. I am
>fairly certain I have seen this worked out before, but is has been 3-4 years
>and
>I cannot find the notes I once had.
>
>Please don't respond by saying this can't be done, I've already heard from your
>premier representative.
>
You can alias the column saying:
select
Or by giving the column a format:
column DepartmentNumber format a20
select
Peter van der Kooi
deptno "Department Number"
,emp "Employee"
from
emp
column Employee format a15
deptno DepartmentNumber
,emp Employee
from
emp