Re: Child tables in MySQL
| From: | JJeffman | Date: | Mon, 22 Jan 2001 13:56:10 +0000 |
| Subject: | Re: Child tables in MySQL | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-6029@lists.php.net to get a copy of this message | ||
I think "Preferences" may be a child table which has all users preferences :
Preference
============
PREFERENCE (integer unsigned not null primary key auto_increment)
SUBJECT (char(20) not null)
USERCHOICE (set {"choice1","choice2",..."choiceN"} not null)
USERID (foreign key, use the definition from user's table )
This way you can store all user's preferences .
$query = "select USERCHOICE from Preference where USERID = $user" ;
This query gets the preferences from a defined user.
HTH.
Jayme.
http://www.conex.com.br/jjeffman
-----Mensagem Original-----
De: Darryl Friesen <Darryl.Friesen@usask.ca>
Para: <php-db@lists.php.net>
Enviada em: sexta-feira, 19 de janeiro de 2001 19:27
Assunto: Re: [PHP-DB] Child tables in MySQL
>
>
> > How about creating a separate table for each user and a column in the
> > main table pointing to these user preference tables
>
> I missed the first part of this thread, so forgive me if I'm missing
> something, but that seems like a very bad idea.
>
> What if 10,000 people sign up (for whatever this service is)? Do you
really
> want 10,000 tables in your database? Is it not possible to have a single
> table for users (one row per user) with preferences in that same table
> (perhaps encoded somehow to save space)? Or a table for users, one for
the
> different preference options, and third to join them?
>
>
> - Darryl
>
> ----------------------------------------------------------------------
> Darryl Friesen, B.Sc., Programmer/Analyst Darryl.Friesen@usask.ca
> Education & Research Technology Services,
> http://gollum.usask.ca/
> Department of Computing Services,
> University of Saskatchewan
> ----------------------------------------------------------------------
> "Go not to the Elves for counsel, for they will say both no and yes"
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>