convert database entrys

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Nov 24 10:34:53 CST 2003


on 11/24/03 10:12 AM, Jonathan Fiagbedzi at j.fiagbedzi at e-novum.com wrote:

>>> Maufa; Sub1; Sub2...
>>> -------------------
>>> BMW; Wheel; Tire
>>> BMW; Wheel; Rim
>>> BMW; Window; Front
>>> Audi; Wheel; Tire
>>> Audi; Wheel; Rim
>>> Audi; Window; Front
>>> ...
>> 
>> 
>> You keep all this in one table?
>> 
>> In fact not good design because your table is not normalized
> 
> What would be a good design for my database. i want to have a good design
> because i have a lot of records and want to learn how to build very good db
> designs.

You can find and read ANY book on DBMS, relational model.
Usually they have part about normalization of tables.

Good tables, DO NOT have repetitions.

So you should split above table at least on 3 tables as I see
Table1 will have car names.
Table 2 will have ObjectPtr on table1 now.
Table2 points on Table2

    Table1          Table2              Table3
        
    BMW             1  Wheel            1 Tire
    Audi            1  Window           1 Rim
                    2  Wheel            2 Front
                    2  Window           3 Tire
                                        3 Rim
                                        4 Front



But as you see we still have the same words in Table2 and Table3.

So if you try understand what you want to do you get next:
    You have some details, and you link that details to some car.


    tblDetail       TblDetailKind       tblCar
     Wheel              Tire            BMW
     Window             Rim             Audi
                        Front



And now you need have 4th table that link all 3 tables:


                tblLink { ptrCar, preDetail, ptrKind, }

                           1        1           1
                           1        1           2
                           1        2           3
-                          2        1           1
                           2        1           2
                           2        2           3


Now you get nice db.
You have no the same words duplicates.
This means that you can easy change/correct word just in one place.


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list