Referential Integrity / Troubleshooting Integrity
Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.
Learn More
Subtitles of the Movie
Integrity is all about ensuring data quality. When we ensure data quality, we need to be aware of what can go wrong. So let's start by talking about some of the barriers to data quality itself. First there's speed. We have to have the correct performance within the system. There's also bandwidth. We have to be able to get to the server to get our data. This can be affected by heavy transactions or many users. One of the most important culprits to keep in mind though is lack of training. If your staff is not properly trained on the use of the database or more importantly, on the way to create queries, you may have issues with your data quality. Now, the first component that should be in your arsenal to combat bad quality is referential integrity. Referential integrity at least ensures that I cannot add new records to a table if it's not in the primary table. This, of course, is referring to working with a foreign table. Referential integrity should be used as much as possible; however, there are always times when we cannot use it. One example would be if I have two separate databases and I'm combining tables from those two together. Now, when you're working with the integrity, keep in mind that there are some steps that you can do to protect the data itself. First, when you're working with integrity, remember that data entry errors can be one of the main things going wrong. Make sure you have solid procedures on how people should be using the database. Also ensure that you put as many validations into place as possible. If you are transmitting data over the Internet itself, keep in mind that you could get errors during this importing of the data or the actual transmitting itself. Again, make sure that you have verification routines set in place to check this data. Viruses, malware, other uninvited components can also jeopardize the quality of our data and finally, keep in mind your hardware. If your hardware malfunctions, such as a disk crash, your quality is going to be jeopardized. So what do we do? Well, first and foremost, make sure you have backups and when you use a backup, make sure it's correct. I'm a big advocate of the aspect of using the backup. Setup a test machine. Take your database from a backup and restore it to the network. You'll see if it's working correctly but it also allows you to check to ensure the media in which you're using is working correctly. Also security; do not let people into areas of the database where they do not need to be. One of the best ways to protect your quality is to limit the amount of people that actually go into the database and then finally, definitely use constraints. Constraints will prevent incorrect entry. If you have limited me to only enter data for this year, I can't enter data for next year. Other things that we can do also include our data types. Now, this is often overlooked. We think in terms of just setting everything to a simple integer or just a simple variable character field. Put some time into this; not nulls for instance. They ensure that the data cannot be empty and we know that blank spaces or empty columns can cause problems. Also, use defaults. The default sets of value and the default will ensure that the columns are not left empty. The use of defaults sets the values for your database and the information in there. It's a key component of really ensuring proper entry and then remember, you do have that identity. The identifier will uniquely identify the row, which can be a plus. Our primary key needs to be protected. I always recommend using the automatic numbers so you don't have to worry about bad data in the primary key; that is, of course, one of the most important fields to keep an eye on. Now, constraints, remember, are simply rules. These rules will restrict the acceptance of data as we discussed with the date. Along with the rule you can also set a trigger. The trigger now will automatically enforce the rule on any kind of change. And then finally, keep in mind that the constraints will not change the component within your database so it will help maintain integrity. We'll talk about indexes also. These indexes will help you find a particular value and then follow that value to the rest of the row. Again, it's limiting how much action's occurring in the database but most importantly, common sense and critical evaluation are the most important factors. Take some time to properly design and plan. Review your tables and really look at them logically to see if the best definitions were selected.
Tutorial Information
| Course: | Database Optimization |
| Author: | Lauri Sowa-Matson |
| SKU: | 34078 |
| ISBN: | 1-935320-94-7 |
| Release Date: | 2010-01-06 |
| Duration: | 8 hrs / 111 lessons |
| Work Files: |
Yes |
| Captions: | Available on CD and Online University |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 98,729 Video Tutorials (23,265 free)
- Video Available as Flash or QuickTime
- Over 1026 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 