Sunday, 15 January 2012

mysql - One field always the same how should i store in that case -


I have a document table that I want to store the history of documents:


< Pre> id | Doc_number | Date | Statue_Id | Type_id

can be type_id1 (means export) or 2 (import means). So the question is when I want to store it:

  Insert document values ​​((1, 'AA10', 10.03.2015,1,2), (2, 'AA 10 ', 12.03.2015,2,2), (3,' AA10 ', 15.03.2015,3,2));  

Can I do this way or should I create two tables (the type of beige type_id was the same every time): Document_isport, document_import, without type id? For example, aa 10 document is an import type


  Id. Doc_number | Date | Statue_Id |  

What is the use of Statue_Id ? It seems that it separates the values ​​of each of your lines.

But still I suggest for history, if you keep all values ​​in the same table, then its priority is to store type_id at all times so that anyone can see the history. Make sure that the work is done with a special document, how many times is the usual fundamental to keep a history of any item


No comments:

Post a Comment