AskYous
AskYous

Reputation: 4760

Database structuring for 'likes' or 'endorsements'

I am trying to develop an application in which users can have their own profiles, and profiles can show the users skills, and the skills can have endorsements by other users (or "likes", much like LinkedIn!).

I have a profiles table, and a skill table. These 2 tables have a many-to-many relationship (a profile can have many skills, and a skill can be linked to many profiles). I'm trying to keep the skill names unique when a new skill is stored in the db. I'm trying to have endorsements (or likes) for each skill that the user adds to his profile. Is there a standard or optimized way to solve this?

Upvotes: 1

Views: 311

Answers (1)

Joel Brown
Joel Brown

Reputation: 14418

Add an additional foreign key from the endorsement to the profile of the person doing the endorsement. This tells you who likes who and what they like about them.

See this ERD:

ERD

Upvotes: 2

Related Questions