Yes; for example, the quadratic equation
$$x^2-\sqrt{2}x=0$$
has two solutions, namely $x=0$ (which is rational) and $x=\sqrt{2}$ (which is irrational).
However, if we only allow rational coefficients for our quadratic equation, then it is true that either both solutions are rational or both are irrational. Given rational numbers $a$, $b$, and $c$, with $a\neq0$, the quadratic equation tells us that the solutions to $ax^2+bx+c=0$ are
$$x=\frac{-b+\sqrt{b^2-4ac}}{2a},\quad x=\frac{-b-\sqrt{b^2-4ac}}{2a}.$$
If $\sqrt{b^2-4ac}$ is irrational, then both of these numbers are irrational; if $\sqrt{b^2-4ac}$ is rational, then both of these numbers are rational.
This property is particular to quadratic equations only. For example, the cubic equation
$$x^3-2x=0$$
has the solutions $x=0$, $x=\sqrt{2}$, and $x=-\sqrt{2}$, the first of which is rational and the latter two of which are irrational, even though all of its coefficients are themselves rational numbers. The explanation for this is that a quadratic polynomial over the rational numbers must either factor completely or be irreducible, while a higher-degree polynomial can factor partially. For example, the factorization of $x^3-2x$ into irreducible rational polynomials is
$$x^3-2x=(x-0)\cdot(x^2-2).$$
The fundamental theorem of algebra states that every non-zero, single-variable, degree $n$ polynomial with complex coefficients has, counted with multiplicity, exactly $n$ roots.
By counting the multiplicity, we have this nicely stated theorem, which is useful for instance if you want to study the algebraic multiplicity of eigenspace.
Best Answer
The logic is that every positive number has two square roots, but zero only has one.
The quadratic equation comes from the algebraic process known as completing the square. Given an equation $ax^2 + bx + c = 0$, divide by $a$: $$ x^2 + \frac{b}{a}x + \frac{c}{a} = 0 $$ Then add $\left(\frac{b}{2a}\right)^2$ and to both sides: $$ x^2 + \frac{b}{a}x + \left(\frac{b}{2a}\right)^2 + \frac{c}{a} = \left(\frac{b}{2a}\right)^2 $$ Then subtract $\frac{c}{a}$: $$ x^2 + \frac{b}{a}x + \left(\frac{b}{2a}\right)^2 = \left(\frac{b}{2a}\right)^2 - \frac{c}{a} $$ The left-hand side is a perfect square (by design). We rearrange the right-hand side at the same time: $$ \left(x + \frac{b}{2a}\right)^2 = \frac{b^2-4ac}{4a^2} $$
At this point we would take the square root of both sides. Since the denominator is positive, the number of roots depends only on the numerator. If the numerator is positive, there are two roots. If the number is negative, there are zero (real) roots. If the numerator is zero there is only one.
Now you see why $b^2-4ac$ is called the discriminant of a quadratic equation. It detects the number of roots (or the type of roots if you allow complex ones). To finish up, we have $$ x+\frac{b}{2a} = \pm \frac{\sqrt{b^2-4ac}}{2a} $$ so $$ x = \frac{-b \pm \sqrt{b^2-4ac}}{2a} $$