Question

I'm following a course in databases (Standford introduction to databases on YT) and, at some point, it's mentioned that t1 INNER JOIN t2 USING attr1, attr2 is equivalent to the NATURAL JOIN symbolized by a bow tie1 in relational algebra.

The INNER JOIN … USING … expression, however, can point out what columns to use for the JOIN, while the bow tie2 operator in relational algebra does not seem to be capable of expressing that.

What is the exact representation of an SQL INNER JOIN … USING … in relational algebra? Can someone give me an example to nudge me in the right direction?


Notes

1, 2 The bowtie with no subscript is condisered the NATURAL JOIN, while the bowtie with the condition as a subscript is considered the THETA JOIN. Here I was refering to the bowtie with no subscript.

Was it helpful?

Solution

Relational natural join is more or less SQL natural join. SQL natural join is defined as SQL inner join using all common columns. (And it is only defined when each argument has exactly one column with each of those names.) If you find what the course actually says about relational vs SQL natural join & inner join with using then it will be that. If the course says that there is an "equivalence" for that expression then it will be because the set of common columns for those tables will be those columns in a particular example.

(To say that relational algebra natural join "is the equivalent of" something in SQL is vague & needs defining. There are many versions of relational algebra that differ in operators available, in how operators with a given name work & even in what a relation is. Meanwhile SQL tables can have NULLs, multiple columns with the same names & multiple rows with the same contents--all typically non-relational.)

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top