tags:

views:

27

answers:

1

Hi, I have some questions regarding data base design for simple CMS.

Every Page in Table "PAGES" could be "AssignedTo" and "LockedBy" by a specific User. To manage Users I am using SQL specific table "aspnet_Users", every User is identified using a GUI uniqueIdentifier column.

If a page is "Unlock" and can be edited by Users, its value in Table "Pages" would be NULL, same mechanism for "AssignedTo".

Here my script when I create Table "PAGES":

LockedBy uniqueidentifier NULL FOREIGN KEY REFERENCES aspnet_users(UserId),
AssignedTo uniqueidentifier NULL FOREIGN KEY REFERENCES aspnet_users(UserId)

My question: This design will generate many NULL values in "LockedBy" since Pages will be locked only in the moment of editing, because I heard have many NULL values is not a good thing in Data Base design,, I would like to know if my design is in good practice, or if you could suggest a better way. Thanks guys

+1  A: 

Normally I think it's a good idea to have this in one table, ignoring the fact that there's many NULL values, but here's another solution:

You could split this into two other tables: PageLocks and PageAssignedTo

PageLocks: PageID, UserID <- unique key

PageAssignedTo: PageID, UserID <- unique key

Vidar Nordnes
thanks for your message, do you think your solution with Two Table could be resulting better in performace? thanks
GIbboK
It depends. In SQL Server 2008 you've got filtered indexes, so adding one index (on each field) in your Pages-table would be the same as splitting it out in another table
Vidar Nordnes
Yes is USE SLQ 2008 thanks for your time!
GIbboK
my pleasure :-)
Vidar Nordnes