So i take it you want to code the Database in DB. Not interact with a database from db.
If so.
You need to decide what type of data structure you will use. I have a entire volume on searching and sorting algorithms.
Data stuctures:From dyanmic arrays, trees, linked lists, etc..
Sorting algorithms:
(bubblesorts, selection sort, Parallel Sort/merge, quicksort, heapsort, Batcher's odd-even sort, hashing,
Which one you use depends on How large will the Database be. Speed VS. memory. Will you want to be able to use other key fields to search? Will you want to be able to sort the database in other ways (like a-z, z-a, first name, last name etc..)
If you are just looking to have it alphebetaized by last name (and that's all you ever want) i can give you code to insert into an array. But if you plan on developing further there are (little but more complex) but better methods. Also will the Databse be a fixed size or will it be changing drastically. Let me know.
~zen