7,503 views
4 votes
4 votes
If a file consists of 5 attributes, then the number of secondary indices that can be constructed on that file is ______.

2 Answers

Best answer
6 votes
6 votes

First of all we know for a given table one of primary or clustered index can exist but not both..In contrast , there can be multiple secondary indices which can be accomodated at the same time.

So basically with n attributes we can have any index having any number of attributes and order of attributes will matter as change of order of attributes for key formation will result in formation of different index.So it is a question of permutation rather than combination(selection).

So no of indices that can be built using 1 attribute only = Permutation of 1 object at a time from n objects

                                                                                = nP1

Similarly no of indices  that can be built using 2 attributes at a time = nP2

...

So we continue this till the point we can have n attributes for secondary index which can be done in nPn ways.

So substituting n = 5 , we have :

No of secondary indices possible = 5P1 + 5P2 ...........+ 5P5

                                                 = (5! / 4!)  + (5! / 3!) + (5! / 2!) + (5! / 1!) + (5! / 0!)

                                                 = 5 + 20 + 60 + 120 + 120

                                                 = 325

Hence no of secondary indices possible with 5 attributes = 325

selected by
1 votes
1 votes

Secondary index is used to provide a secondary way to access the file..But for that we obviously need to have a Primary Index
according to navathe

A secondary index provides a secondary means of accessing a data file for which 
some primary access already exists. The data file records could be ordered, 
unordered, or hashed. The secondary index may be created on a field that is a candidate key and has a unique value in every record, or on a nonkey field with duplicate values. 
From -> Navathe DBMS !

Now 1 attribute has formed  PI

then we have 4 choices to form secondary index but secondary indices can also be on the ordering field so 5 choices
 

so possibility

5P1+5P2+...+5P5

=325

edited by

Related questions

3 votes
3 votes
0 answers
3
h4kr asked Jan 31, 2023
580 views
Number of possible permutations that can be obtained using stack if the input sequence is 1, 2, 3, 4, 5 (in the order) is
0 votes
0 votes
2 answers
4