List:General Discussion« Previous MessageNext Message »
From:PJ Date:May 5 2009 10:16pm
Subject:Re: [PHP] How to deal with identical fields in db
View as plain text  
Tom Worster wrote:
> On 5/5/09 4:42 PM, "Richard S. Crawford" <rscrawford@stripped> wrote:
>
>   
>> On Tue, May 5, 2009 at 1:34 PM, PJ <af.gourmet@stripped> wrote:
>>     
>>> I'm coming up with a bit of a quandry: how to enter and retrieve an
>>> identical book title with different authors.
>>> It is rather unbelievable what contortions one finds as authors :-(
>>> like editors, associations and then the unknowns and anon y mouses.
>>> I suppose one has to get really creative...
>>>       
>
> don't forget to consider the handling of anthologies :-)
>   
Well, that usually comes under editors and I have a couple of options
where to enter that info: sub_title or description fields and I can
always add a &nbsp; for author first_name and Various or whatever for
last_name :-)
>
>   
>>> Anyone for tea?
>>>       
>
> yes please, i'd love some.
>
>
>   
>> What I've done for this sort of project in the past was create
>> separate tables for authors, books, and author relationships (e.g.,
>> author, translator, editor), then linking tables for each of those.
>> You seriously want to do some normalization on this task; otherwise,
>> you end up with a giant table of books, with multiple rows duplicating
>> the title of the book, leading to a huge "books" table, and nobody
>> wants that.
>>     
>
> i have a db with 10s of millions of artists, disks, songs etc. i've tried it
> both ways. and after 5 years working with it i still can't make up my mind
> which way i prefer it. i keep finding pros and cons to each approach that
> differ depending on what functionality i'm programming. i will never have a
> simple answer.
>
> so i can't help answer the original question other than to say that, for me,
> personally, in my opinion, i don't accept the dogma that normal forms are
> always good for you. they might be. it depends. it's like being dogmatic
> about specific foods without taking the overall diet and lifestyle into
> account. despite the simple dogma some may espouse, whether or not a big mac
> with fries is bad for you depends on many factors.
>
> in any case, it's amazing what you can do these days with one huge table and
> some well chosen indexes. and it's amazing how mind bending it can get when
> joining 5 data tables using 3 join tables.
>   
ain't that the truth !
> good luck, phil.
>   
Thank you guys, for the input. Never thought so many would help so
few(little me). ;-)
I'm really just a little shorter than BG at 6'5" :-D
Actually, I started out and still am with the db normalized. It all
works quite well, it's just frustrating to have to go through all the
contortions to check things. I started out with just checking the title,
then had to add a check to the sub_title, (already have a check for
author) but now have to add another to go with the specific book... oh,
well... all a part of the learning process. :-)

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-------------------------------------------------------------
Phil Jourdan --- pj@stripped
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php

Thread
Re: [PHP] How to deal with identical fields in dbPJ6 May