Posted by & filed under ORACLE, SQLSERVER.

select count(*) FROM [AdventureWorks].[Person].[Contact]
返回表中所有的记录的个数

select COUNT(MiddleName) from [AdventureWorks].[Person].[Contact]
返回字段中,值非空的记录的个数(重复的也算进去的) 

select COUNT(distinct MiddleName) from [AdventureWorks].[Person].[Contact]
返回字段中不重复且非空的记录的个数

Result:
19972
11473
70

Comments are closed.