Why does $\sqrt{-ab}=\sqrt{-a}\sqrt b$ hold, where $a,b\in\Bbb R$?
I know that splitting sqrts is not permissible for complex numbers generally, eg, $\sqrt{-1\cdot-1}\ne\sqrt{-1}\sqrt{-1}$.
Also, is $\sqrt{-a}$ unique or we can assign two values, one additive inverse of other?
Edit/Context: My question was based on the last paragraph of this example from Dummit and Foote, Abstract Algebra:
Here, even though $D=f^2D'$ be negative both sides, they have taken square root and concluded $\sqrt D=f\sqrt D$.

It doesn't. It holds if $a,b \ge 0$ and then then $\sqrt{-ab} = i\sqrt{ab}=i\sqrt{a}\sqrt{b}= \sqrt{-a}\sqrt{b}$. However if $a$ and $b$ are negative or complex more care needs to be given.
Note: if one of them is non-negative real, Say $b \ge 0$ then we can say that $\sqrt{-ab} = \sqrt{-a}\sqrt{b}$ whether $-a$ is positive of negative. However it must be that $b$ is non-negative.
Or if $-a$ is positive. Then $-a = u\ge 0$ and $\sqrt{-ab} = \sqrt{ub}=\sqrt{u}\sqrt{b}=\sqrt{-a}{b}$.
But $\sqrt{ab} = \sqrt{a}\sqrt{b}$ is only valid if one or the other is non-negative real. Otherwise.... well, care must be taken.
The last paragraph is to note that any rational $D$ can be uniquely expressed as $f^2*D'$ where $f$ is rational and $D'$ is a "square-free" integer. (I will admit the definition is a bit clunky.)
In other words if $D \in Q$ then $D = f^2D'$ and $\sqrt{D} =\sqrt{f^2D'} = f\sqrt{D'}$. This is acceptable because $f^2 > 0$.
Pf: $D = \pm \frac ab; a,b \in \mathbb Z; a\ge 0; b> 0; \gcd(a,b) = 1$.
Let $a = \prod p_i^{m_i}$ be the unique prime factorization of $a$ and let $b = \prod q_i^{n_i}$ be the unique prime factorization of $b$.
Now each $m_i$ and each $n_i$ is either odd or even. Let $m_i' = \frac {m_i}2$ if $m_i$ is even and let $m_i' = \frac {m_i - 1}2$ if $m_i$ is odd. (In other words let $m_i' = \lfloor \frac {m_i}2 \rfloor$. ) Likewise define $n_i'$ in the same ways so that $n_i' = \frac {n_i}2$ if $n_i$ is even and let $n_i' = \frac {n_i - 1}2$ if $n_i$ is odd.
Then $a = \prod p_i^{m_i} = \prod p_i^{2m_i'}\prod_{m_i\text{ is odd}} p_i = (\prod p_i^{m_i'})^2 *\prod_{m_i\text{ is odd}} p_i$. Let $e = \prod p_i^{m_i'}$ and $D_1 = \prod_{m_i\text{ is odd}} p_i$. Notice that $D_1$ is a prime free integer.
Likewise $b = \prod q_i^{n_i} = \prod q_i^{2n_i'}\prod_{n_i\text{ is odd}} q_i = (\prod q_i^{n_i'})^2 *\prod_{n_i\text{ is odd}} q_i$. Let $g = \prod q_i^{n_i'}$ and $D_2 = \prod_{n_i\text{ is odd}} q_i$.
So $D = \pm\frac ab = \frac {e^2D_1}{f^2D_2} = \pm\frac {e^2D_1D_2}{g^2D_2^2} = (\frac {e}{gD_2})^2(\pm D_1D_2)$.
Let $f=\frac {e}{gD_2}$ is a uniquely determined positive rational number and $D' = \pm D_1D_2$ is a square-free integer also uniquely determined.
As $D$ was not a square of a rational, it is not possible that $D' = 1$. But it is possible that $D' = -1$. But $D'$ is squarefree, an integer and possibly positive and possibly negative. But $f^2$ is a square (and therefore positive) of a rational number.