Primary and Foreign Keys

2005-06-15 Thread Asad Habib
Is it good practice to have a primary key for a table even though the table has a foreign key that is the primary key of another table? If so, why is this the case? I would appreciate if you point me to some resources that point out the advantages and disadvantages of both approaches. Thank you.

Primary and Foreign Keys (Follow Up)

2005-06-15 Thread Asad Habib
As a follow up to my question, I did want to mention that the foreign key I am using is unique. - Asad -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Primary and Foreign Keys (Follow Up)

2005-06-15 Thread Stefan Kuhn
If your FK really is unique, you don't need two tables. Example First table Second Table ID FK 1 1 2 2 3 3 ... So you can make this one table. On other words, it would be a one-to-one relation. And this would be one table. Only with a

Re: Primary and Foreign Keys (Follow Up)

2005-06-15 Thread Asad Habib
Hello. I appreciate your input. To clarify, I will provide you with an example: I have a table called business and another one called food_business. The field business_id is a primary key of table business and a foreign key of table food_business. In this case, the foreign key is unique and

RE: Primary and Foreign Keys (Follow Up)

2005-06-15 Thread George Sexton
@lists.mysql.com Subject: Re: Primary and Foreign Keys (Follow Up) Hello. I appreciate your input. To clarify, I will provide you with an example: I have a table called business and another one called food_business. The field business_id is a primary key of table business and a foreign key of table

Creating primary and foreign keys for MySQL

2004-10-13 Thread Herman Scheepers
Hi All I am MySQL newby with an Oracle background. Is the following syntax suported? alter table members add primary key (id); alter table members add constraint members_uk unique (name); Thanx Herman __ Do you Yahoo!? Yahoo! Mail Address

Re: Creating primary and foreign keys for MySQL

2004-10-13 Thread SGreen
You haven't found the online manual yet, have you? http://dev.mysql.com/doc/mysql/en/index.html Specifically the documentation for the command you are curious about is found here: http://dev.mysql.com/doc/mysql/en/ALTER_TABLE.html Shawn Green Database Administrator Unimin Corporation - Spruce

Primary and Foreign Keys in MySQL

2002-07-24 Thread Aamer Rauf
Hello, I am working on MySQL database. I have come across a 'problem' but don't know how to get around that. The problem is the following: I have a table, say TABLE1, with primary key being called as table1_id. Now there are other tables, like TABLE1A, TABLE1B, TABLE1C etc.. where I want to

RE: Primary and Foreign Keys in MySQL

2002-07-24 Thread Jon Frisby
- From: Aamer Rauf [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 24, 2002 12:55 PM To: [EMAIL PROTECTED] Subject: Primary and Foreign Keys in MySQL Hello, I am working on MySQL database. I have come across a 'problem' but don't know how to get around that. The problem