Click to See Complete Forum and Search --> : Primary Key Question


Joseph Witchard
06-08-2008, 03:25 PM
What is it? What does it do, and what are its advantages?

NogDog
06-08-2008, 04:00 PM
A primary key field is one which uniquely identifies each row in a table. As such, each row's primary key field must have a unique value, and the DBMS will not allow two rows in the same table to have the same value in the primary key column. Typically the PK field is used to establish relationships between tables in query joins.

chazzy
06-08-2008, 04:12 PM
http://databases.about.com/cs/administration/g/primarykey.htm

oldcat
06-09-2008, 01:38 AM
A primary key is used to uniquely identify each row in a table. For example, applying the primary key to the ProdID column in the Product table ensures that no two products can have the same ProdID. A primary key in a table can be specified as the foreign key in another table to establish relationships between tables.

To see how to specify a primary key, see http://www.1keydata.com/sql/sql-primary-key.html.

Joseph Witchard
06-14-2008, 01:15 AM
Could someone show me an example of using a primary key and foreign key together? Where do you add a primary value in phpMyAdmin? Should you add a primary key to each column in your table (like, adding one to each username, user_id, and user_email fields in a message board table0?