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


Please Help Members By Posting Answers For Below Questions

How to create a new tablespace in oracle?

560


Who developed oracle & when?

575


What privilege is needed for a user to create indexes in oracle?

580


What are ddl statements in oracle?

592


what is the difference between substr and instr function in oracle?

588






What is varray?

587


Database crashes. Corruption is found scattered among the file system neither of your doing nor of Oracles. What database recovery options are available? Database is in archive log mode.

1540


15. Display the item_cost and then truncate it to the nearest hundred, ten, unit, tenth and hundredth.

1705


How a database is related to tablespaces?

582


Explain how you would restore a database using RMAN to Point in Time?

1640


What are the various constraints used in oracle?

556


What are the differences between primary key and unique key?

515


HI ALL, CAN ANYONE TELL ME THE DIFFERENCES BETWEEN SQL CLUSTURS,MSQL CLUSTERS,ORACLE CLUSTERS.......THANKS IN ADVANCE

1791


Can we write dml statement in function in oracle?

638


How to use "startup" command to start default instance?

544