June 1, 2005 at 4:18 pm
I am updating a database driven ecommerce site and have a performance related to question.
I have a database with a few tables, my question is this.
One of the tables contains details about each product.
At present each product is limited to one section as the section is stored in a field in the product table.
I need to upgrade this to allow the product to be associated with multiple sections.
Is it best to or be more efficient to:
a) Continue to use a field in the product table, storing the section id's separated by commas. Then querying the product table using a like command to match the section id.
or
b) Have a separate table cross linking the product table with the section table. 1 entry per product/section relationship. Then innerjoin the product info.
or
c) another way i havent thought of!
I am using asp with sql server.
Any help would be appreciated.
Marc
June 1, 2005 at 5:31 pm
Marc, alternative 2 is the way you should do this.
June 2, 2005 at 12:40 am
Yes! Alternative b) is the strength of RDBMS. Alternative a) is a violation of 1NF and should be avoided.
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
June 2, 2005 at 3:10 am
Brilliant, thanks gents. I am not a master using DB's as this question probably shows. Whats 1NF by the way?
June 2, 2005 at 3:19 am
Sorry, http://en.wikipedia.org/wiki/Database_normalization
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply