- COUNT(*) will include NULLS
- COUNT(column_name) will not include NULLS.
create table myTable (id int,name nvarchar(100))
insert into myTable values(1,null)
insert into myTable values(null,'Hello')
insert into myTable values(null,null)
select COUNT(*) from myTable
Result : 3
select COUNT(name) from myTable
Result : 1
No comments:
Post a Comment