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 |
Can we create database in oracle using command line ?
Difference between join and a subquery?
8 Answers Base Automation, NMDC,
How to assign a table row to a record variable?
find out first highest salary?
10 Answers Verinon Technology Solutions,
What is oracle join syntax?
How can we force the database to use the user specified rollback segment?
How to delete multiple rows from a table in oracle?
What is bind variable in oracle 11g?
What are the factors that affect OPTIMIZER in choosing an Optimization approach ?
What does `(+)` do in a where clause?
What is a oracle database?
What is a deadlock ? Explain .