Both primary key and unique key enforces uniqueness of the column on which they are defined.
- primary key creates a clustered index on the column
- unique creates a nonclustered index by default
- primary key doesn't allow NULLs
- but unique key allows one NULL only.
- you can have multiple unique keys in a table
- can have only one Primary Key
A foreign key is a column (the child collumn) in a table which has a corresponding relationship and a dependency on another collumn (the parent collumn) that is usually in a different table.