Actually, plain sugar doesn’t stay in your mouth long enough to feed the bacteria that inhabit the film on your teeth. But foods such as dried fruits and many candies, which have sticky particles that slowly dissolve, will cause the bacteria to grow.
Your teeth are coated with a thin layer of material called plaque. This material is formed by bacteria in the mouth, which glue themselves to your teeth to avoid being swallowed.
The bacteria eat sugar. When they eat the sugar, they produce acids. The bacteria do not eat your teeth, but the acids do dissolve tooth material if they accumulate enough to raise the acidity levels enough. It takes the bacteria about 20 seconds to convert sugar into acid, and the acid stays trapped in the plaque next to the teeth for about a half hour.
Soft drinks with sugar are more of a problem than plain sugar alone. First, they contain sugar. Second, they contain a lot of sugar. Third, they are consumed over a long period, so the sugar is feeding the bacteria constantly. And lastly, they are more acidic than the acid the bacteria make from the sugar.
Sour candies are the same – they contain high levels of acid that are more harmful to the teeth than the sugar they contain.
It is not the amount of sugar that is important, but how often you eat sugar. If you only eat it at mealtimes, the acids will be gone half an hour later. But if you sip a soda or a sugared coffee all day long, you will have a bigger problem, since the acid will be next to your teeth for many hours at a time.