次の3つのコードフラグメントの結果は、関数COUNT()の括弧内にどのパラメーターが含まれていても同じであることがわかります。なぜですか?
SELECT Category.Category, Category.CategoryID, COUNT(Category) AS Popularity
FROM FavCategory INNER JOIN Category
ON FavCategory.CategoryID= Category.CategoryID
GROUP BY Category, Category.CategoryID
HAVING COUNT(FavCategory.MemberID)>=2;
SELECT Category.Category, Category.CategoryID, COUNT(FavCategory.CategoryID) AS Popularity
FROM FavCategory INNER JOIN Category
ON FavCategory.CategoryID= Category.CategoryID
GROUP BY Category, Category.CategoryID
HAVING COUNT(FavCategory.CategoryID)>=4;
SELECT Category.Category, Category.CategoryID, COUNT(FavCategory.MemberID) AS Popularity
FROM FavCategory INNER JOIN Category
ON FavCategory.CategoryID= Category.CategoryID
GROUP BY Category, Category.CategoryID
HAVING COUNT(FavCategory.MemberID)>=2;
SELECT Category.Category, Category.CategoryID, COUNT(FavCategory.MemberID+Category.CategoryID) AS Popularity
FROM FavCategory INNER JOIN Category
ON FavCategory.CategoryID= Category.CategoryID
GROUP BY Category, Category.CategoryID
HAVING COUNT(FavCategory.MemberID)>=2;
これがCategoryテーブルとFavCategoryテーブルのレコードです