On Tue, 2002-06-18 at 15:42, Xuefer wrote:
> thx for replying
>
> it's really a new course for me
>
> option 1 will still make lots of tables
>
> does option 2 waste of space ?
> cause 2 id with only 1 value
How many tables are created and how much spaces is wasted depends on
the data and the design.
Test a few different designs - see how much space the designs take
and how complex the queries are.
>
> i'm going to make table as described below.
> i wonder it's feasibility
>
> also bring another question here:
> my forum has "favorite" table
> for use to collect their favorite post
>
> Table `favorite`:
> cols: userid INT, postid INT
> unique index(userid, postid)
>
> only a pair of ID pre row
> question: does this struct waste of space? if so, any better solution ?
This is probably the best way to handle it.
>
> -----------------
> struct of product attribute:
> -----------------
>
> Table `cate`:
> cols: cateID cateName
> example row:
> 1 "switches-100"
>
> Table `Attribute`:
> cols: cateID attributeID attributeName displayOrder
> example row:
> 1 1 color 1
> 1 2 size 2
>
> Table `product`:
> cols: cateID productID productName productDescription
> example row:
> 1 1 "greenswitch" blah blash...
>
> Table `AttributeValue`:
> cols: productID attributeID attributeValue(varchar)
> example row:
> 1 1 green
> 1 2 10*10
> -----------------
>
> to delete attribute:
> DELETE FROM Attribute where attributeID=$id
> DELETE FROM AttributeValue where attributeID=$id
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.
Good Luck!
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Zak Greant <[EMAIL PROTECTED]>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Advocate
/_/ /_/\_, /___/\___\_\___/ Calgary, Canada
<___/ www.mysql.com
---------------------------------------------------------------------
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