When is it okay to not to use PRIMARY KEY?

Viewed 486

Suppose I want to create a simple database which lets user create playlists and add multiple songs into it. I just want to be able to find which songs are added in a particular playlist.

song table :

`song_id` INT AUTO_INCREMENT PRIMARY KEY, `song_title` VARCHAR

playlist table :

`playlist_id` INT AUTO_INCREMENT PRIMARY KEY, `playlist_title` VARCHAR

What would be the best option to pull this off?

  1. Add another column to the playlist table and insert comma separated ids of songs into that column. Which I don't think would be a proper relational way to do it but does the job.

or

  1. Create separate table just to store song ids with the playlist id to which it belongs. Like playlist_id INT, song_id INT where both columns are foreign keys.

Now, if the second option is better, should I add another column as a primary key and auto_increment knowing that it won't be useful anywhere? Because I read some articles online and many of them suggests that not having a primary key of a table significantly affects its performance in a negative way.

6 Answers
Related