Relational DB :Relation-type Algebra?

Click For Summary

Discussion Overview

The discussion revolves around the concept of operational algebra in relational databases, specifically focusing on the relationships between entities A, B, and C. Participants explore the idea of composability of relations and seek to understand how certain relationships can be derived from existing ones, as well as the mathematical analogies that may apply.

Discussion Character

  • Exploratory
  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant questions whether there exists an operational algebra that can determine relationships between entities based on their existing relations, specifically regarding many-to-many and one-to-many relationships.
  • Another participant provides a set-theoretic definition of SQL joins, suggesting a foundation for understanding relational operations, but notes that it does not yet constitute an algebraic construct.
  • A third participant identifies the topic as relational algebra, mentioning standard operations like projection, selection, and join, but does not elaborate on their relevance to the original question.
  • One participant expresses skepticism about the utility of framing the discussion in terms of set operations, comparing it to understanding computer programs through logical operators.
  • A later reply acknowledges the complexity of addressing questions at a fundamental level due to time constraints, while also asserting that relations are closed under composition.

Areas of Agreement / Disagreement

Participants exhibit a mix of agreement and disagreement. While some acknowledge the foundational aspects of relational algebra, others challenge the sufficiency of set operations in clarifying the original inquiry about composability and relationships.

Contextual Notes

Participants express varying levels of understanding and interest in foundational concepts, with some indicating a preference for practical answers over in-depth theoretical exploration. The discussion remains open-ended regarding the formal conditions under which relations are composable.

Who May Find This Useful

Readers interested in relational databases, operational algebra, and the theoretical underpinnings of data relationships may find this discussion relevant.

WWGD
Science Advisor
Homework Helper
Messages
7,801
Reaction score
13,105
Hi, say we have entities A,B,C in a Relational Database. Is there a sort-of operational algebra that allows us to determine that if, say, A and B are in a many-many relation and B and C are in a 1-many relation, then A,C are in a certain relationship, i.e., a composition algebra between relations (whenever "composable", of course)? And, while we are at it, when are relations "composable" (in a formal way, ignoring semantic issues of whether the composition is meaningful) , meaning if A is related to B and B to C, can we say A is related to C? Any Mathematical Analogies more than welcome.
Thanks.
 
Technology news on Phys.org
If it's any help, the set-theoretic definition of an SQL join of two tables is the subset of all elements of the Cartesian product of those two tables that satisfies the specified join condition.

If we consider each table ##T## to be a function ##f_T:\mathbb{N}\times col.names(T)\to U## where ##U## is the set of all possible values in all allowed data types, such that ##f(n,\alpha)## is the value in row ##n##, column ##\alpha## of table ##T## then we can write an inner join on column ##\alpha## of tables ##A## and ##B## as

$$InnerJoin(A,B,\alpha)=\{(a_i,b_j)\in A\times B\ |\ f_A(i,\alpha)=f_B(j,\alpha)\}$$

This is readily extendable to outer joins and other types of joins, and to joins of more than two tables.

It's not an algebraic construct yet, as no group or similar operation has been defined, but at least it gives a set-theoretic foundation on which one might be able to do so
 
  • Like
Likes   Reactions: WWGD
You're talking about relational algebra i.e. basically operations on sets. So, in relational databases operations are operations on some kind of sets and we have the usual operations of projection, selection, join etc. If you don't know much about these, a good start is Wikipedia's page about Relational Algebra
 
I think I understand them pretty well, but I don't see how referring every question to set operations clarifies things in here. Seems like understanding computer programs in terms of logical operators and switches.
 
Last edited:
@QuantumQuest : Of course you are correct, it is just too time-consuming to try to answer things at the most fundamental level, however interesting and illuminating it often is to do so. Time limitations make this approach impractical , despite allowing for a solution.

And, I guess that at the end of the day, relations are closed under composition. I make an effort not to be a hack, but sometimes I just hope to get an answer that works even without fully understanding it. It is just too time- and energy- consuming to follow this approach all the time.

Thanks for your comments, though.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 22 ·
Replies
22
Views
3K
  • · Replies 8 ·
Replies
8
Views
1K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 26 ·
Replies
26
Views
6K