Sql Help

I have to do a table with foreign key, but i got mixed how they work. I’m familiar with primary but for other type of key i get lost. Can anyone help me or explain me when and how it does work. Or if you a good resource one internet, let me know.