sugar is soluble in water because it is a polar molecule. water is also a polar molecule... a simple way to remember if a solute will dissolve in a solvent is "like dissolves like" so polar water...
Sodium Chloride is an ionic compound and ha a high hydration energy. Hence, it is highly soluble in polar solvents like water, But it is not very soluble in gasoline since gasoline is a non-polar...