[PHP-DB] Structure Question...

2002-11-07 Thread Doug Coning
Hi everyone,

I'd like to know how you would set up the following:

I've set up a MySQL database with 600 products.  I set it up where each
product belongs to a category.  However, now we want to take it further
where different products can now belong to more than 1 category.

How would you create this?

1. Would you duplicate the records for items that belong to more than 1
category and change the categories in those duplicated records?

2. Would you enter multiple categories into 1 column?

3. Would you create a different database that tracks categories and creat a
many to many relationship?

Thanks,

Doug Coning





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Structure Question...

2002-11-07 Thread Ignatius Reilly
You have to create a table:
CREATE TABLE product_categ (
FK_productID definition,
FK_categID definition
)
and list all relationships productID belongs to categID

Ignatius

- Original Message -
From: Doug Coning [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, November 07, 2002 7:51 PM
Subject: [PHP-DB] Structure Question...


 Hi everyone,

 I'd like to know how you would set up the following:

 I've set up a MySQL database with 600 products.  I set it up where each
 product belongs to a category.  However, now we want to take it further
 where different products can now belong to more than 1 category.

 How would you create this?

 1. Would you duplicate the records for items that belong to more than 1
 category and change the categories in those duplicated records?

 2. Would you enter multiple categories into 1 column?

 3. Would you create a different database that tracks categories and creat
a
 many to many relationship?

 Thanks,

 Doug Coning





 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Structure Question...

2002-11-07 Thread Miles Thompson
Third choice, definitely. And aren't you glad your data is sufficiently 
normalized that this is a no-brainer!

Cheers - Miles Thompson

At 12:51 PM 11/7/2002 -0600, Doug Coning wrote:
Hi everyone,

I'd like to know how you would set up the following:

I've set up a MySQL database with 600 products.  I set it up where each
product belongs to a category.  However, now we want to take it further
where different products can now belong to more than 1 category.

How would you create this?

1. Would you duplicate the records for items that belong to more than 1
category and change the categories in those duplicated records?

2. Would you enter multiple categories into 1 column?

3. Would you create a different database that tracks categories and creat a
many to many relationship?

Thanks,

Doug Coning





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Structure Question...

2002-11-07 Thread Brent Baisley
You would want 2  3.
You should create 3 tables, one for products, one for categories and one 
to relate the two. You should only store ID numbers that relate to 
products and categories.


On Thursday, November 7, 2002, at 01:51 PM, Doug Coning wrote:

Hi everyone,

I'd like to know how you would set up the following:

I've set up a MySQL database with 600 products.  I set it up where each
product belongs to a category.  However, now we want to take it further
where different products can now belong to more than 1 category.

How would you create this?

1. Would you duplicate the records for items that belong to more than 1
category and change the categories in those duplicated records?

2. Would you enter multiple categories into 1 column?

3. Would you create a different database that tracks categories and 
creat a
many to many relationship?

Thanks,

Doug Coning





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Re: Betr.: [PHP-DB] Structure Question

2001-03-27 Thread Jordan Elver

I thought that it was good db design to have no repeating data in your db but 
to use a relationship instead?

Jord

On Tuesday 27 March 2001 14:42, you wrote:
 Jord,

 I don't see quite why you should want to use two tables, you can easily put
 all the information in one table and have one column which holds the
 filetype. There's (almost) no speed profit to put the information in
 several tables.

 Have fun,
 Maarten Verheijen

  Jordan Elver [EMAIL PROTECTED] 27-03-01 13:37 

 Hi,
 I want to keep filenames of different kinds of media(real sudio, qt, mp3)
 for articles in a db table. Would it be best to store each kind of media in
 a different table like one table for real audio, one for quicktime, one for
 mp3. Or, would it better to store them all in the same table but with
 another table telling me what kind of file it is?

 Like:

 media table
 
 id | name | filename | type_id

 media types
 
 type_id | name

 Any ideas folks?

 Cheers,

 Jord

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Structure Question

2001-03-27 Thread [EMAIL PROTECTED]

Why don't you just store the file names in a db?

iets much easyer



 Hi,
 I want to keep filenames of different kinds of media(real sudio, qt, mp3)
for
 articles in a db table. Would it be best to store each kind of media in a
 different table like one table for real audio, one for quicktime, one for
 mp3. Or, would it better to store them all in the same table but with
another
 table telling me what kind of file it is?

 Like:

 media table
 
 id | name | filename | type_id

 media types
 
 type_id | name

 Any ideas folks?

 Cheers,

 Jord

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Structure Question

2001-03-27 Thread Jordan Elver

I am.

Jord

On Tuesday 27 March 2001 14:06, you wrote:
 Why don't you just store the file names in a db?

 iets much easyer

  Hi,
  I want to keep filenames of different kinds of media(real sudio, qt, mp3)

 for

  articles in a db table. Would it be best to store each kind of media in a
  different table like one table for real audio, one for quicktime, one for
  mp3. Or, would it better to store them all in the same table but with

 another

  table telling me what kind of file it is?
 
  Like:
 
  media table
  
  id | name | filename | type_id
 
  media types
  
  type_id | name
 
  Any ideas folks?
 
  Cheers,
 
  Jord
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




AW: [PHP-DB] Structure Question

2001-03-27 Thread Stefan Siefert

I think you should store all files in a table with an extra table with the
filetypes (like you suggest in the end of your mail)!! In my opinion this is
a well designed database modell, 'cause you have only one table (instead of
10 or twelve depending on the count of your datatypes), but you are able to
select over the filetyp criteria!!

Stefan Siefert

-Ursprngliche Nachricht-
Von: Jordan Elver [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 27. Mrz 2001 14:38
An: PHP Database Mailing List
Betreff: [PHP-DB] Structure Question


Hi,
I want to keep filenames of different kinds of media(real sudio, qt, mp3)
for
articles in a db table. Would it be best to store each kind of media in a
different table like one table for real audio, one for quicktime, one for
mp3. Or, would it better to store them all in the same table but with
another
table telling me what kind of file it is?

Like:

media table

id | name | filename | type_id

media types

type_id | name

Any ideas folks?

Cheers,

Jord

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]