Stocking an aquarium requires some thought.
I'll just run over some of the main points.
Water parameters. The GH, KH and pH of the source water (presumably tap water). Some fish have preferences, some are somewhat more adaptable, but there are limits in all species. Selecting fish suited to your water makes life much easier, is less expensive, and the fish will be healthier if they have suitable water. Temperature is another water parameter, and some fish need higher or lower temps.
Tank size. Some fish need to be in groups, some may need a special harem or pair relationship, some need to be on their own (thinking species here).
Tank aquascape. This can be crucial for many fish. Some have special needs, like chunks of wood, or rock caves (whether real or fake doesn't usually matter). Some need dim lighting, so floating plants of less overhead light. Some need a water current, some the opposite (the filter matters here).
Compatibility. The last thing to consider, because if any of the afore-mentioned needs have not been met, compatibility won't matter much as the fish will be weakened and in poor health from the start. But not all fish get along with all other fish.