How does drinking water affect headaches and can it help alleviate them?

How does drinking water affect headaches and can it help alleviate them?