• JackbyDev
    link
    fedilink
    English
    arrow-up
    1
    ·
    5 months ago

    To that point a person table with a relationship table. […] I don’t think you’d really be able to keep it within one table while exploring multiple relationships unless you’re storing a list of ids that is interpreted outside of sql.

    Yeah, that’s how many to many relationships work. Especially if you care at all about normalization which I assume we do since we’re debating the best way to model a SQL joke on a tee shirt lol. I thought this might be common knowledge but I’ve included a few links in case you’re curious. Many-to-many relationships

    Also, a table having a many-to-many relationship with itself isn’t terribly special. It’s just not necessarily the most common thing ever. We can even express love triangles (as in unrequited love) using this approach. Proper couples could have two entries but unrequited ones would only have one entry on the junction table.

    Also a relationship table would allow exploring other types of relationships such as exes, love interests, coworkers, family, friends, etc

    Yes! Absolutely! You could have a column that describes the type of the relationship. Having extra information on junction tables.