All depends on your set-up and your husbandry. Fish and inverts need plenty live rock to be able to hide, keeps the stress down on the fish hence happy fish that live longer. Second you get the whole micro biome with the rock.
Second is what you feed your fish. If you just go down the dry food fishstore crap don't expect them to live a long life. Supply them with what they eat in the ocean and again happy colourful fish that live longer. I make my own food and freeze it and feed macroalgae I grow. The colours on my fish are striking.
There are more factors like how long the lights are on... but I'd say most fish and inverts can live longer than we think if kept right.