Secondary keys in a B-tree
- by Phenom
Let's say that there is a file that contains an unsorted list of student information, which includes a student ID number as well as other information.
I want to make a program that retrieves student information based on student ID number. In order to make it efficient, I store the student IDs in a B-tree.
So when I enter a student ID number, it searches the B-tree to see if its there or not. It also does one more thing. If it finds the student ID number, then it also returns where in the file that student's information is. This is the secondary key. The program uses this information to locate the rest of the student's information and prints it to screen.
Can this be done? Is this how a b-tree works?