Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Managing Inventory Sections with Perl and SQL

by schweini (Friar)
on Jul 29, 2003 at 08:51 UTC ( #278771=note: print w/replies, xml ) Need Help??


in reply to Managing Inventory Sections with Perl and SQL

hmm...i'm doing this rather big inventory-thingy myself, and i - even though i completly lack any formal SQL-education must warn against being TOO formalistic. i was striving towards complete orthogonality (sp?) and used indices everywhere - but now i have SQL statements that basically only consist of tons and tons of JOINs, which can get really, really slow if you have a moderate database (>100k rows). and even though i fear that i'll loose my recently aquiered status of 'monk' by suggesting this, i'd say that if you have information (like sections) that don't change too much, and wont clash too often, at least give the over-simplistic "simply-put-the-name-in-the-column" approach at least a thought....for simple systems, i'd almost say that it's the better approach. (the people that did the old system which i am replacing always wonder why i have to use all that SQL for some simplistic stuff, when they simply ran through the tables without really thinking too much...but then again, i am replacing their system ;-)
that being said, here's what i am doing:
every item has a couple of columns that are 'group-ids'. in a seperate table i store all grouping-information (id, name, subgroup of, contains items of type id X, etc.). i might migrate the 'id' part to actually being a 'id-path', i.e. "000100060007" would mean 'item is in subgroup 0007 of subgroup 0006 of group 0001' - that way, listing all items in group 0001 and below is trivial (in contrast to eternal 'does this group have any sub-group?' loops).
i manage the prices with a field containing the percents of discount (but that was a requirement). your approach looks fine to me.
good luck, and keep it simple - some times the simpler way IS the better way, IMHO (my theory being that so many geeks have long beards because they never heard of occham's razor ;-). inventory systems are hell, i tell ya!

but please DO take all this with a load of salt - i'm a radical autodidact.
  • Comment on Re: Managing Inventory Sections with Perl and SQL

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://278771]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2020-06-05 19:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (40 votes). Check out past polls.

    Notices?