Often they divert the river. For example when the Hoover dam was build the first step was to create an artifical tunnel through the rock to divert the Colorado River. That left the dam sight dry allowing construction. When the dam was completed they sealed up the diversion and the resivoir behind the dam filled.
Check out this short (https://www.youtube.com/watch?v=n9Gy_1Ppw5U) on the Hoover Dam’s construction.
One thing to remember is that the lake behind a dam was not there before the dam. In other words – it’s a river that you are diverting, not a massive lake. Still a massive job as the Hoover video showed, but more doable than say 200 ft of water depth and pressure.
Latest Answers