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 |
What do you mean by cdb and pdb in oracle 12c?
i have a table with the columns below as Emp_ID Address_ID Address_Line City Country -------- --------- ----------- ------ --------- Q: Display the Emp_ID's those having more than one Address_ID
while i take backup using ibm tsm the following errors occurred: rman-03009 ora-19513 ora-27206 ora-19502 ora-27030 ora-ora19511
What is oracle and what are its different editions?
master table and child table performances and comparisons in Oracle ?
Why packages are used in oracle?
What do you mean by redo log file mirroring?
What is raw datatype in oracle?
In AP we done Customizations for Late Payments Charges. For Reporting Purpose What are the Documents Prepared for Customer Understanding??
How to select some columns from a table in oracle?
Explain the blob datatype?
in account table account type amount ac1 credit 300 ac2 debit 5000 ac3 credit 3000 ac1 debit 4000 ac3 debit 2000 ac2 credit 4000 write a query how to get sum of credit & sum of debit