Search code examples
algebrarelationalrelational-algebra

Projection of 2 tables in Relational Algebra


Considering these 2 tables:

Cd (cd_id, title, no_tracks, date, position, weeks)

Band (band_id, band_name)

The task is: List all the band names and cd titles in Relational Algebra.

I wrote it this way: Π band_name (Band) AND Π title (Cd), however I'm not sure if this is correct.

I was also thinking about Union but I'm unsure.


Solution

  • This is indeed done with a union.

    π title(Cd) ∪ π band_name(Band)