circular reference between two tables with foreign key, how to do it otherwise?

Viewed 44

As I've seen in many SO questions and answer seem to point out that reciprocal reference may be an indication of bad design and how it would open a can of worms down the line.

But, what exactly would the alternative solution to solve a problem like below?

Say for example, if I have a group table and a user table.

I have a FK in either table of this one-to-many relationship. I may...

  1. query on the user table, i can join by FK to check group attributes.
  2. query on group, i can see, say I have a column that indicates last_joined_user_id which could be null or not. From there I could join to get more detail of the last user by FK.

As such, I feel like this design gives me the flexibility to quickly join table between the two.

Is this example I've given safe to use? Or it's still problematic?

0 Answers
Related