开发者

Data Base design turnkey records

开发者 https://www.devze.com 2023-01-09 09:40 出处:网络
I have some questions regarding data base design for simple CMS. Every Page in Table \"PAGES\" could be \"AssignedTo\" and \"LockedBy\" by a specific Us开发者_C百科er.

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

Every Page in Table "PAGES" could be "AssignedTo" and "LockedBy" by a specific Us开发者_C百科er. 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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消