考虑这些简化的表:
CREATE TABLE dbo.words
(
id bigint NOT NULL IDENTITY (1, 1),
word varchar(32) NOT NULL,
hits int NULL
)
CREATE TABLE dbo.items
(
id bigint NOT NULL IDENTITY (1, 1),
body varchar(256) NOT NULL,
)
Run Code Online (Sandbox Code Playgroud)
该words
表包含大约 9000 条记录,每个记录包含一个单词('phone'、'sofa'、'house'、'dog'...) 该items
表包含大约 12000 条记录,每条记录的正文不超过 256人物。
现在,我需要更新words
表,计算表中有多少记录items
保存(至少一次)单词字段中的文本。我需要考虑部分单词,因此所有这 4 条记录都应计入单词dog:
CREATE TABLE dbo.words
(
id bigint NOT NULL IDENTITY (1, 1),
word varchar(32) NOT NULL,
hits int NULL
)
CREATE TABLE dbo.items …
Run Code Online (Sandbox Code Playgroud)