|Think about Loose Coupling|
Re: Yet Another Half Perl Half mySQL Questionby Brovnik (Hermit)
|on Jul 06, 2001 at 17:49 UTC||Need Help??|
This is what I used for a module written recently.
Table Creation :
Then INSERT rows. And later, to access :
Note that the table is created without unique IDs or primary keys since this is a many-to-many relationship. One of the columns could be an IP address in your case.
For the pedants, there is replication of the name in the columns, but the duplication is outweighed by the ease of access (see how easy in lines of code it is to retrieve a list of names) and reduction in complexity by not having a name-to-id mapping.
BTW, the previous iteration of the module used a single entry in another table and used join/split, which is quicker, but less elegant in DB terms.
If you need raw speed, use Perl to do the split, if you want it cleaner and more DBish, use a table as above.