yderkach has asked for the wisdom of the Perl Monks concerning the following question:

We are trying to name SQL queries in a fairly intuitive way and place them in a lib file, using SQL::Library. We have read Conway's "Perl Best Practices" as a guideline for naming subroutines. The scheme we have come up with is:

SQLCMD_Action_Object

Some examples:

sel_count_categories, sel_count_clicks_agencyPage, sel_count_agency_visits = "SELECT 'Visits to detailed agency page:' as report_type, * FROM " . "(SELECT COUNT(*) as one_month FROM web_requests WHERE file ~* ' +rm=show_agency' AND file ~* 'agency_id=$agency_id' )

We are interested in any feedback you could give us on our approach or your suggested approach.

Replies are listed 'Best First'.
Re: SQL Naming Conventions
by bichonfrise74 (Vicar) on Sep 01, 2009 at 22:22 UTC
    I personally like to use underscore in naming any of my variables. Also, I think your scheme looks okay to me and as long as everyone follows this scheme in their development process, then it should be fine.