ヌルの扱い

 

ヌルと空文字は同じ

ヌルと空文字は異なる

create table tab15(col1 int,col2 varchar(10));
insert into tab15 values(1,'');
insert into tab15 values(2,NULL);

select * from tab15;

select * from tab15 where col2 = '';
select * from tab15 where col2 is null;

ヌルと空文字は異なる

create table tab15(col1 int,col2 varchar(10));
insert into tab15 values(1,'');
insert into tab15 values(2,NULL);

select * from tab15;

select * from tab15 where col2 = '';
select * from tab15 where col2 is null;

 

ヌルと空文字は異なる

create table tab15(col1 int,col2 varchar(10));
insert into tab15 values(1,'');
insert into tab15 values(2,NULL);

select * from tab15;

select * from tab15 where col2 = '';
select * from tab15 where col2 is null;