RE: [PHP-DB] Child tables in MySQL

From: Date: Fri, 19 Jan 2001 06:00:26 +0000
Subject: RE: [PHP-DB] Child tables in MySQL
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-5971@lists.php.net to get a copy of this message
Lol, no problem. =) No, that is not the correct syntax. You might try something like this: Create table users( u_id integer auto_increment not null, u_handle varchar(25), u_email varchar(50), u_password varchar(25), primary key(users_id)); Create table users_prefs( up_u_id integer not null, up_invisible smallint, primary key(up_users_id)); Create table users_bookmarks( ub_u_id integer not null, ub_id integer not null auto_increment, ub_bookmark varchar(75), primary key(ub_u_id, ub_id)); keep your user info stuff in your user table, I can't see a need to make a seperate table for that info. Sean -----Original Message----- From: John Starkey [mailto:jstarkey@advancecreations.com] Sent: Friday, January 19, 2001 12:14 AM To: Alarion Cc: php-db@lists.php.net Subject: RE: [PHP-DB] Child tables in MySQL Forgive me.. newbie alert :} I'm trying to make a user homepage with prefs. But I've set it up for each user as a row. I think this may be a dumb question but I want a column to have an attached table per row. Is that possible? If not and I create a table for each user then I'm thinking of having a prefs table and a user_info table. Then from the prefs table have the user_bookmarks. So I tried: CREATE TABLE user_name.user_prefs.user_bookmarks ...... Is that the correct notation? TIA, John On Fri, 19 Jan 2001, Alarion wrote: > You should just be able to create a table like: > > User_Bookmarks > -------------------------- > UB_ID integer PK AI > UB_U_ID integer PK > UB_Bookmark > > (PK = Primary Key > AI = Auto_Increment) > > something like that, your Primary key will be the combination of the > Bookmark ID and the User ID. > > Sean > > -----Original Message----- > From: John Starkey [mailto:jstarkey@advancecreations.com] > Sent: Thursday, January 18, 2001 11:54 PM > To: php-db@lists.php.net > Subject: [PHP-DB] Child tables in MySQL > > > Can anyone tell me how to create child tables in MySQL? I'm creating User > Prefs and need to store bookmarks, and unlimited number. So adding columns > is out of the question. Any other suggestions? > > Thank in advance, > > John > > > > -- > 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 > -- 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

« previous php.db (#5971) next »