I am a newbie to db.

I have a few tables, one that I define the primary key.

CREATE TABLE member (
    memid      INT(6) UNSIGNED ZEROFILL DEFAULT '002000' NOT NULL AUTO_INCREMENT,
    last       VARCHAR(20)              DEFAULT ''       NOT NULL,
    first      VARCHAR(20)              DEFAULT ''       NOT NULL,
    mi         CHAR(1)                  DEFAULT ''       NOT NULL,
    PRIMARY KEY(memid),
    INDEX name (last,first,mi)) TYPE=INNODB;


CREATE TABLE memadv (
    memid      INT(6) UNSIGNED ZEROFILL DEFAULT '002000' NOT NULL,
    advtype    ENUM('A','T','C')        DEFAULT 'C'      NOT NULL,
    FOREIGN KEY (memid) REFERENCES member(memid)
        ON UPDATE CASCADE ON DELETE RESTRICT,
    INDEX id (memid,advtype)) TYPE=INNODB;

What I want is for the primary key to be auto generated and propagated
to the other table's memid automatically, when data is entered for 
the member table? Does that make sense? Am I doint this correctly?

Thanks for the help,
Carlos

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to