Treating a cavity depends on the development stage of the cavity.
Shallow Cavities
Composite fillings (similar to resins) are a perfect solution for this kind of cavities. They are visualy pleasant but only temporary (low strength and tightness). The plus is that no metal is present.
Deeper Cavities
At this stage, composite fillings and amalgams will not last very long. With time, both crack, the contact with the tooth loosens and becomes permeable to bacteria, creating opportunities for more cavities. Furthermore, they cannot protect the fragile wall. These filling must thus be regularly renewed, bigger and bigger, eventually requiring root canal work on the tooth and crowning. An inlay or onlay, on the other hand, made-to-fit in a laboratory, provides a more precise morphology, gives a better protection to the remaining tooth wall and saves the possibility to keep the tooth alive. Moreover, when it is made out of ceramics or resins, it looks like a natural tooth.
When the Cavity reached the nerve
When a tooth has had a root canal job, it is very fragile. Partly because its decay is important, and also because the dentin not being irrigated any more, the tooth is more easily breakable. Furthermore, the tooth tends to darken. Splitting of done root canal work teeth is, with the "receding of gums", the main cause of extraction. These teeth must be protected with a crown. In some cases, they are previously rebuilt, either by means of metallic forgeries-stubs (faux moignons, or by means of pivots. These new prostheses techniques allow to reproduce not only the natural color of the tooth, but also to preserve and potentially improve the initial shape.