一个查询语句,有个地方看不懂
ALTER   Procedure   CMRC_ShoppingCartAddItem 
 ( 
             @CartID   nvarchar(50), 
             @ProductID   int, 
             @Quantity   int 
 ) 
 As   
 DECLARE   @CountItems   int   
 SELECT 
             @CountItems   =   Count(ProductID)      /*这句是什么意思,看不懂   另外Count()是什么函数*/ 
 FROM 
             CMRC_ShoppingCart 
 WHERE 
             ProductID   =   @ProductID 
       AND 
             CartID   =   @CartID   
 IF   @CountItems   >    0      /*   There   are   items   -   update   the   current   quantity   */   
             UPDATE 
                         CMRC_ShoppingCart 
             SET 
                         Quantity   =   (@Quantity   +   CMRC_ShoppingCart.Quantity) 
             WHERE 
                         ProductID   =   @ProductID 
                   AND 
                         CartID   =   @CartID   
 ELSE      /*   New   entry   for   this   Cart.      Add   a   new   record   */   
             INSERT   INTO   CMRC_ShoppingCart 
             ( 
                         CartID, 
                         Quantity, 
                         ProductID 
             ) 
             VALUES 
             ( 
                         @CartID, 
                         @Quantity, 
                         @ProductID 
             )
------解决方案--------------------COUNT 
 返回组中项目的数量。    
 语法 
 COUNT ( { [ ALL | DISTINCT ] expression ] | * } )    
 参数 
 ALL   
 对所有的值进行聚合函数运算。ALL 是默认设置。   
 DISTINCT   
 指定 COUNT 返回唯一非空值的数量。   
 expression   
 一个表达式,其类型是除 uniqueidentifier、text、image 或 ntext 之外的任何类型。不允许使用聚合函数和子查询。   
 *   
 指定应该计算所有行以返回表中行的总数。COUNT(*) 不需要任何参数,而且不能与 DISTINCT 一起使用。COUNT(*) 不需要 expression 参数,因为根据定义,该函数不使用有关任何特定列的信息。COUNT(*) 返回指定表中行的数量而不消除副本。它对每行分别进行计数,包括含有空值的行。     
 重要  当使用 CUBE 或 ROLLUP 时,不支持区分聚合,例如 AVG(DISTINCT column_name)、COUNT(DISTINCT column_name)、MAX(DISTINCT column_name)、MIN(DISTINCT column_name) 和 SUM(DISTINCT column_name)。如果使用了,Microsoft® SQL Server™ 将返回错误信息并取消查询。     
 返回类型 
 int   
 注释 
 COUNT(*) 返回组中项目的数量,这些项目包括 NULL 值和副本。   
 COUNT(ALL expression) 对组中的每一行都计算 expression 并返回非空值的数量。   
 COUNT(DISTINCT expression) 对组中的每一行都计算 expression 并返回唯一非空值的数量。