Why doesn't calcium carbonate dissolve in water even though it is an ionic compound?
As someone said here, this:


  The teacher stated that the ionic compounds dissolve in water except
  some carbonates.


Is indeed an oversimplification. First of all, the distinction between an "ionic compound" to other compounds isn't too defined. What your teacher probably said, or didn't say but wanted to, is that some ionic compounds easily dissolve in water. Salt (halite - NaCl) is the best example.

Calcium carbonate, in nature, also commonly dissolves. It's just not as immediate as dissolution of the more soluble ionic compounds. You are probably familiar with this phenomenon:



This forms because calcium carbonate dissolves. The rock is limestone, which is usually composed of pure calcium carbonate. Acidic water greatly enhances the solubility of calcium carbonate, and it doesn't even need to be highly acidic. Rain or river water that come into contact with the atmosphere absorb the $\ce{CO2}$ as $$\ce{H2O + CO2 &lt;=&gt; H2CO3},$$ which then facilitates calcium carbonate dissolution with $$\ce{CaCO3 + H2CO3 &lt;=&gt; Ca^2+ + 2HCO3-}.$$