Ionic oxides of Na & Mg contain oxide ions (O2-). When they dissolve in water, O2- ions accept protons from H20 molecules to form hydroxide ions. Solutions both alkaline, but NaOH is more soluble in water, so it forms a more alkaline solution than Mg(OH)2.