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...


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

Answers were Sorted based on User's Feedback



in account table account type amount ac1 credit 300 ac2 debit 5000 ac3 credit ..

Answer / vijay patil

-----------table lavel credit debit
select
sum(case when type=credit then isnull(amount,0)end)sum_credit,
sum(case when type=debit then isnull(amount,0) end)sum_debit
from account_table;

OR -----------table lavel credit debit

select type,sum(amount)amt
from account_table
group by type;

OR (at accont lavel credit debit)

select account,type,sum(amount)amt
from account_table
group by account,type;

Is This Answer Correct ?    8 Yes 0 No

in account table account type amount ac1 credit 300 ac2 debit 5000 ac3 credit ..

Answer / sanjay

select type,sum(amount)from account table group by type

Is This Answer Correct ?    3 Yes 0 No

in account table account type amount ac1 credit 300 ac2 debit 5000 ac3 credit ..

Answer / kamala k n

select type, sum(amount) over (partiton by sid) from tab

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Oracle General Interview Questions

How to enter a new row into a table interactively?

0 Answers  


Please explain drop constraint oracle?

0 Answers  


How to create index-by table in oracle?

3 Answers  


The join defined by the default data link is an outer join yes or no ?

1 Answers   Oracle,


Select all the employees who were hired in last 2 years and who works in dept where max managers are working.

0 Answers   ESS,


I have a parent program and a child program. I want to write a statement in Exception Block of the parent program so that when the statement in the exception block is executed, the control goes to the next statement in the parent block bypassing the child block.How do i do that?

0 Answers   Mastek,


What are the advantages of oracle?

0 Answers  


What is merge statement used for?

0 Answers  


What are the different types of databases?

1 Answers  


what is kernel?

2 Answers   Microsoft,


What are the built-in functions used for sending Parameters to forms ?

0 Answers   Oracle, TCS,


List the various oracle database objects?

0 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)