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
Answer Posted / 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 View All Answers
What is ASM (Automatic Storage Management) in Oracle?
What is rowid and rownum in oracle?
Explain the use of indexes option in exp command.
What privilege is needed for a user to delete rows from tables in another schema?
What happens to the current transaction if the session is killed?
ur a sql devoloper...what is the process in ur company for finding the database BUGS .. seperate DB testers are there? or devr.s are manage? if DB TESTERS in there what is the process
What is a snapshot in oracle database?
What are the set operators union, union all, minus & intersect meant to do?
What is the sid in oracle?
How to define and use table alias names in oracle?
What is oracle analytical function?
What is set operator oracle?
What is tns entry?
Where are the settings stored for each instance in oracle?
How to drop an existing table in oracle?