# Thread: Storing data in HASH tables

1. Registered User
Join Date
Aug 2015
Posts
1

## Unanswered: Storing data in HASH tables

I am currently studying for my exam and examining last years exam paper.

Exam Question

Now suppose that the Sites table is stored in a hash table that uses SiteID as the hash key. Load the following records with SiteID values 9, 16, 12, 7, 20, 30 into the table. We assume that records are inserted into a hash table in the given order using the hash function h(K) = K mod 8, where K is a SiteID value. Each bucket is one disk block and holds 2 records.

Solutions

h(9) = 9 mod 8 = 1
h(16) = 16 mod 8 = 0
h(12) = 12 mod 8 = 4
h(7) = 7 mod 8 = 7
h(20) = 20 mod 8 = 4
h(30) = 30 mod 8 = 6

My question

how do you determine which record goes to watch bucket? in other words, how do u get the very last value of each row ?

2. Registered User
Join Date
Aug 2003
Location
Where the Surf Meets the Turf @Del Mar, CA
Posts
7,776
what does this question have to do with Oracle RDBMS?

3. Registered User
Join Date
Jun 2003
Location
West Palm Beach, FL
Posts
2,713
If you are referring to Hash Cluster Tables, then
There is a structure called a hash bucket (not watch). Each output possibility is related to a single hash bucket. If the output range is from 0 to 8, there will be 9 hash buckets.
This means that if you have MOD 8 as your hash function, then you will have 9 hash buckets ( 0 - 8 ).

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•