What is the best practise for relational database tables in mysql?
Posted
by George
on Stack Overflow
See other posts from Stack Overflow
or by George
Published on 2010-06-15T19:51:38Z
Indexed on
2010/06/15
19:52 UTC
Read the original article
Hit count: 117
Hi,
I know, there is a lot of info on mysql out there. But I was not really able to find an answer to this specific and actually simple question:
Let's say I have two tables:
USERS (with many fields, e.g. name, street, email, etc.) and GROUPS (also with many fields)
The relation is (I guess?) 1:n, that is ONE user can be a member of MANY groups.
What I dis, is create another table, named USERS_GROUPS_REL. This table has only two fields:
us_id (unique key of table USERS) and gr_id (unique key of table GROUPS)
In PHP I do a query with join.
Is this "best practice" or is there a better way?
Thankful for any hint!
© Stack Overflow or respective owner