我有这张桌子:
CREATE TABLE [dbo].[Phrase] (
[PhraseId] UNIQUEIDENTIFIER DEFAULT (newid()) NOT NULL,
[English] NVARCHAR (250) NOT NULL,
[EnglishAscii] AS (ascii([English])) PERSISTED,
[EnglishHash] AS (CONVERT([bigint],hashbytes('md5',[English])%(5)+(5))) PERSISTED,
PRIMARY KEY CLUSTERED ([PhraseId] ASC)
);
我想要检查EnglishHash列的分布。
有没有办法可以做一个选择,它会告诉我为EnglishHash的每个值分配了多少行?
答案 0 :(得分:2)
SELECT EnglishHash, COUNT(*) as [Count] FROM Phrase GROUP BY EnglishHash