wirte a query to remove null? following table are

col1 col2 col3
dinesh null null
null suresh null
null null prakesh
i want the output like

col1 col2 col3
dinesh suresh prkaesh

Answers were Sorted based on User's Feedback



wirte a query to remove null? following table are col1 col2 col3 dinesh null null null ..

Answer / kart

select max(col1) col1,max(col2) col2,max(col3) col3
from table;


col1 col2 col3
dinesh suresh prkaesh

Is This Answer Correct ?    11 Yes 4 No

wirte a query to remove null? following table are col1 col2 col3 dinesh null null null ..

Answer / sivanagaraju

SELECT DISTINCT((SELECT COL1 FROM COLL WHERE COL1<>'NULL')),(SELECT COL2 FROM COLL WHERE COL2<>'NULL'),(SELECT COL3 FROM COLL WHERE COL3<>'NULL')
FROM COLL

Is This Answer Correct ?    4 Yes 1 No

wirte a query to remove null? following table are col1 col2 col3 dinesh null null null ..

Answer / sivanagaraju

SELECT C1.COL1,C2.COL2,C3.COL3
FROM COLL C1,(SELECT COL2 FROM COLL WHERE COL2 <>'NULL') C2,
(SELECT COL3 FROM COLL WHERE COL3<>'NULL') C3
WHERE C1.COL1<>'NULL';

Is This Answer Correct ?    2 Yes 1 No

wirte a query to remove null? following table are col1 col2 col3 dinesh null null null ..

Answer / ajitnayak

select distinct col1 from samp
where col1 is not null
union all
select distinct col2 from samp
where col2 is not null

Is This Answer Correct ?    0 Yes 0 No

wirte a query to remove null? following table are col1 col2 col3 dinesh null null null ..

Answer / sivanagaraju

SELECT C1.COL1,C2.COL2,C3.COL3
FROM (SELECT COL1 FROM COLL WHERE COL1 <>'NULL') C1,
(SELECT COL2 FROM COLL WHERE COL2 <>'NULL') C2,
(SELECT COL3 FROM COLL WHERE COL3<>'NULL') C3
WHERE C1.COL1 <>'NULL' AND C2.COL2<>'NULL';

Is This Answer Correct ?    1 Yes 2 No

wirte a query to remove null? following table are col1 col2 col3 dinesh null null null ..

Answer / apsar

select distinct((select col1 from z1 where no is not null))col1,(select col2 from z1 where sal is not null)col2,select col3 from z1 where col is not null) from z1
Hint:z1 is Table Name

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More SQL PLSQL Interview Questions

Which nosql database is best?

0 Answers  


What is Raise_application_error ?

1 Answers  


Does truncate need commit?

0 Answers  


What are expressions?

0 Answers  


Can a table have no primary key?

0 Answers  






Is sql free?

0 Answers  


write the Sql query for creating database backup?

7 Answers   TCS,


what is self join and why is it required? : Sql dba

1 Answers  


How can I change database name in sql?

0 Answers  


Which join is like an inner join?

0 Answers  


What is the execution plan in sql?

0 Answers  


Hi Guys, I have a situation where I need to access the column values from rowtype variable. However, the column names are dynamic. below is sample code: declare Cursor c1 is select * from emp; Cursor c2 is select column_name from xyztable; v_c2 c2%rowtype; v_str varchar2 v_value varchar2(200); begin for rec in c1 loop open c2;---this cursor has column names like EMPLOYEE_ID, FIRST_NAME, LAST_NAME etc. loop fetch c2 into v_c2; exit when c2%notfound; /* now lets say i want to access value of LAST_NAME from cursor c1, so I am writing below code, however it does not work as expected */ v_str:= 'rec.'|| v_c2.column_name; -- this will give me string like "rec.EMPLOYEE_ID" v_value:=v_str; end loop; end loop; end; / Plz help ASAP.Thanks.

2 Answers  


Categories