123 123 - 13 days ago 5
SQL Question

Is this SQL query equivalent to this relational algebra statement?

I have the following SQL query:


SELECT foo.a, bar.b, baz.c FROM foo
INNER JOIN bar ON bar.id = foo.bar_id
INNER JOIN baz ON baz.id = foo.baz_id
WHERE foo.z = 50;


I want to know if this is equivalent to this relational algebra statement.

π foo.a, bar.b, baz.c (foo) ⋈ bar.id = foo.bar_id (bar) ⋈ baz.id = foo.baz_id (baz) σ foo.z = 50

Answer

Yes, it's (your SQL Query) a representation for your relational statement.