Is it possible for a neural network to be used to compress data? When training a neural network, we often run into the issue of overfitting.

However, is it possible to put overfitting to use? Basically, my idea is, instead of storing a large dataset in a database, you can just train a neural network on the entire dataset until it overfits as much as possible, then retrieve data "stored" in the neural network like it's a hashing function.
The auto-encoder (AE) can be used to learn a compressed representation (a vectorised hash value) of each observation in the training dataset, $z$, which can then be used to later retrieve the original (or similar) observation.

The variational auto-encoder (VAE), a statistical variation of AE, can also be used to generate objects similar to the observations (or inputs) in the training set.

There are other data compressor models, for example, Helmholtz machine, which precedes both the AE and VAE.