Syntax
Table.AddKey(
table as table,
columns as list,
isPrimary as logical
) as table
About
将键 table添加到其中,其中 columns 列出了定义键的列名,并 isPrimary 指定键是否为主键。
示例 1
向表添加单列主键。
用法
let
table = Table.FromRecords({
[Id = 1, Name = "Hello There"],
[Id = 2, Name = "Good Bye"]
}),
resultTable = Table.AddKey(table, {"Id"}, true)
in
resultTable
输出
Table.FromRecords({
[Id = 1, Name = "Hello There"],
[Id = 2, Name = "Good Bye"]
})