Water is a polar solvent, meaning it has partial opposite charges at each end of each molecule, and so ionic substances, in which each particle is charged, and other polar substances dissolve best in water. However, to dissolve a substance, the attraction of the solvent for particles of the solute must be greater than the forces holding the solute together, so many ionic substances are not soluble in water.
Two common examples of substances that dissolve in water are table salt, sodium chloride, and the common sugar sucrose. Despite their similar appearance, the two substances are very different in both composition and their inter-particle forces, with salt composed entirely of sodium and chloride ions ionically bonded to one another, and sucrose a covalent compound composed of carbon, oxygen and hydrogen, held together by the polar nature of the molecules. In both cases, the polar attraction of water molecules exceeds the inter-particle forces of the solids, and so individual particles are pulled into the solution.
It is not only solids that are soluble in water, however. Both liquids and gases can also be soluble. In these cases, solubility still depends on the polar nature of each molecule of gas. Polar gases such as ammonia are very soluble, while non-polar gases such as nitrogen are much less soluble.