Please see the DDL below:
CREATE TABLE dbDeletion
(
reference INT IDENTITY PRIMARY KEY,
reviewreference INT,
PersonID INT,
EventID INT,
[delete] BIT,
Deleted BIT,
Checked BIT
)
INSERT INTO dbdeletion
(reviewreference,
personid,
eventid,
[delete],
deleted,
checked)
VALUES (1,1,4,0,0,0),
(2,2,4,1,0,1),
(3,1,4,1,1,0)
I believe this design is in second normal form, but I wanted to check.
The reason I believe it is in second normal form is because of the 'deleted' and 'checked' attributes ie every time a record is marked for deletion (dbdeletion.delete=1), then the record is checked to see if it can be deleted. If it can be deleted, then it is deleted and dbdeletion.deleted is set to 1, else dbdeletion.checked is set to 1.
When dbdeletion.deleted is set to 1 it is set like this:
update dbdeletion set deleted=1 where PersonID=@PersonID and EventID=@EventID
When dbdeletion.checked is set to 1 it is set like this:
update dbdeletion set checked=1 where PersonID=@PersonID and EventID=@EventID
The two SQL statements above update 1 or many rows. Therefore I believe this is not in third normal form. Is that correct?
Let's go through this incrementally.
reference
. reviewreference
is a candidate key. PersonID
and EventID
are not candidate keys because they do not uniquely identify records. Since the candidate keys are atomic, there is no way for another attribute to be dependent on a portion of a candidate key. 2NF Passed reference
and reviewreference
is a candidate key. The remaining information all refer to these candidate keys and do not depend on any information aside from these candidate keys. 3NF Passed
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.