开发者

What will be best strategy for designing database for a magazine online? [duplicate]

开发者 https://www.devze.com 2022-12-14 01:01 出处:网络
This question already has answers here: DB design to use sub-type or not? (5 answers) Closed 8 years ago.
This question already has answers here: DB design to use sub-type or not? (5 answers) Closed 8 years ago.

I have design a magazine online and worry that is it the best approch or开发者_开发百科 at least a good approch or no,the magazine contains articles+news in all subjects, i have one table for both articles+news ,but i would like to know that is this good or i must separate articles and news (it is clear that beside the main table there are several tables for categories ,tags,and photos and tables for relation between these tables)?

Thanks


I would say, that depends on your schema for the articles and news and how you create new ones.

If articles and news share the same columns (or the have most columns in common) you can use one table and just have a column that distinguishes between article and news.

For creating new entries: Do you have a single form in your backend where the author can decide wether the entry should be an article or a news entry?

If you have different forms because articles and news have different properties, you should consider to create separate tables.

Do you consider articles and news to be basically the same or do they have even different business logic?


Edit after comment:
I meant if you do something different with them like e.g. there is email notification if a new article is created. I assume you don't have that.
If they have the same properties, then there is no need to create an extra table.
Nevertheless, having two different tables might be a better choice if you make changes to your system in the future (e.g. one day you realize that you need other properties for articles that don't make sense for news).


the best way to design a database schema is to think not in terms of tables, columns and rows, but in terms of sets and boolean functions. the sql terminology is hopelessly confusing.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号