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



The table has 3 columns 4 rows. The output is which column has least null values( A COL SHOULD BE TH..

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

Post New Answer

More Oracle General Interview Questions

Can we create database in oracle using command line ?

0 Answers   MCN Solutions,


Difference between join and a subquery?

8 Answers   Base Automation, NMDC,


How to assign a table row to a record variable?

0 Answers  


find out first highest salary?

10 Answers   Verinon Technology Solutions,


What is oracle join syntax?

0 Answers  






How can we force the database to use the user specified rollback segment?

0 Answers  


How to delete multiple rows from a table in oracle?

0 Answers  


What is bind variable in oracle 11g?

0 Answers  


What are the factors that affect OPTIMIZER in choosing an Optimization approach ?

2 Answers  


What does `(+)` do in a where clause?

1 Answers  


What is a oracle database?

0 Answers  


What is a deadlock ? Explain .

1 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1789)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)