Sugar is the main cause of dental decay when there are bacteria present. More significant than the amount of sugar you eat is the frequency of consumption.
Probably the worst thing you can do to your teeth is to drink a soda and have a sip every few minutes over a long period of time; the same is true for snacking. It is recommended that if you want to have a snack or soda or juice it is better to have it after food, as dessert, or have it in one sitting. Eating or drinking something sweet over an extended period of time creates a constant supply of sugar for bacteria that causes tooth decay!
It is important to be aware of all the sources of sugar that are out there. It is not just everything that is sweet, but anything that can turn to sugar like pieces of bread. Cutting down your sugar intake is good for cavity prevention, as well as your general health.
But what about when you have to have sugar? The best way to avoid cavities is to prevent the sugar from staying next to your teeth. Brushing after eating sugar, rinsing your mouth with Fluoride mouth wash, or chewing sugarless gum can help. However, nothing has the effect of avoiding sugar!
Is there any kind of food that prevents tooth decay? Well, not really. Some people believed that chewing foods like apples and carrots may have some plaque removal effect, but they still contain some sugar so any advantage is not clear.
Another group of food that causes significant damage to teeth structure is acidic foods. If in frequent contact with teeth, things like lime, lemon, and grapefruit can cause serious irreversible damage (erosion) to your teeth.