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
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 |
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 |
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 |
Explain the relationship among Database, Tablespace and Data file?
ur a sql devoloper...what is the process in ur company for finding the database BUGS .. seperate DB testers are there? or devr.s are manage? if DB TESTERS in there what is the process
How to sort the query output in oracle?
How many data types are supported?
How to recover a dropped table in oracle?
How can we find the size of a database?
How to put more than 1000 values into an oracle in clause?
What is redo log?
What is Data Dictionary Cache in Oracle?
How to concatenate two text values in oracle?
List the various oracle database objects?
How to shutdown your 10g xe server?