Creating a foreign key is required for refrential integrity and is normally a good practice. It is also true that a foreign key has a say inperformance. To make it better what you can do is to create index on the foreign keys.
As I mentioned creating a foreign key constraint is required for refrential integrety and normally is a good practice. It do have an impact on performance which can be reduced by creating an index. If you craete the index on foreign key it will reduce the lookups.
Creating a foreign key is not mandatory but is advised to create. Here[^] is a link which tells about the importance of it.
Now here[^] is another article which tells about refrential integrity and performance degradation which might give you a bit more idea about this.
i want to convert this days (integer) to years months and days
Well, break it down.. if you have the number of days, how many days in a year? Let's assume 365; so number of years in int(number of days / 365).
Months... let's assume 30 days on average... Months = int((number of days - years * 365) / 30)
And days are then number of days - years * 365 - months * 30
If that doesn't work, better define what you're after.
Given the sample dates you provided, what are the values you calculated for years, months and days?
I will just say that this sort of exercise seldom ends well without business requirements.
I am not going to analyze all possible interpretations but I will provide and example from your own data.
A business person asks you for how many years in that. All of the following are possible answers.
- One. 2013-10 to 2014-10 is one year, but 2014-10 to 2015-05 isn't.
- Zero. Because 2013-10 to 2014-10 is one year but it isn't 2014-10 yet
- Three. 2013, 2014, 2015 = 3.
- Two. 2013-10 to 2014-10 is one year, but 2014-10 to 2015-05 is partial, so round up to get 2.
- Five. The dates are supposed to be based on the contract period not the annual service dates (which the above dates are.)
- 17. Because the person that actually wants this wants a count of months covered.
I have installed one software that works with local ms access database.
If you remove that database of course the software displays the warning that the database is missing.
Can i migrate this database to Sql server so the program will work with Sql and not with Ms Access anymore????