Taking a fish out of the ocean and putting it into a closed system, such as a home aquarium, greatly reduces a fish's ability to flee or hide from predation. At the same time, it also increases the competition for whatever food is available.
The chart above will give you an idea of which fish can and can not "normally" exist together in a closed space. In many cases it also indicates which will coexist with a certain amount of caution. Nothing is guaranteed. There will always be exceptions to any generalization, but the chart will give you a place to start when you are trying to figure out what will work in your aquarium.
For more information about a specific species, refer to their profile information.