[英]What would be the Better db design for the old db structure?
i've a old database where i store the data of the holidays and dates in which they are celebrated.. 我有一个旧的数据库,我在那里存储假期和庆祝日期的数据。
id country hdate description link
1 Afghanistan 2008-01-19 Ashura ashura
2 Albania 2008-01-01 New Year Day new-year
the flaws in the above structure is that, i repeat the data other than date for every festival and every year and every country.. 上述结构的缺点是,我针对每个节日,每年和每个国家/地区重复日期以外的数据。
For example, I store a new date for 2009 for ashura and afghanistan .. 例如,我为阿修罗和阿富汗存储了2009年的新日期。
I tried to limit the redundancy and split the tables as 我试图限制冗余并将表拆分为
countries (id,name)
holidays (id, holiday, celebrated_by, link)
// celebrated_by will store the id's of countries separated by ','
holiday_dates (holiday_id, date, year)
// date will the full date and year will be as 2008 or 2009
Now i have some problems with the structure too.. 现在我的结构也有一些问题。
consider that i store the holiday like Independence day , its common for more countries but will have different dates. 考虑到我将假期存储为独立日,这对于更多国家/地区来说是很常见的,但日期却不同。 so how to handle this and and the link will have to be different too.
因此如何处理该问题,链接也必须有所不同。 .
。
And i need to list the countries which celebrates the same holiday and also when i describe about a single holiday i need to list all the other holidays that country would be celebrating.. 而且我需要列出庆祝同一假期的国家,并且当我描述一个假期时,我需要列出该国将庆祝的所有其他假期。
And the most of all , i already have huge amount of data in the old tables and i need to split it to the new one once the new design is finalized... 最重要的是,我已经在旧表中存储了大量数据,一旦完成新设计,我需要将其拆分为新数据。
Any ideas? 有任何想法吗?
What about having a nn relationship? 拥有nn关系怎么样?
Table: Country 表:国家
Table: CountryToHoliday 表格:CountryToHoliday
Table: Holiday 表:假期
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.