|< < 15 > >|

Natural Join

  • Combines two relations.
  • The operation that really makes relational databases unique.
  • And also greatly complicates relational database system internals.

Example — Schema

Artist(artist_id, name, website) Album(album_id, artist_id, title, year, label_id) Track(album_id, track, title, length)

Primary keys

Primary keys are underlined.

  • Artist: artist_id
  • Album: album_id
  • Track: album_id, track

Foreign keys

  • Album(artist_id)Artist(artist_id)
  • Track(album_id)Album(album_id)

Things to notice

  • Table T → column T_id.
  • Matches the primary key column name (in the referenced table).
  • E.g. Track.album_id
  • Surrogate: the foreign key album_id. Natural: track, (the track number on the album).

|< < 15 > >|