The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+19 votes
1.9k views

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.6k points)
edited by | 1.9k views
0
  • 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

+39 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 (55.4k points)
edited by
+5
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.
Answer:

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

40,878 questions
47,536 answers
146,081 comments
62,300 users