The most important use of secondary keys is combining them to retrieve a subset of records from the data file. For example, we can use combinations of secondary keys and boolean operations AND/OR to specify the intersection/union of two subsets of the data file. Consider the following query: Question: Find all data records with: Composer = “BEETHOVEN” AND Title = “SYMPHONY NO.9” |
|
First the composer index is searched for the list of Label IDs that identify records with BEETHOVEN as composer. |
Next the title index is searched for the Label IDs associated with records that have SYMPHONY NO. 9 as title. |
|
|
Now the boolean AND is performed and only the Label IDs that appear in both lists are considered. |
ANG | 3795 | Symphony No. 9 | Beethoven | Guilini |
DG | 18807 | Symphony No. 9 | Beethoven | Karajan |