gpt4 book ai didi

sql-server - `primary key`关键字与SQL Server中的聚集索引有何关系?

转载 作者:行者123 更新时间:2023-12-02 11:26:00 25 4
gpt4 key购买 nike

PRIMARY KEY关键字与SQL Server中的聚集索引有何关系?

(有些人似乎想回答这个问题,而不是a different question I asked,所以我为他们提供了一个更好的答案。)

最佳答案

表的聚集索引通常在主键列上定义。

但是,这不是严格的要求。

MSDN:

When you create a PRIMARY KEY constraint, a unique clustered index on the column or columns is automatically created if a clustered index on the table does not already exist and you do not specify a unique nonclustered index.



和:

You can create a clustered index on a column other than primary key column if a nonclustered primary key constraint was specified.

关于sql-server - `primary key`关键字与SQL Server中的聚集索引有何关系?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3662163/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com