3

The current description for is:

A relation on sets S1, S2, ..., SN is any subset of S1 x S2 x ... x SN, where 'x' denotes the Cartesian product. In other words, a relation over N sets is any set of ordered N-tuples over the N sets.

I'm assuming that this is supposed to be for things related to set theory, but the actual uses of the tag seem to be more in line with MVC-like model relations - which is what the tag is for:

Relationships refer to mappings between elements of one set to another set, such as one-to-one, one-to-many, many-to-many.

As a side note, we also have a tag, which seems to be more or less the same thing:

Questions in this tag typically involve the association that a set of data has with other set(s) of data.

tl;dr

1 Answer 1

1

I'm assuming that this is supposed to be for things related to set theory, but the actual uses of the tag seem to be more in line with MVC-like model relations - which is what the relationships tag is for [...]

Nope, that's not quite right.

In both set theory and database theory, a "relation" is a "bag" or set of n-tuples for some fixed number n (e.g. a binary relation has n = 2). You might also visualize it as a table with no repeated rows, or as a subset of the Cartesian product. These definitions are all describing the same thing, just with different words. SQL calls these things "tables."

A relationship, on on the other hand, is a database theory term for a specific kind of binary relation (i.e. a relation whose rows are all 2-tuples) that indicates connections between the rows of other relations, rather than storing "data in its own right." Pure set theory doesn't have as much need for doing this sort of thing (because they like to build stuff out of sets rather than out of tuples as is common in computer science), so "relationship" is solely a database term. In practice, these are usually implemented either as foreign key constraints (one-to-one, one-to-many) or as join tables (many-to-many).

So.

We should make sure that has questions about relations (tables) in any database system, MVC or otherwise, and that has questions about relationships (foreign keys and join tables).

3
  • 4
    Doing this is a problem waiting to happen. Relation/ship is a very common word in several context not related to programming, and it would be more work trying to enforce a certain meaning in the long run.
    – Braiam
    Commented Feb 28, 2018 at 12:22
  • The use of "relationship" to mean FK (foreign key) is not done either in the relational model or the ER model. It is (misconceivedly but ubiquitously) used to mean FK (foreign key) constraint by methods, tools & presentations that misunderstand the relational & ER models. Math & the relational model use "relation", "relationship" & "association" for a rule relating entities or values & "relation" also for sets or tables enumerating tuples satisfying one. So does the ER model except "relationship" means an association on given values or a tuple representing one. Tables hold bags only in SQL.
    – philipxy
    Commented May 3, 2021 at 6:46
  • 1
    A FK constraint does not "implement" what a table does. You are trying to unify different but related things just because people use the same word to (typically confusedly) refer to them. A FK constraint asserts a fact/statement true of every DB state & business situation that subrow values for some columns must appear uniquely elsewhere & that participation in a certain association implies participation once in a certain other association. An ERM meta-relation recording the meta-association that certain tables & columns are FK-constrained holds tuples the ERM would call meta-relationships.
    – philipxy
    Commented May 3, 2021 at 7:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .