Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



write sql query following source are EmpID, Salary 101 1000 102 2000 103 3000 ..

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

write sql query following source are EmpID, Salary 101 1000 102 2000 103 3000 ..

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

write sql query following source are EmpID, Salary 101 1000 102 2000 103 3000 ..

Answer / niru

select empid,sal,sal+lead(nvl(sal,0) from emp_det

Is This Answer Correct ?    0 Yes 0 No

write sql query following source are EmpID, Salary 101 1000 102 2000 103 3000 ..

Answer / farrukh shaikh

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

Post New Answer

More Oracle General Interview Questions

How to upsert (update or insert into a table)?

0 Answers  


1) What is ONE_SIZE_FITS_ALL approach? 2) Explain the Common & Variable Header of DATA FILE? 3) What are the Drawbacks to using OMF DB? and the Advantages? 4) List out the Advantages of Undo T.spaces over the Undo SEGMENT? 5) Difference between the Temporary tablespace with TEMPFILE and the Tablespace with TEMPORARY Keyword? 6) What are the situation extents are freeing for reuse.

0 Answers   TCS,


What is program global area (pga) in oracle?

0 Answers  


What is dual table oracle?

0 Answers  


How to insert a new row into a table in oracle?

0 Answers  


How can you use check constraints for self referential integrity?

0 Answers  


How to use "while" statements in oracle?

0 Answers  


What is TNS File

7 Answers   Thermotech,


What happens to indexes if you drop a table?

0 Answers  


Difference between an implicit & an explicit cursor.?

2 Answers  


What is difference between truncate and delete?

0 Answers  


What are the components of Physical database structure of Oracle Database?

4 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1809)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)