Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how to eliminate null values in a column i.e
table vlaues
1 2 3
NULL 3 4
1 5 NULL
i want output like this
1 2 3
3 4
1 5
i dnt want to use nvl is null and i dnt want replace the
NULL value with any value i.e nvl(col,o);

Answers were Sorted based on User's Feedback



how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / chandra shekhar

Dear Lavanya,
You cannot equate the NULL with the operators like = and !=

NULLs can be equated with "IS NULL" or "IS NOT NULL"
(Double quotes " not included)

In u r query if u say IS NOT NULL, then also as per question asked in the very beginning it will not suffice.

As there are multiple columns with multiple NULLs in all the given columns .

Regards
J

Is This Answer Correct ?    3 Yes 1 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / dipti

The only option I feel is

SELECT * FROM TABLE
WHERE COL_NAME IS NOT NULL

will return the non null values which I think is asked for
this question.

Is This Answer Correct ?    2 Yes 0 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / hiya

SELECT REPLACE(A,'NULL',' '),
REPLACE(B,'NULL',' '),
REPLACE(C,'NULL',' ')FROM TEST1

Is This Answer Correct ?    0 Yes 0 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / srinu

Hi Ramkrish,

select *from k;

SNO
-----
1
2
3


3
4



9 rows selected

select sno from k where sno is not null;

SNO
-----
1
2
3
3
4

Is This Answer Correct ?    0 Yes 0 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / pankaj

suppose u have table named as emp

emp_id dept_id last_name salary

1 10 N1 10000

2 20 N2 10000

3 N3 12000

4 N4 12000

5 30 N5 15000


NOW IF U WANT TO RETRIEVE THE ROWS WITH ELIMINATING NULL
VALUES.

EX-

SELECT EMP_ID,DEPT_ID,LAST_NAME,SALARY
FROM EMP
WHERE DEPT_ID IS NOT NULL;

SO IN THE OUTPUT NULL VALUES WILL NOT BE RETRIVED MEANS
RECORD FOR EMP_ID 3 AND 4 WILL NOT BE RETRIVED.

REGARDS R

Is This Answer Correct ?    0 Yes 0 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / venkat reddy

1 select e.*,
2 case
3 when
4 comm is null then '0'
5 when
6 comm is not null then
7 to_char(comm) end as comm
8* from emp e
SQL> /

EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO COMM
---------- ---------- --------- ---------- --------- ---------- ---------- ---------- ------
7839 KING PRESIDENT 17-NOV-81 5000 10 0
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 0
7782 CLARK MANAGER 7839 09-JUN-81 2450 10 0
7566 JONES MANAGER 7839 02-APR-81 2975 20 0
7788 SCOTT ANALYST 7566 19-APR-87 3000 20 0
7902 FORD ANALYST 7566 03-DEC-81 3000 20 0
7369 SMITH CLERK 7902 17-DEC-80 800 20 0
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 300
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 500
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 1400
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 0
7876 ADAMS CLERK 7788 23-MAY-87 1100 20 0
7900 JAMES CLERK 7698 03-DEC-81 950 30 0
7934 MILLER CLERK 7782 23-JAN-82 1300 10 0

14 rows selected.

Is This Answer Correct ?    0 Yes 0 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / vijay_1994

please use group function is ignore the null values

Is This Answer Correct ?    0 Yes 0 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / shekharjchandra

Generally when u give query like
Select * from tablename; you will not get NULL displayed in Oracle SQL* Plus. I am not sure what tool you are using.

In SQL server you will get the output displayed NULL for null values.

If you still getting NULL as display value for null values then probably u have to do small change.

at SQL prompt use SQL* Plus command

SQL> SET NULL ""


now u give u r query, u will not get NULL displayed for null values

Regards
J

Is This Answer Correct ?    0 Yes 1 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / jayendra

Hi
You Can Replace the null without using nvl
function.
using replace key world
like this
Select Replace(values,'null')
from demo where values!=NULL;
it will display the result like this
1 2 3
3 4
1 5

Thanks
J.N.Tripathi
9868703898

Is This Answer Correct ?    0 Yes 1 No

how to eliminate null values in a column i.e table vlaues 1 2 3 NULL 3 4 1 5 NULL ..

Answer / j.n.tripathi

Hi
Sorry To ALL.....
For Above Answer
Writing Mistake there.....

You Can Replace the null without using nvl
function.
using replace key world
like this
Select Replace(values,'null')
from demo
it will display the result like this
1 2 3
3 4
1 5

Thanks
J.N.Tripathi
9868703898

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More SQL PLSQL Interview Questions

How do I use google cloud in sql?

0 Answers  


Explain character-manipulation functions?

0 Answers  


how to check the 3rd max salary from an employee table? One of the queries used is as follows: select sal from emp a where 3=(select count(distinct(sal)) from emp b where a.sal<=b.sal). Here in the sub query "select count(distinct(sal)) from emp b where a.sal<=b.sal" or "select count(distinct(sal)) from emp b where a.sal=b.sal" should reveal the same number of rows is in't it? Can any one here please explain me how is this query working perfectly. However, there is another query to get the 3rd highest of salaries of employees that logic I can understand. Pls find the query below. "select min(salary) from emp where salary in(select distinct top 3 salary from emp order by salary desc)" Please explain me how "select sal from emp a where 3=(select count(distinct(sal)) from emp b where a.sal<=b.sal)" works source:http://www.allinterview.com/showanswers/33264.html. Thanks in advance Regards, Karthik.

4 Answers  


What is delimiter in pl sql?

0 Answers  


List the differences between plsql - function & procedures

2 Answers   TCS, Verizon,


What is difference between procedure and trigger?

0 Answers  


How would you hide a table in sql. ie the table can be only visible to its maker?

3 Answers  


How does index help in query performance?

0 Answers  


Can you upgrade sql express to full sql?

0 Answers  


what is the difference between cluster and non cluster index? : Sql dba

0 Answers  


What is trigger and types?

0 Answers  


What is a join query?

0 Answers  


Categories