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
How remove data files before opening a database?
Why oracle is used?
How can we delete duplicate rows in a table?
How to export data to a csv file?
What happens to the current transaction if a ddl statement is executed?
How will you write a query to get a 5th rank student from a table student_report?
Can we create trigger on materialized view in oracle?
Hi this srilatha. I comlpeted my Oracle-hrms. can u provide me interview questions on Core hr, payroll,sshr,OLM etc..
Why does oracle 9i treat an empty string as null?
Explain the characteristics of oracle dba?
What are transaction isolation levels supported by oracle?
How to rename an existing table?
What is raw datatype?
What is tns entry?
what is the difference between data migration and production migration.