Consider I have a table with notes which could be associated with zero or more tags, how would I decide to do
create table notes (
id int , -- primary key
-- other fields
);
create table tagmapping (
noteid int, -- refers notes.id
tagid int, -- refers tags.id
);
create table tags (
int id, -- primary key
tagname varchar(255)
);
vs storing the same tag potentially several times as in
create table notes (
int id, -- primary key
-- other fields
);
create table bar (
id id, -- primary key
tag varchar(255),
-- other fields
noteid int -- refers to notes.id, (not unique)
);
What mess/advantages would I get myself into going for the last approach ?