I have the following tables (simplified example):
countries: code_country (char-4) , name_contry)
breweries: code_brewery (int-4), name_brewery)
coasters (code_coaster (char-8), description, code_country,
code_brewery)
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