A relationship describes how rows in one table connect to rows in another table. Instead of duplicating data everywhere, we split information into separate tables and then link them together using special columns called foreign keys.
Why not just put everything in one table?
Imagine storing every song along with the full artist name, artist country, and artist bio repeated for every single song. If the artist changes their name, you'd need to update thousands of rows. Relationships solve this by storing the artist once and referencing them by ID.
BAD (flat table β data duplication): βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β song_id β song_title β artist_name β artist_country β bio β β 1 β Blinding Lightsβ The Weeknd β Canada β ... β β 2 β Starboy β The Weeknd β Canada β ... β β 3 β Shape of You β Ed Sheeran β UK β ... β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
GOOD (normalized β linked tables): artists table: songs table: ββββββ¬βββββββββββββ ββββββ¬ββββββββββββββββββ¬ββββββββββββ β id β name β β id β title β artist_id β β 1 β The Weeknd β β 1 β Blinding Lights β 1 β β 2 β Ed Sheeran β β 2 β Starboy β 1 β ββββββ΄βββββββββββββ β 3 β Shape of You β 2 β ββββββ΄ββββββββββββββββββ΄ββββββββββββ