What is a compound primary key?
There are atomic and compound primary keys used to quikly find the rows of a table you are looking for. This is more than just an idex - it helps find the one row you want like finding a needle in a haystack.
Atomic keys use only one column and can not be broken down - hence atomic.
Compound primary keys are made up of two or more columns from the same table. For performance reassons try to use the first columns and preferably have them close together.
A table can have more than one unique index but only 1 (one, uno) primary key.
You can not create a primary key that uses a column from another table.
So far no one has implimented functional primary keys where the primary key is the result of a function.
There are encrypted primary keys.
Why use a compound primary key? So you can take the key apart quickly or validate its pieces first. If you use telephone numner (555) 555-1234 as a primary key would it not be nice to know
1) the first part is a valid 3 digits area code and not 011 a country code?
2) that the next 3 digits are a valid exchange
3) that the last part is valid
By keeping the parts separate you can alos do fun quiries on "How many phones are in my exchange of 555 ? How many are in my area code? How often does my exchange or phone number apprear in other states?
This would be much harder to do if the primary key was stored as a single number 5555551234.