Solve the following equation:

$$
x^{2}+x+\sqrt{x^{2}+x+7}=5 .
$$
Let's introduce a new variable. Let $y=x^{2}+x+7$; by transforming the equation, we get

$$
y+\sqrt{y}=12 \text {. }
$$

Rearranging and squaring the equation, we obtain

$$
y^{2}-25 y+144=0
$$

which is a quadratic equation.

The two roots of the equation are $y_{1}=16$ and $y_{2}=9$. Since the square root is positive, $y_{1}=16$ is not a solution, because

$$
16+\sqrt{16}>12
$$

The $y_{2}=9$ is a solution to the equation (1). Then

$$
x^{2}+x+7=9, \quad \text { hence } \quad x_{1}=-2, \quad x_{2}=1
$$