Every table SHOULD have a primary key. A table may have more than one unique
key (also known as a candidate key) but only one can be marked as the
primary key. All unique keys have the same property - only one entry with
that value is allowed to exist on that table.
An index is a non-unique key. Any number of entries with the same value can
exist on the same table. A table can have any number (zero or more) of
these. You only create an index for performance reasons.
Take a look at [url]http://www.tonymarston.net/php-mysql/database-design.html[/url] for
some details on relational database design.
"Simon" <spambucketexample.com> wrote in message
> I am not 100% happy with my understanding of indexes and primary keys.
> I have a table with ID, Author and Text, (ID is auto increment)
> Most of the select I do is "SELECT * from Table where ID = someID"
> and then I with the result I do "SELECT Text, Author from Table where
> Author = someAuthor"
> It all works fine enough, (because I only have 400 records), but I don't
> have a primary key or an index.
> What primary key/index should I create?
> And where could I find a simple tutorial/help on primary keys and indexes
> to help me understand them once and for all.
> Many thanks