A comprehensive X-ray study of the Small Magellanic Cloud