ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Databases  >>  SQL PLSQL
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
Hello All, Could any well write a query for the following 
scenario. 

Account(table name)
No  Name   Amount 
1   ABCD   2000.00 
2   DEFG   -2000.00 
3   GHIJ    3000.50 
4   JKLM    4000.00 
5   MNOP    6000.00 

O/p Should be in this format 
No  Name  Credit  Debit 
1   ABCD  2000.00  0 
2   DEFG  0       -2000.00 
3   GHIJ  3000.50          
4   JKLM  0        -4000.00 
5   MNOP  6000.00    o

 could any one give appropriate query for this 
Thnks in Advance 
Suneel Reddy
 Question Submitted By :: Suneelreddy
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Hello All, Could any well write a query for the following scenario. Account(table name) No Name Amount 1 ABCD 2000.00 2 DEFG -2000.00 3 GHIJ 3000.50 4 JKLM 4000.00 5 MNOP 6000.00 O/p Should be in this format No Name Credit Debit 1 ABCD 2000.00 0 2 DEFG 0 -2000.00 3 GHIJ 3000.50 4 JKLM 0 -4000.00 5 MNOP 6000.00 o could any one give appropriate query for this Thnks in Advance Suneel Reddy
Answer
# 1
Select No,Name,to_char(Sal,'$9999.99') amount from emp;
 
Is This Answer Correct ?    0 Yes 5 No
Suresh Kumar Somayajula
 
  Re: Hello All, Could any well write a query for the following scenario. Account(table name) No Name Amount 1 ABCD 2000.00 2 DEFG -2000.00 3 GHIJ 3000.50 4 JKLM 4000.00 5 MNOP 6000.00 O/p Should be in this format No Name Credit Debit 1 ABCD 2000.00 0 2 DEFG 0 -2000.00 3 GHIJ 3000.50 4 JKLM 0 -4000.00 5 MNOP 6000.00 o could any one give appropriate query for this Thnks in Advance Suneel Reddy
Answer
# 2
select no, name,
case amount/abs(amount) when 1 then amount else 0 end credit,
case amount/abs(amount) when -1 then amount else 0 end Debit
from account
 
Is This Answer Correct ?    5 Yes 0 No
Mkumar.it
 
 
 
  Re: Hello All, Could any well write a query for the following scenario. Account(table name) No Name Amount 1 ABCD 2000.00 2 DEFG -2000.00 3 GHIJ 3000.50 4 JKLM 4000.00 5 MNOP 6000.00 O/p Should be in this format No Name Credit Debit 1 ABCD 2000.00 0 2 DEFG 0 -2000.00 3 GHIJ 3000.50 4 JKLM 0 -4000.00 5 MNOP 6000.00 o could any one give appropriate query for this Thnks in Advance Suneel Reddy
Answer
# 3
select sno,name,decode(sign(amount),1,0,amount)debit,decode
(sign(amount),-1,0,amount)credit from account
/
 
Is This Answer Correct ?    0 Yes 0 No
Saravana Sundar
 

 
 
 
Other SQL PLSQL Interview Questions
 
  Question Asked @ Answers
 
What is a package ? What are the advantages of packages ? Symphony1
what is meant by DML? HCL5
What are the types of triggers ? TCS4
what is the command for user data type?  2
What are different types of joins ? BirlaSoft3
What are the PL/SQL Statements used in cursor processing ?  2
Name the tables where characteristics of Package, procedure and functions are stored ?  3
When would you denormalize? Microsoft4
how to create object in plsql TCS1
In a Distributed Database System Can we execute two queries simultaneously ? Justify ?  1
Create table emp (id number(9), name varchar2(20),salary number(9,2)); The table has 100 records after table created.Now i nee to change id's Datatype is to be Varchar2(15). now Alter table emp modify(id varchar2(15),name varchar2(20), salary number(9,2)); Whether it will work or returns error? post answer with explanation. TCS4
What are the advantages and disadvantages, compared to the standard SQL and SQL*plus ?  1
How many database objects (trigger, packages, sequence etc) uses a particular field in a given table. For ex: I want to know how many database object uses the ATTRIBUTE1 in the PO_VENDORS table. What query will give me the result showing the database object name(package, trigger etc), field_name used (in this case ATTRIBUTE1) and table_name (in this case PO_VENDORS). IBM1
What is a trigger ? BirlaSoft6
can i write pl/sql code in a package  2
how instead of triger is helpful for mutating tables errors handlling ? Oracle2
What is difference between CHAR and VARCHAR2?What is the maximum SIZE allowed for each type? Saama-Tech2
check whether all the emp numbers are indeed unique.  3
what is definer rights invoke rights?  1
Find out the 3rd highest salary? BirlaSoft14
 
For more SQL PLSQL Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com