Bacteria are classified based on their nutritional needs into two main categories: autotrophs, which produce their own food from inorganic sources, and heterotrophs, which rely on organic compounds for nutrition. Autotrophs can be further divided into photoautotrophs that use sunlight and chemoautotrophs that utilize inorganic substances. Heterotrophs include photoheterotrophs that use light for energy but require organic compounds for carbon, and chemoheterotrophs that derive both energy and carbon from organic compounds.