Ragu
Ragu

Reputation: 373

How to design this database to avoid Circular Reference between 3 tables

I have 3 tables.

When I design ER it has Circular Reference(cyclic dependency)..

 1:N

People --------< Post

 1:N

Post ----------< Likes

 1:M

People --------< Likes

Logic is

How can i remove this kind of cyclic design?? or my db design is wrong??

any suggestion.. thanks advance

Upvotes: 1

Views: 401

Answers (1)

bcampolo
bcampolo

Reputation: 593

I'm not sure which part is cyclical in your example, but the design I first thought of was this:

People
Column1: Person ID
Column2: Name

Post
Column1: Post ID
Column2: Person ID who posted

Likes
Column1: Like ID
Column2: Post ID that was liked
Column3: Person ID that liked the Post

Upvotes: 3

Related Questions