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 2
NULL 3 4
NULL 5 6
7 NULL NULL
O/P
C
=
2
4
6
Answers were Sorted based on User's Feedback
Answer / rameshganesan
Select (Case
When a = Least Then (select 'A'||CHR(10)||'='||CHR(10)||ListAgg(a,CHR(10)) Within Group(order by a) from Least_Col)
When b =Least Then (select 'B'||CHR(10)||'='||CHR(10)||ListAgg(b,CHR(10)) Within Group(order by b) from Least_Col)
Else (select 'C'||CHR(10)|| '='||CHR(10)||ListAgg(c,CHR(10)) 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 ? | 1 Yes | 0 No |
Hi friends can u send the oracle 9i full version download link?????????????? please reply ?
What is the usage of control file in oracle?
How can you Enforce Referential Integrity in snapshots ?
What is meant by joins? List out the types of joins.
How to delete a column in an existing table in oracle?
can u call user defined functions in select statements
How to change user password in oracle?
We are using Oracle apps with XML publisher.In that,we are facing some problems while giving a Footer in RTF Template.While giving a footer in RTF Template it is Visible in all the pages,but after the PDF is getiing generated,the Footer are Visible on alternate pages only (like on first page ,third page) and so on. Please provide the Solution for getting the Footer on all the pages.
How to rename a tablespace in oracle?
Explain the use of grant option in exp command.
What is TNS File
sql command 2 know current database