At the risk of being downvoted, two mostly OT and probably irrelevant for you, cmts:
- This seems to be more of a DB question than an actual Perl one; i.e. I don't think things are different when you directly access the DB as opposed to interface with it with perl.
- You have quite a strange indenting style, and an IMHO confusing one. Maybe giving a peek into perlstyle would help.
As far as the first point goes, I have only extremely limited experience with this stuff myself, but there may be preferable approaches to interfacing with DBses. Here at work they're all enthusiastic with
Class::DBI.