The table has 3 columns 4 rows. The output is which column has least null values( A COL SHOULD BE THE OUTPUT)
Write the query plz.

A B C
----------
1 NULL 7
2 4 NULL
NULL 5 NULL
3 NULL NULL






The table has 3 columns 4 rows. The output is which column has least null values( A COL SHOULD BE TH..

Answer / rameshganesan

Select (Case
When a = Least Then (select 'O/P A ='||ListAgg(a,' ') Within Group(order by a) from Least_Col)
When b =Least Then (select 'O/P B ='||ListAgg(b,' ') Within Group(order by b) from Least_Col)
Else (select 'O/P C ='||ListAgg(c,' ') Within Group(order by c) from Least_Col) end)ab
From (Select count(a) a,count(b) b,count(c) c,greatest(count(a),count(b),count(c)) Least From Least_Col);

Is This Answer Correct ?    0 Yes 0 No

Post New Answer




More Oracle General Interview Questions

Can we create more than one constraint to column ?

6 Answers  


what are Triggers?

6 Answers   TCS,


3. Adapt your query in (2) above so that only post codes with more than twenty orders are displayed.

0 Answers   Wipro,


please explain.. DB architecture ...

0 Answers  


You have one employee table having 3 entries emp_id, Mgr_id and salary. Mgr_id is also referencing emp_id. so now find out the emp_id which are having the second highest salary, under a particular manager.

3 Answers   HCL, Amazon,






WHEN CURSOR MOVES FROM ONE FORM TO ANOTHER FORM, HOW MANY TRIGGER WILL BE FIRED AND WHAT ARE THEIR SEQUENCE?

0 Answers   ESS,


How to call a trigger inside a stored procedure?Give an example.

2 Answers  


4. Using a set operator, display the creditor number of all creditors who have ever been paid.

2 Answers   Wipro,


Do View contain Data ?

10 Answers  


What is Data Block ?

2 Answers  


Can I create users through internet explorer in oracle 10g?

0 Answers   MCN Solutions,


What is a Sequence ?

3 Answers  






Categories