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
What is a trigger and what are its types?
How to view existing locks on the database?
What are the uses of linked server and explain it in detail?
is there a tool to trace queries, like profiler for sql server?
How to set up autotrace for a user account?
How to change user password in oracle?
What is user managed backup in Oracle?
interview questions with answer for cts
How to pass a parameter to a cursor in oracle?
what is IDE,DMV in sql server?
Explain the use of tables option in exp command.
Can we write insert statement in function in oracle?
How to handle a single quote in oracle sql?
Explain the use of online redo log files in oracle.
How many objectname will be created for a single table drop function? Why 'flashback' query giving error "ORA-38312: original name is used by an existing object" while getting the table?