Re: uniq key and primary key, how they are diffrent?
From: Lew Pitcher (Lew.Pitcher_at_td.com)
Date: 03/25/04
- Next message: Rod Smith: "Re: Avoid Xandros 2.0"
- Previous message: Michael Heiming: "Re: anti-spam and anti -virus solution base on Linux?"
- In reply to: somez72: "uniq key and primary key, how they are diffrent?"
- Next in thread: Christopher Browne: "Re: uniq key and primary key, how they are diffrent?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 25 Mar 2004 12:52:32 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
somez72 wrote:
| Hello.
| could someone tell me ; In mysql, uniq key and primary key, how they
| are diffrent?
Primary keys are unique keys.
Unique keys can either be primary keys or foreign keys.
Primary keys are keys to the table you are addressing.
Foreign keys are keys to other tables that the the current table can reference.
Think of a contact list app, which implements two tables: a table of persons
(name, phone#, etc.), and a table of businesses (name, address, etc.). Each row
in the person table can (should) have a unique key (it's primary key) that can
be used to distinguish one row from all others. Each row in the business table
should likewise have a unique key, again to distinguish one row from all others.
If a person works at a company, the row in the person table for that person
would also contain the key for the company s/he works for. This key is unique
(it's the unique primary key of the company table entry for the company that the
person works for), but it is not the primary key in the person table. Instead,
it's a "foreign key" in the person table, referencing the company table.
So, unique keys are keys. Primary keys are unique keys. Foreign keys are unique
keys.
- --
Lew Pitcher
IT Consultant, Enterprise Application Architecture,
Enterprise Technology Solutions, TD Bank Financial Group
(Opinions expressed are my own, not my employers')
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
iD8DBQFAYxxeagVFX4UWr64RAtxoAKCYUYzI2anWTzM7TfmY2DbBC2I77wCguMbS
jHcmD0qTjTLA8DGqTPrw/4E=
=vDxy
-----END PGP SIGNATURE-----
- Next message: Rod Smith: "Re: Avoid Xandros 2.0"
- Previous message: Michael Heiming: "Re: anti-spam and anti -virus solution base on Linux?"
- In reply to: somez72: "uniq key and primary key, how they are diffrent?"
- Next in thread: Christopher Browne: "Re: uniq key and primary key, how they are diffrent?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|