newbie question database tables
am 10.09.2010 18:08:45 von Patrice Olivier-Wilson
I'm working on a database that needs to do a few things and getting
brain freeze on one part.
Scenario:
I want to compile a db of articles with these tables:
Categories
Topics
Users
Categories
cat_ID | cat_name
Topics
top_ID | top_name | top_content | cat_ID
Users
user_ID | user_name | top_ID
or
user_ID | user_name | top_ID | top_IDb | top_IDc etc....
(output to web page using php)
But I need to show which users are using which topics, and I can add
top_ID to the user file, which is fine if they are only using one topic.
I could add 5 different topic to each user, but then I couldn't expand
later.
Reverse is true if I add user_ID to the Topics.
So, need an idea how to solve this so it doesn't matter how many new
users I keep adding, I can still see who is using the topics.
As I said, a newbie question. Thanks much.
--
Patrice Olivier-Wilson
http://biz-comm.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org
RE: newbie question database tables
am 10.09.2010 18:31:11 von Jerry Schwartz
Regards,
Jerry Schwartz
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032
860.674.8796 / FAX: 860.674.8341
E-mail: jerry@gii.co.jp
Web site: www.the-infoshop.com
>-----Original Message-----
>From: Patrice Olivier-Wilson [mailto:biz@biz-comm.com]
>Sent: Friday, September 10, 2010 12:09 PM
>To: mysql@lists.mysql.com
>Subject: newbie question database tables
>
>I'm working on a database that needs to do a few things and getting
>brain freeze on one part.
>
>Scenario:
>
>
>I want to compile a db of articles with these tables:
>
>Categories
>Topics
>Users
>
>Categories
>
>
>cat_ID | cat_name
>
>
>Topics
>
>top_ID | top_name | top_content | cat_ID
>
>
>Users
>
>user_ID | user_name | top_ID
>or
>user_ID | user_name | top_ID | top_IDb | top_IDc etc....
>
>(output to web page using php)
>
>But I need to show which users are using which topics, and I can add
>top_ID to the user file, which is fine if they are only using one topic.
>
[JS] What you need is another table, users_topic:
users_topics: user_ID | top_ID
and get rid of the top_ID field from the users table.
That's the general technique to use when you need a cross-reference.
>I could add 5 different topic to each user, but then I couldn't expand
>later.
>
>Reverse is true if I add user_ID to the Topics.
>
>So, need an idea how to solve this so it doesn't matter how many new
>users I keep adding, I can still see who is using the topics.
>
>As I said, a newbie question. Thanks much.
>--
>Patrice Olivier-Wilson
>http://biz-comm.com
>
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe: http://lists.mysql.com/mysql?unsub=jerry@gii.co.jp
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org
Re: newbie question database tables
am 10.09.2010 18:36:44 von Patrice Olivier-Wilson
On 9/10/10 12:31 PM, Jerry Schwartz wrote:
> Regards,
>
> Jerry Schwartz
> Global Information Incorporated
> 195 Farmington Ave.
> Farmington, CT 06032
>
> 860.674.8796 / FAX: 860.674.8341
> E-mail: jerry@gii.co.jp
> Web site: www.the-infoshop.com
>
Thank you!
--
Patrice Olivier-Wilson
http://biz-comm.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org