Compounds are pure substances that are combinations of two or more elements. The most basic unit of a compound is the molecule, which is a combination of two or more atoms of different elements. Different elements have different properties, and hence, form different kinds of compounds.
Elements have a property called electronegativity, which is the tendency of an atom of an element in a compound to attract electrons towards its nucleus. A more electronegative atom will attract electrons more. Hence, depending on the electronegativity difference, some compounds may be polar, while others not. For instance, `H_2` is non-polar since there are identical elements. Also, the `C-O` bond is more polar than the `C-N` bond due to higher electronegativity difference.
At some point, the electronegativity difference is so large that ions are simply formed.
A molecular compound is formed by sharing of electrons. Depending on the electronegativity, molecular compounds are either polar or non-polar. These kinds of bonds are called covalent bonds. Due to the presence of an actual bond, bonds in a molecular compound are directional - towards the nuclei of the atoms. Meanwhile, when the electronegativity difference is so large that ions are formed, we get ionic bonds in ionic compounds. Ionic bonds are not actual bonds, but are coulombic interactions between two full negative and full positive charges. Unlike the directional bonds in molecular/covalent compounts, ionic bonds are non-directional, and hence instead of forming discrete molecules, they form crystal lattices. In solution, if dissolved, molecular compounds will exist as individual molecules. On the other hand, ionic compounds will not be molecules, but rather solvated and separated ions.