📞 0339-0387701 (WhatsApp) Contact

« Back to Database & Data Handling (NCCIA)

A Tag-Post many-to-many system uses PostTag as a junction table. Adding the same tag to the same post twice should be prevented by what?

A. A check constraint on the post date
B. A NOT NULL constraint on the tag name
C. A unique index on the post title alone
D. The composite primary key on PostID and TagID in PostTag ✅

Correct Answer: D. The composite primary key on PostID and TagID in PostTag

Explanation

The composite key allows each PostID-TagID pair only once, so a duplicate link is rejected.