Ionic équations are chemical equations that show oxidation and reduction of species. But they don’t include spectator ions, only species that loses or gains electrons.
For example in the reaction Mg(s) + ZnSO4 (aq) —-> MgSO4(aq) + Zn(s) Magneisum has lost two electrons (oxidation), and zinc has gained two electrons (reduction). Mg(s) -> Mg 2+(aq) +2e- and Zn(aq) 2+ + 2e- -> Zn(s)
The sulphate ion (SO42-) hasn’t changed charge, so it’s not included. So the overall ionic equation is Mg(s) + Zn 2+ (aq) —-> Mg 2+ (aq) + Zn(s)