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



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 '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

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

Answer / ravi gali

select c from tablename
where c IS NOT NULL;

Is This Answer Correct ?    2 Yes 4 No

Post New Answer

More Oracle General Interview Questions

 What are the oracle DML commands possible through an update strategy?

0 Answers   Informatica,


What is the data type of dual table?

0 Answers  


What are the restrictions on external table columns?

0 Answers  


I want a table like, no name address addr1 addr2 So i want columns like addr1,addr2 under address column. Can one please answer me. Advance Thanks.

2 Answers   IBM,


what is exact difference between drop and truncate table.

3 Answers  


Explain the difference between a procedure and a function?

0 Answers  


how to retrieve daily sal from emp table in oracle 10g

2 Answers   Infosys,


How to convert csv to table in oracle?

0 Answers  


Does oracle charge for java?

0 Answers  


How to define a cusotmer as a supplier in ORACLE R12

0 Answers   Intelligroup,


how do u setup a replication site?

0 Answers  


What are the extensions used by oracle reports?

0 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1808)
  • 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)