Hacker News new | past | comments | ask | show | jobs | submit login

Yep, so a table for each thing with their own schemas. A user table, a company table, etc. Then a single relationship that defines all the relationships between all the objects in a giant many-to-many relationship.

So to query a full relationship, you'd do a join from A -> relationship -> B, probably an inner join. But most of the time, it was usually just a singular join (to get a list of things to show the user, for example) since you'd already be querying in the context of some part of the relationship.




Ah, that makes sense. So something like:

    select whatever from thingy, relation, widget
    where thingy.id = relation.id1
    and widget.id = relation.id2
    and relation.type1 = 'thingy'
    and relation.type2 = 'widget'




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: