Store two names in the same column

Asked

Viewed 23 times

0

I’m in doubt about best practice to create a certain table.

I have the table "Texts":

inserir a descrição da imagem aqui

My problem is with the column "authorship". Because the authorship has 3 options see:

inserir a descrição da imagem aqui

If the user selects the second option he will enter the name of the co-author. In this case I was thinking of concatenating "author in partnership with co-author" and inserting it into the database

This is a good way ? someone has some more efficient suggestion to resolve this situation ?

  • For your database to be normalized you should have a separate table with the authors and a link table (representing an N:N relationship) making the author relation - text.

1 answer

1

This idea of concatenation is not a very nice thing. What I can suggest to you is the creation of another table, "Authors", with the fields: id, author name, coauthor name ... . This way, you can set a relation of this table with the table "Text" and insert the authors and co-authors in this new table. This way, you are respecting the main concepts of a good database diagram.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.