SEO SERVICE PROVIDER

Home Page  Website Content  SEO Services  Blogging Services  Jobs    Search:

Home | Blogging | Software


Optimizing Single and Composite Primary Keys For Access Database Tables

By: chris howe

When designing new tables in MS Access or redesigning existing tables, professional MS Access database consultants need to confirm that each table ought to include a column, or two or three columns, that uniquely identifies each record stored within the MS Access database table. Some Access database designers employ unique identification numbers, like social security numbers, employee Id numbers or product serial numbers. MS Access database designers, as well as alternative database designers for alternative varieties of databases call this the table's primary key. MS Access employs primary key fields to index, i.e., immediately group together information from several tables and marshal the data as one.

If your database table already contains a distinctive identifier, like social security number for a dental patient, or product SKU that uniquely identifies each product in your hardware catalog, you'll be able to use that identifier as the table’s primary key. However, you want to be fully sure these values for this primary key column can never be the same for another record record. You cannot have duplicate values for database primary keys. As an example, don't use city names as a primary key, because names are seldom distinctive in a very database's record set. You may very easily have two cities with the same name in the identical table, like Sandpoint, Idaho and Sandpoint, Alaska.

Primary keys must never be empty, null or repeat. In brief, primary keys should continuously have unique values. If a column's value will ever be unknown (a missing value) or presumably modified at some future purpose, this column should never be used as a primary key, or part of a composite primary key.

Always choose primary keys whose values can never change. When you've got an MS Access database that contains additional than one table, it's attainable and usually sensible that the table’s primary key will be used as a reference for alternative tables. If the primary key changes, the change must also be applied everywhere the key is referenced in the other tables. Coming up with database tables where primary keys do not modification reduces the possibility that the primary key would possibly not coincide with different dependent tables referencing it.

One typical method used by most professional MS Access database consultants is to use an arbitrary value, like a guid, or sequential number. These arbitrary unique numbers are terribly helpful when used as primary keys. As an example, you would possibly assign each fishing lodge invoice a distinctive invoice number. The invoice number's sole purpose is to identify a fishing lodge's invoice. Once assigned, it never changes and has no reason to change.

Many expert Access database consultants directly contemplate using a column that has the AutoNumber information sort, despite whether or not there could be a social security number, a unique product SKU number or some other unique identifier.

When your MS Access database tables use the AutoNumber data type, Access automatically assigns a value for you. Such identifiers haven't any value and are carrying no great weight other than they are the primary key. The AutoNumber contains no relevant data regarding the record. Since there's no immediate relation to the first key and this knowledge outside of the record set, AutoNumber identifiers are ideal for primary keys as a result of they are doing not change. Primary keys containing relevant data or facts regarding a row, like postal codes, telephone numbers or a customer addresses, are more doubtless to alter because the factual information may change throughout the lifetime of the info in your database.

There are times when two or more fields logically makeup an MS Access database table's primary key. For instance, for an Alaska hunting and fishing lodge, a BookingDetails table stores details for Bookings would use two columns as a primary key: BookingId and LodgeServiceId. When primary keys contains more than one column, they are usually called composite keys by database specialists.

Getting your MS Access database style "right" is often a matter of preference and no two individuals will design the database excactly the same. There are rules that make information access and maintainability uncomplicated, and these rules are learned in formal settings. One ought to try to continuously make the database scalable and maintainable.

Constant Contact Free Trial

Article Source: http://www.seoserviceprovider.com/articles

NWDS supports this Alaska business and we are Database Consultants in Anchorage Alaska. They also specialize in aviation safety management systems, ICAO SMS, FAA SMS, IS-BAO SMS

Please Rate this Article

 

Not yet Rated

Click the XML Icon Above to Receive Software Articles Via RSS!
Need Articles or Content written for you?
Copyright © SEO Service Provider

Powered by Article Dashboard