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

Answers were Sorted based on User's Feedback



write sql query following source are EmpID, Salary 101 1000 102 2000 103 3000 ..

Answer / bijaylaxmi sahoo

write sql query following source are
table name-emp_det
EmpID, Salary
101 1000
102 2000
103 3000
answer-
select t.empid,t.sal,(select sum(x.sal) from emp_det x
where x.empid<=t.empid) as com_sal
from emp_det t;
output-
empid,sal,composite_sal
101 1000 1000
102 2000 3000
103 3000 6000

Is This Answer Correct ?    9 Yes 1 No

write sql query following source are EmpID, Salary 101 1000 102 2000 103 3000 ..

Answer / mukesh

select empid,
salary,
sum(salary) over(order by empid rows unbounded
preceding) composite_sal from source

Is This Answer Correct ?    3 Yes 0 No

write sql query following source are EmpID, Salary 101 1000 102 2000 103 3000 ..

Answer / niru

select empid,sal,sal+lead(nvl(sal,0) from emp_det

Is This Answer Correct ?    0 Yes 0 No

write sql query following source are EmpID, Salary 101 1000 102 2000 103 3000 ..

Answer / 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

More Oracle General Interview Questions

What is oracle and what are its different editions?

0 Answers  


What is the difference difference between $ORACLE_HOME and $ORACLE_BASE.

0 Answers   MCN Solutions,


Can we insert data in view oracle?

0 Answers  


How to recover a dropped index?

1 Answers  


how do we code triggers , store procedure , Performance tuning and indexing in a Java Project? Pls kindly get me the perfect answer with the code for each....thank you in advance............pls any body kindly help me soon as possible....

0 Answers  






Explain the use of file option in exp command.

0 Answers  


How you open and close a cursor variable.Why it is required?

2 Answers  


Explain temporal data types in oracle

0 Answers  


Explain the dml?

0 Answers  


Will you be able to store pictures in the database?

0 Answers  


What is the cache hit ratio, what impact does it have on performance of an Oracle database and what is involved in tuning it?

0 Answers  


> 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?

0 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1789)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)