I think you are thinking of goldfish, as people often say that goldfish have only a three-second memory span, but it’s a myth! I’m not sure where the idea that fish have very short memory originally came from, but scientists have done experiments with goldfish to show that they can learn and change their behaviour based on previous experience, so they must have a long-term memory to be able to do that. For example, they can be trained to find their way out of a maze, or to swim into a dark area of a tank to avoid an electric shock that they will receive if they stay in the light.
Almost 50 years ago, scientists did experiments on goldfish that showed that they have two types of memory: short term memory that means that they improve on a task when it is repeated many times in the same day, and long term memory that helps them to do the same task again a few days later. For long term memories to form, genes have to be activated and proteins made.
Humans and other mammals, birds and reptiles also have both short and long term memory, and more recent work has suggested that there is an area of the fish brain (called the lateral telencephalic pallium) that functions in a similar way to our hippocampus, which is a region of our brains associated with forming long-term memories.
Ah! A classic science question!
Well, sadly (though not so sadly for the fish!), it turns out that the ‘1 second memory’ fact is a bit of a myth. It turns out that people were just using the wrong way of testing them. In fact fish are very capable of learning and lots of studies now are using zebrafish (small, stripey tropical fish, you might have seen them in the pet shop?) in psychology and memory experiments as they’re pretty bright little things!