4. Secondary Key

Primary key is the main way that records within a table are defined and sorted. But it is also useful to be able to select certain category of records without having to use the primary key.

secondary key

For example, with the customer records shown above perhaps an useful way to view records would be by title. In which case a 'secondary key' is set up within the database. This secondary key indexes the records according to title.

The good thing about secondary keys is that the secondary index allows often-queried category of records to be extracted far quicker. But the downside is that the indexes could make the database significantly larger. So the database analyst has to carefully weigh up the benefit of adding secondary keys to the database.

Secondary keys do not have to be single fields, they can be a combination of fields. In the example below a secondary key is indexing records based on title and surname. so it would be a really quick query to extract all people called 'Mr Jones'

compound index


Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Using secondary keys





Copyright © www.teach-ict.com