Re: Table Relationships
| From: | Joe Van Meer | Date: | Fri, 08 Feb 2002 23:35:44 +0000 |
| Subject: | Re: Table Relationships | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-16739@lists.php.net to get a copy of this message | ||
Hi there. You bet you can have relationships between tables! You accomplish
this by setting primary keys and foreign keys when you create you tables.
When you assign a unique identifier to a table not only do you assign a name
such as "employeeid" for example, you also have to set it as the primary
key. Here's a link to the mysql website:
http://www.mysql.com/doc/C/R/CREATE_TABLE.html
Notice the primary option
beside the auto_increment option, you'll no doubt need to use that as well
to ensure you create the proper relationships between entities.
Hope this helps you out, Joe:)
raf Al Shafaki <shafaki@softhome.net> wrote in message
news:20020208222240.12840.qmail@pb1.pair.com...
> In databases, after creating a number of tables, one could usually set
> relationships (or some call it relations) between these tables, by tying
> some reference number in one table with the id (or index) in another table
> for example, or just making any other kinds of relationships between
tables
> for any other reason.
>
> I used to do relationships between tables when I used Microsoft Access. My
> question is: Does MySQL enable you to create relationships between tables
> after you create the tables? If so, how (what are the commands from the
> command prompt?)
>
> --
>
> Ashraf Al Shafaki
> ICQ me at 144936414
>
>