Arrays in database tables and normalization
Posted
by Ivan Petrov
on Stack Overflow
See other posts from Stack Overflow
or by Ivan Petrov
Published on 2010-05-24T14:16:11Z
Indexed on
2010/05/24
14:41 UTC
Read the original article
Hit count: 289
Hi!
Is it smart to keep arrays in table columns? More precisely I am thinking of the following schema which to my understanding violates normalization:
create table Permissions(
GroupID int not null default(-1),
CategoryID int not null default(-1),
Permissions varchar(max) not null default(''),
constraint PK_GroupCategory primary key clustered(GroupID,CategoryID)
);
and this:
create table Permissions(
GroupID int not null default(-1),
CategoryID int not null default(-1),
PermissionID int not null default(-1),
constraint PK_GroupCategory primary key clustered(GroupID,CategoryID)
);
UPD: Forgot to mention, in the scope of this concrete question we will consider that the "fetch rows that have permission X" won't be performed, instead all the lookups will be made by GroupID and CategoryID only
Thoughts?
Thanks in advance!
© Stack Overflow or respective owner