  We analyze the interplay between charge-density-wave (CDW) and
pair-density-wave (PDW) orders within the spin-fermion model for the cuprates.
We specifically consider CDW order with transferred momenta $(\pm Q,0)$/$(0,\pm
Q)$, and PDW order with total momenta $(0,\pm Q)/(\pm Q,0)$. We show that both
emerge in the spin-fermion model near the onset of antiferromagnetism. We
further argue that the two orders are nearly degenerate due to an approximate
SU(2) particle-hole symmetry of the model. The ${\rm SU}(2)$ symmetry becomes
exact if one neglects the curvature of the Fermi surface in hot regions, in
which case ${\rm U}(1)$ CDW and PDW order parameters become components of an
SO(4)-symmetric PDW/CDW "super-vector". We develop a Ginzburg-Landau theory for
PDW/CDW order parameters and find two possible ground states: a "stripe" state,
and a "checkerboard" state. We show that the ${\rm SO}(4)$ symmetry between CDW
and PDW is broken by two effects. One is the inclusion of Fermi surface
curvature, which selects a PDW order immediately below the instability
temperature. Another is the overlap between different hot regions, which favors
CDW order at low temperatures. For the stripe state, we show that the
competition between the two effects gives rise to a first-order transition from
PDW to CDW inside the ordered state. We also argue that beyond mean-field
theory, the onset temperature for CDW order is additionally enhanced due to
feedback from a preemptive breaking of ${\mathbb Z}_2$ time-reversal symmetry.
We discuss the ground state properties of a pure PDW state and a pure CDW
state, and show that the PDW checkerboard state yields a vortex-anti-vortex
lattice. For the checkerboard state, we considered a situation when both CDW
and PDW orders are present at low $T$ and show that the presence of both
condensates induces a long sought chiral $s+id_{xy}$ superconductivity.
