The name of a compound tells you which elements it contains. When a compound is made of just two elements, its name usually ends in -ide. Sodium chloride, NaCl, contains only sodium and chlorine. Magnesium oxide, MgO, contains only magnesium and oxygen. The metal keeps its name and the non-metal changes its ending, so chlorine becomes chloride, oxygen becomes oxide and sulfur becomes sulfide. Hydroxides, such as sodium hydroxide, also end in -ide. This is an exception, because the hydroxide ion contains both oxygen and hydrogen.
When a compound contains oxygen joined to another non-metal in a group of atoms, its name usually ends in -ate. Copper sulfate, CuSO4, contains copper, sulfur and oxygen. Calcium carbonate, CaCO3, contains calcium, carbon and oxygen. Potassium nitrate, KNO3, contains potassium, nitrogen and oxygen. The ending tells you that oxygen is present, but only the formula tells you how many oxygen atoms there are.