write sql query following source are
EmpID, Salary
101 1000
102 2000
103 3000
I want the output format like following
empid,sal,composite_sal
101 1000 1000
102 2000 3000
103 3000 6000

Answer Posted / farrukh shaikh

select empid,
salary,
sum(salary) over(order by empid rows unbounded
preceding) composite_sal from (select 101 EmpID, 1000
Salary
from dual
union all
select 102, 2000
from dual
union all
select 103, 3000
from dual
union all
select 110, 5000 from dual)

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the best way to do multi-row insert in oracle?

566


What privilege is needed for a user to create views in oracle?

593


Hi Masters, in Oracle Applications 11i, we hace 2 functions using the same form, i need to create 1 personalization, but that code must afect only one function.... how can i do that?

1774


How to insert multiple rows with one insert statement in oracle?

572


Whether any commands are used for months calculation? If so, what are they?

598






How to import one table back from a dump file?

597


> CREATE OR REPLACE FUNCTION FACTORIAL_1(factstr varchar2 ) 2 RETURN NUMBER AS 3 new_str VARCHAR2(4000) := factstr||'*' ; 4 fact number := 1 ; 5 BEGIN 6 7 WHILE new_str IS NOT NULL 8 LOOP 9 fact := fact * TO_NUMBER(SUBSTR(new_str,1,INSTR(new_str,'*')-1)); 10 new_str := substr( new_str,INSTR(new_str,'*')+1); 11 END LOOP; 12 13 RETURN fact; 14 15 END; explanation Above program?

1571


List the various oracle database objects?

599


How to handle a single quote in oracle sql?

595


How to use "in out" parameter properly?

618


What are the differences between blob and clob in oracle?

586


What happens to the data files if a tablespace is dropped?

578


What is a sub query? What are its various types?

587


what's query optimization and without use of IN AND Exist can we get another way data from query

1672


What are the tools for Oracle ?

611