Re: Normalize ...relationships

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Russell,
    how about creating a mapping , or adding a "role" field to the sportsmen
table, where role is owner, etc. it all depends on whether a sportsman can
be multiple things (owner, hunter, etc) at the same time. if so you need a
mapping table.

for example
    CREATE table sportsmen_role_map (
        sportsmenID  bigint (10)notnull,
        roleID            bigint (10) notnull,
       PRIMARY KEY  (sportmenID, roleID)
   )

create table sportsmen_roles (
        roleID            bigint (10) notnull autoincrement,
        roleName      varchar(50) notnull,
       PRIMARY KEY  (roleID)
)

l0t3k
"Russell Griechen" <russgri@bellsouth.net> wrote in message
003e01c2f023$e4e48ba0$dd611442@oemcomputer">news:003e01c2f023$e4e48ba0$dd611442@oemcomputer...
> a table 'hound'
>  contains ownerID, breederID.
> These both are to be normalized in a  separate table as in:
> CREATE TABLE sportsmen (
> sportsmenID bigint (10)notnull autoincrement,
>
> Question: How? based on a sportsman can be a owner, breeder, hunter,
> President,
> Senator, Governor etc;
> CREATE TABLE hound (
>   houndID bigint(10) NOT NULL auto_increment,
>   houndname varchar(60) ,
>   studbookID tinyint (4) ,
>   sireID bigint (10),
>   damID bigint (10),
>   dob varchar (20) ,
>   dod varchar (20) ,
>   colormarkID int (10) ,
>   ownerID bigint (10) ,
>   breederID bigint (10) ,
>   kennelID bigint (10) ,
>   litterID bigint (10) ,
>   health varchar (255) ,
>   PRIMARY KEY  (houndID),
>   UNIQUE KEY (houndID),
>   KEY hdid_2 (houndID,houndname)
> ) TYPE=MyISAM COMMENT='Hound Registry';
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux