Index

Section: How databases are organized
...Subsection: Index

We expect tables to be sorted. Think back to the telephone book example. The traditional phone book is sorted by last names. The 'backwards phone book' might be sorted by phone numbers. "Last name" and "phone number" describe fields in a database. The field that you use for sorting the database is often referred to as the key field

Q. 2

Most of us still remember libraries with the old card catalogs. Why did they have an entirely separate cabinet for subject, title, and author?


There are problems with this approach. In order for database programs to be effective, there must be some unique way of dealing with each record. It would clearly not be efficient to use 'first name' as a primary key in a database of people in a city, because there would be far too many people with the same name. To deal with this, most DBMS systems allow you to create an index. The index solves this problem of uniqueness with one of two strategies: Each record must have either a truly unique field or a unique combination of fields. The unique field strategy requires each record to have a field whose value cannot possibly be duplicated in the database. These fields are usually either some arbitrary number (like your account number at the bank or insurance company) or the old stand-by in America, the Social Security Number.

Q. 3

Why is your social security number used so frequently in databases?


The other strategy uses multiple fields to generate an index. The phone book uses the last name as a primary key, but that may not be unique enough if you have a common last name. If the database system encounters a large number of people with the same last name, it then sorts that group by the first name, then any with both the same last name and first name will be sorted by middle initial. Using this combination of fields decreases the likelihood that there will be two records with the same index.

To recap, an index is some way of using one or more fields to uniquely identify each record in a table.

Q. 4

So what is the index in a yellow pages phone book?



Harris, Dey