更新符号长度小于 3 个字符的 KDB+/Q

Col*_* MG 2 kdb sql-update q

我有一个这样的表:

test:([]column1:`A`B`C`D`E;column2:`Consumer`RealEstate`27`85`Technology)
Run Code Online (Sandbox Code Playgroud)

我需要编写一个更新查询,其中 column2 的字符数为 2 或更少,但我找不到任何方法来引用在 where 子句中使用的符号的字符长度。我将如何编写这样的查询,以便我的结果如下?

test:([]column1:`A`B`C`D`E;column2:`Consumer`RealEstate`NewCategory`NewCategory`Technology)
Run Code Online (Sandbox Code Playgroud)

小智 5

完成您想要的任务的一种方法是将符号转换为字符串(即字符列表)并将 where 子句应用于每个字符串的计数:

update column2:`NewCategory from `test where 3>count each string column2
Run Code Online (Sandbox Code Playgroud)

(假设您要就地应用更改,请在此处的表名称上使用反引号)