Q_cname
SELECT CUSTNAME CNAME, SUM(AMOUNT) SUM_AMT FROM SALES
GROUP BY CUSTNAME
ORDER BY SUM(AMOUNT) DESC

Q_1
SELECT CUSTNAME CNAME2, SUM(AMOUNT) SUM_AMT2 
from SALES
group by CUSTNAME
order by SUM(AMOUNT) DESC


To add a group filter:
----------------------

function G_CNAMEGroupFilter return boolean is
begin
  :incr_cnt:=:incr_cnt+1;
    if :incr_cnt <= :cutoff_cnt then
      return (TRUE);
    else
      return(FALSE);
    end if;
end;


SELECT statement for Percentage Calculation:
--------------------------------------------
SELECT CUSTNAME CNAME2, SUM(AMOUNT) SUM_AMT2 
FROM SALES
GROUP BY CUSTNAME
ORDER BY SUM(AMOUNT) DESC


Format Trigger for Percentage Cutoff:
----------------------------------

function R_G_CNAME2FormatTrigger return boolean is
begin
if :r_pct <= :cutoff_pct then 
   return(TRUE);
else
   return(FALSE);
end if;
end;