# When can we say that this inequality holds?

There exists $C \geqslant 0$ such that $$\sqrt{ \int |g|^2} \leqslant C \int |g|$$

When this inequality holds?

-

If you take $g(x) = 1$ for $x$ in a set of measure $\epsilon$, $0$ everywhere else, the left side is $\sqrt{\epsilon}$ and the right side is $C\epsilon$, so the inequality is false in any measure space that has sets of arbitrarily small positive measure, unless you restrict $g$ somehow.
You are asking when $L^1 \subset L^2$ with continuous embedding. This fails whenever you consider Lebesgue's measure on a bounded domain (of a domain with finite measure), since otherwise $L^1$ and $L^2$ would be isomorphic Banach spaces.