super user
super user

Reputation: 59

null values in sql

i have data like this

ID Nu     name 
1  234    asd
2  566    asd
3  -      sdf
4  356    sd
5  NULL   sfsg

now how to get all data with - and null values

Upvotes: 0

Views: 45

Answers (3)

Mansoor
Mansoor

Reputation: 4192

To get all the info from the table you can use the following query:

select * from table_name; 

To filter by null and dash values, try the where clause:

select * from table_name where nu is null;
UNION ALL
select * from table_name where nu = '-';

Upvotes: 0

Danyal Sandeelo
Danyal Sandeelo

Reputation: 12401

select * from table_name where Nu is null or Nu='-'

Upvotes: 0

Ratan Phayade
Ratan Phayade

Reputation: 86

select * from table_name; 

this will give you all the data with - and null value

if you want to fetch only the data where nu is null and - use this:

select * 
from table_name 
where nu is null or nu = '-';

I think this should help.

Upvotes: 2

Related Questions