Hello,When should I use clustered or not clustered for primary keys?And in a table that performs only Many to Many relationship (please, see ResourcesConstratains) should I have another primary key instead of using the composition of the other two?This is my T-SQL code:create table dbo.Constraints( Id int identity not null, [Type] nvarchar(100) not null, constraint Constraints_PK primary key clustered(Id))create table dbo.Resources( Id int identity not null, Content varbinary(max) filestream constraint Resources_Content_DF default(0x), [Description] nvarchar(800) null, [Key] uniqueidentifier not null rowguidcol constraint Resources_Key_U unique, Locked bit not null constraint Resources_Locked_DF default(0), [Name] nvarchar(100) not null constraint Resources_PK primary key clustered(Id)) create table dbo.ResourcesConstraints( ResourceId int not null, ConstraintId int not null, [Value] nvarchar(100) not null, constraint ResourcesConstraints_PK primary key clustered(ResourceId, ConstraintId))alter table dbo.ResourcesConstraintsadd constraint ResourcesConstraints_Resources_FK foreign key(ResourceId) references dbo.Resources(Id) on delete cascade on update cascade, constraint ResourcesConstraints_Constraints_FK foreign key(ConstraintId) references dbo.Constraints(Id) on delete no action on update cascade;
Thanks,Miguel