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 / 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 |
Post New Answer View All Answers
How to define an anonymous procedure without variables?
How to call a stored function with parameters?
src name sex a,male b,female c,male d,female Required output : male female a,b c,d tried pivot but was not successfull select * from src pivot (max(name) for sex in ('MALE','FEMALE'));
How do I spool in oracle?
What is execute immediate in oracle?
What is the disadvantage of User defind function?
What are joins, explain all types of joins?
How to login to the server without an instance?
Explain a segment?
How do we create privileges in oracle?
How to use "if" statements on multiple conditions?
What is oracle datasource?
What are the ways tablespaces can be managed and how do they differ?
How do I start tns listener?
How to define an oracle cursor variable?