Another design to consider would be to create separate relationship tables for each content type: article_category (article_id NOT NULL, category_id NOT NULL) photo_g_category (photo_g_id NOT NULL, category_id NOT NULL) video_g_category (video_g_id NOT NULL, category_id NOT NULL) This design eliminates the need to store NULL values, as would be required in your design. All of these columns would be defined as foreign keys to the appropriate tables Wasted space is not really an issue with your design. (In most database engines, no space is used to store a NULL value.) The bigger issue with your design is making sure that at least one of the content FK columns is populated, and allowing the others to be null.
Also, your design makes the process of adding and removing relationships more complicated, if you allow more than one content FK column to be populated on a row How would you plan represent content related to category, e.g. 1? Article: a, b, c photo_g: p, q video_g: v, w, x, y, z 1 a p v 1 be q w 1 c - x 1 - - y 1 - - z OR 1 a - - 1 be - - 1 c - - 1 - p - 1 - q - 1 - - v 1 - - w 1 - - x 1 - - y 1 - - z The removal a relationship between category 1 and photo_g p would be different, in one case requiring an update to a row, the other, deleting a row (there's no point in keeping a row where none of the content FK values is populated) I suggest three separate tables to hold these relationships: article_category: a 1 be 1 c 1 photo_g_category: p 1 q 1 video_g_category: v 1 w 1 x 1 y 1 z 1.
Another design to consider would be to create separate relationship tables for each content type: article_category (article_id NOT NULL, category_id NOT NULL) photo_g_category (photo_g_id NOT NULL, category_id NOT NULL) video_g_category (video_g_id NOT NULL, category_id NOT NULL) This design eliminates the need to store NULL values, as would be required in your design. All of these columns would be defined as foreign keys to the appropriate tables. Wasted space is not really an issue with your design.(In most database engines, no space is used to store a NULL value.) The bigger issue with your design is making sure that at least one of the content FK columns is populated, and allowing the others to be null.
Also, your design makes the process of adding and removing relationships more complicated, if you allow more than one content FK column to be populated on a row. How would you plan represent content related to category, e.g.1? Article: a, b, c photo_g: p, q video_g: v, w, x, y, z 1 a p v 1 be q w 1 c - x 1 - - y 1 - - z OR 1 a - - 1 be - - 1 c - - 1 - p - 1 - q - 1 - - v 1 - - w 1 - - x 1 - - y 1 - - z The removal a relationship between category 1 and photo_g p would be different, in one case requiring an update to a row, the other, deleting a row (there's no point in keeping a row where none of the content FK values is populated).
I suggest three separate tables to hold these relationships: article_category: a 1 be 1 c 1 photo_g_category: p 1 q 1 video_g_category: v 1 w 1 x 1 y 1 z 1.
I like this idea, beside of fact that in (category, type, item) system I have to make another "category like" table - types and of course adding/removing problem. In this case I will just call specific table in specific model. Thanks.
– Sqrcz Mar 6 at 18:54.
You could have a table for the relationship like: category_id, type_of_item, item_id where type_of_item would be article, photo, video etc. And item_id is the id of the item which is in the cateogry.
Sounds reasonable :) gonna try that. Thank You. – Sqrcz Mar 5 at 20:02.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.