i have one table with accounts and amounts as
colums.accounts with columns c and d. and amounts with
values 1000,2000,3000 for c and 4000,5000,8000 for d.i need
to find the sum of these accounts c and d individually
and find the differences between their sum using one select
statement.

Answer Posted / bunty

Hi,
I dont know if this is a intended way for which interviewer
has asked, but it will definitely give an answer,

select (select sum(value) from test_tab where parent='D')-
(select sum(value) from test_tab where parent='C')
difference from dual;

Cheers,
Bunty

Is This Answer Correct ?    13 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the maximum number of columns in sql table?

540


What is function and procedure in pl sql?

510


What is the difference between a database and a relational database?

554


What port does sql server use?

498


How do I create an index in word?

533






What is AUTH_ID and AUTH_USER in pl/sql ?

1679


What is %rowtype in pl sql?

504


How do I add a database to sql?

564


How to change a value of the field ‘salary’ as 7500 for an employee_name ‘john’ in a table employee_details?

887


Can one improve the performance of sql*loader? : aql loader

575


what are the t string functions available in tsql? : Transact sql

533


What is a data manipulation language?

566


What is trigger explain it?

540


Is primary key a clustered index?

526


what is the difference between a having clause and a where clause? : Sql dba

510