this post was submitted on 01 Jul 2024
328 points (92.1% liked)

LinkedinLunatics

3580 readers
62 users here now

A place to post ridiculous posts from linkedIn.com

(Full transparency.. a mod for this sub happens to work there.. but that doesn't influence his moderation or laughter at a lot of posts.)

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] JackbyDev 1 points 4 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.