Here is some software that might be usefull:
starbase is a set of filter programs and an ascii table format for UNIX. The the database concepts are outlined in the book Unix Relational Database Management by Manis, Schaffer and Jorgensen. This implimentation has been written at the Smithsonian Astrophysical Observatory and contains may extensions for use with scientific and astrophysical data sets.
My ADASS paper starbase.ps.
funtools is a set of command line programs and library routines to manipulate FITS tables and images.