The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+23 votes

There are five records in a database.

Name Age Occupation Category
Rama $27$ CON A
Abdul $22$ ENG A
Jennifer $28$ DOC B
Maya $32$ SER D
Dev $24$ MUS C

There is an index file associated with this and it contains the values $1, 3, 2, 5$ and $4$. Which one of the fields is the index built from?

  1. Age
  2. Name
  3. Occupation
  4. Category
asked in Databases by Veteran (59.9k points)
edited by | 2.5k views
  • What if there was some field in the table given above, whose values were in-fact 1,3,2,5 and 4 ?
  •  In the question - "Index file associated with this and it contains the values 1,3,2,5 and 4." Are these "values" the record pointers ? (I am assuming as such).

1 Answer

+47 votes
Best answer
Indexing will be on Occupation field because Occupation field lexicographically sorted will give the sequence $1,3,2,5,4$.
answered by Veteran (59.4k points)
edited by
The ordering of index records if Occupation attribute is choosed.

['CON' (1) , 'DOC' (2) , 'ENG'(3) , 'MUS' (4) , 'SER'(5)]

For other fields ,

Age is choosen,

22 gets index value 1, but from the given database 27 should get, hence not for Age Attribute.

Similar reason for Name attribute.

Category attribute is not as it contains duplicate values.

Hence correct answer is Occupation.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
47,881 questions
52,231 answers
67,651 users