table name :Tab
fields name
1.trx_no (pk)
2.trx_date
3.account code (7 char)
4.account type (1 char)
5.amt
Tab contains account code day wise debit and credit transaction , account type fiels can have 2 value D for debit and c for Credit .

write a query to display the account code wise total debit and credit bal for the month of april 2004.

write a query to display account code wise new amt credit for the april 2004

Answers were Sorted based on User's Feedback



table name :Tab fields name 1.trx_no (pk) 2.trx_date 3.account code (7 char) 4.account type (1 ..

Answer / ritika yadav

select account_code,account_type, sum (amt)
from tab
where to_char(trx_date,'DD-MM-YYYY') between '01-04-2014' and '30-04-2014'
group by account_code, account_type
order by account_code, account_type;

Is This Answer Correct ?    2 Yes 0 No

table name :Tab fields name 1.trx_no (pk) 2.trx_date 3.account code (7 char) 4.account type (1 ..

Answer / jayashree

SELECT SUM(DECODE(ACC_CODE, 'C', AMT)) Total_credit_bal,
SUM(DECODE(ACC_CODE, 'D', AMT)) Total_debit_bal
from tab
where to_char(trx_date,'DD-MON-YYYY') between
'01-apr-2014' and '30-apr-2014';

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

What is file based approach?

0 Answers  


What does cursor do in sql?

0 Answers  


Which command is used to delete a package?

0 Answers  


Why do we use joins in sql?

0 Answers  


how to give permission to users that users can update/insert/delete on a row of table on timeing 10am to 6pm only?

4 Answers   TCS,






Can we join 3 tables in sql?

0 Answers  


What does the argument [or replace] do?

0 Answers  


What does inner join mean?

0 Answers  


What are the different types of PL/SQL program units that can be defined and stored in ORACLE database ?

2 Answers  


What are synonyms in sql?

0 Answers  


What is difference between triggers and stored procedures. And advantages of SP over triggers ?

4 Answers   Microsoft, TCS,


How to use sql*plus built-in timers?

0 Answers  


Categories