Even small neighborhood markets stock more than one type of onion, and a good produce market sells several: yellow, red, white, and in season, sweet varieties like Vidalias and Walla Wallas. Which type you should buy depends on what you're planning to cook, BrainFoodie explains on Chowhound.
The hardest of the onion varieties, best for long simmering in soups and stews. Yellow onions have a complex flavor, and a firm texture that can survive long cooking. They keep well, as long as you store them in a cool, dark place.
Good for cooked dishes, eating raw in salads, or pickling.
Common in Mexican cooking for salsas, tingas and other stewed dishes, and soups.
These are mild, a good choice for eating raw in salads and sandwiches, but they break down quickly when cooked. The higher water content causes these to spoil pretty fast—they'll keep longer in the fridge.
When serving any type of onion raw, rinse the slices in cold water to remove some of the bite, Karl S says. And chilling an onion before slicing will keep the tears at bay.
To explore the gamut of onions out there, check out Saveur's guide to 33 types.