MySql, 2 columns in same table referencing same data -
my table formatted follows each row represents paper:
id title year cite1 1 title1 year1 3 2 title2 year2 1 3 title3 year3 n ... n titlen yearn 2 i have selected id primary key. cite1 contains id of paper specific paper cites. values in cite1 ids. in future want make connections between paper , paper cites.
my question is, correct have id primary key or should cite1 column contains ids of papers?
i new mysql appreciate feedback!
the idea looking "foreign key". id is, indeed, primary key on table. cite1 foreign key refers same table:
alter table papers add constraint fk_papers_cite1 foreign key (cite1) references papers(id); i worry bit have column called cite1 instead of cite. if papers can cite multiple other papers, proper way represent table, papercitations, has 1 row per paper , per paper being cited. having multiple columns called things cite1, cite2 , on not way go. storing delimited list string wrong.
Comments
Post a Comment