Different chemical compounds, such as water (H2O) vs common table salt (sodium chloride, or NaCl) have different bonding types. Water is a polar covalent molecule, meaning that electrons are shared between hydrogen and oxygen, in an uneven manner (hence, polar). Since oxygen is more electronegative (has a higher strength of pull on an electron), electrons tend to stay closer to it than hydrogen. This type of bond is VERY stong.
Sodium chloride, on the other hand, has an ionic bond. This means that the sodium atom completely loses an electron, and the chloride ion takes it. The force that holds these two together is the attractive electronic force between the two. The main difference in this bond is that it is easily broken when placed in solvents such as water. The salt will dissolve as the sodium and chloride are separated from one another.