Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Which index to use - Primary key, Index, etc
July 20, 2005, 2:01 pm
rate this thread
countries: code_country (char-4) , name_contry)
breweries: code_brewery (int-4), name_brewery)
coasters (code_coaster (char-8), description, code_country,
code_coaster is formed by the combination from code_country + a
correlative number: for example CH-33, INDO-102, etc
How should I define the indexes so that the querries will be optimized?
I've thought about the following:
code_country: unique in table country
code_brewery: unique in table brewery
code_country: index in table coasters
code_brewery: index in table coasters
code_coaster: unique in table coasters
I don't really understand the difference between primary key and
unique. Should I use primary key instead of unique?
Thanks in advance
Re: Which index to use - Primary key, Index, etc
A primary key is, essentially, the first unique index. The distinction
is mostly for the programmer and automatic tools that diagram
relationships between tables.
How do you tell which of a pair of twins is the twin, and which one
is a real child?
Gordon L. Burditt