On Tue, 2002-06-18 at 19:02, Xuefer wrote:
> sorry, i can't quite get what u meant
> dunno how to do as u said
> 
> >  You might want to associate the attributes with categories
> >  in a different table. This way you could put an attribute 
> >  into multiple categories. You could also specify the displayORder
> >  in the category table as well.

Hi Xuefer,

No problem - sometimes code is the best explanation! :)

Here are the rough tables for what I described - they *may* work! :)

CREATE TABLE category (
    id          SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL,
    name        VARCHAR(64) NOT NULL,
    members     TEXT NOT NULL,
    PRIMARY KEY (id,name),
    ...
);

CREATE TABLE att_type (
    id          SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL,
    name        VARCHAR(64) NOT NULL,
    description TEXT NOT NULL,
    PRIMARY KEY (id,name),
    ...
);

CREATE TABLE product (
    id          MEDIUMINT UNSIGNED AUTO_INCREMENT NOT NULL,
    category    SMALLINT UNSIGNED NOT NULL,
    name        VARCHAR(64) NOT NULL,
    description TEXT NOT NULL,
    PRIMARY KEY (id),
    ...
);

CREATE TABLE attributes (
    id          INT UNSIGNED AUTO_INCREMENT NOT NULL,
    product_id  MEDIUMINT UNSIGNED NOT NULL,
    att_type_id SMALLINT UNSIGNED NOT NULL,
    value       VARCHAR(64) NOT NULL
    PRIMARY KEY (id),
    ...
);

Good Luck!
-- 
"Gosh, Batman. The nobility of the almost-human porpoise." --Robin
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Zak Greant <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB, Advocate
/_/  /_/\_, /___/\___\_\___/   Calgary, Canada
       <___/   www.mysql.com

Feed the Dolphin! Order MySQL support from the MySQL developers at 
https://order.mysql.com/?ref=mzgr


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to