Generally they are built with a very sensitive microphone inside and they are calibrated so as to capt sound pressure with a response that mimes that of a human ear.
Seeing that dB's produce perception of sound quantities by the human ear, the dB unit also expresses a series of electical quantities on a practical level.