So you're here to learn about bonding. Well first you need to learn why atoms bond together. We figure most atoms want to be happy. The idea behind happy atoms is that atomic shells like to be full. If you are an atom, and you have a shell, you want your shell full.
Some atoms have too many electrons, one or two extra.
These atoms like to give up their electrons. Some atoms are really close to having a full shell. These atoms go around looking for other atoms who want to give up an electron. Anyway, you can see that Sodium and Magnesium have a couple of extra electrons. They, like all atoms, want to be happy.