rgb192
asked on
integer id column. need to add data
how to link
categories to products
I have a products table
with an integer id column
product 1 could be
category: electronics
product 2
category: electronics > audio > audio components
categories to products
I have a products table
with an integer id column
product 1 could be
category: electronics
product 2
category: electronics > audio > audio components
Care to post the schema (CREATE TABLE) for both tables?
ASKER
I need to create categories table
products table is integer for productID which is primary key
products table is integer for productID which is primary key
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
why is category.categoryid
not
autoincrement
not
autoincrement
You could keep it autoincrement but since it has to be a self referential foreign key so you would need to take care when you enter ParentCategoryId of other rows in this table. Like suppose CategoryId of Electronics is 1 and that of Audio is 2 comes out through autoincrement then you would have to ensure that ParentCategoryId of Audio is kept as 1 and that of Audio Components is kept as 2 and so on to maintain the hierarchy.
I need to create categories table
products table is integer for productID which is primary key
I am afraid that tells me nothing, so I am glad you got some help.
Good luck.
products table is integer for productID which is primary key
I am afraid that tells me nothing, so I am glad you got some help.
Good luck.
ASKER
thanks
i will leave no increment now
i will leave no increment now