📞 0339-0387701 (WhatsApp) Contact

« Back to Database & Data Handling (NCCIA)

A social network has a User table and users can follow other users. How is this modelled?

A. With a foreign key in the User table only
B. With a one-to-one link
C. With a junction table UserFollow with FollowerID and FollowedID, both referencing UserID ✅
D. By merging all users into one row

Correct Answer: C. With a junction table UserFollow with FollowerID and FollowedID, both referencing UserID

Explanation

Following is many-to-many and self-referencing, so a junction table holds each follow pair with two foreign keys to the same User table.