Many of the details of these two compounds are the same, but there are differences as well. For instance, ionic compounds are named by listing the positive and the negative ion, whereas covalent compounds require you to state the number and kind of each atom. It is not a simple matter to look at a chemical formula and state whether the compound is ionic or covalent.
Some elements are ionic in one case and covalent in another case.
The bottom line is simply that if you see a compound in which you recognize a positive and a negative ion, it is an ionic compound. Otherwise, it is a covalent compound. To make this recognition, you must have the list of ions in your head.