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 / 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 |
How to use null as conditions in oracle?
what is shell?
What is a initialization parameter file in oracle?
What are ddl statements in oracle?
How to invoke the data pump import utility?
What happens if the update subquery returns multiple rows?
What is a trigger and what are its types?
Why do we use bulk collect in oracle?
Which database is better for os platform dependency?
How to build data dictionary view an new database?
How to set a transaction to be read only in oracle?
How to Truncate Table in Oracle