My qeustion is that, is there any theorem like implicit function theorem in $\mathbb{Q}$ ?

More precisely, let $p(\bar{x},\bar{y})$ be in $\mathbb{Z}[\bar{x},\bar{y}]$ such that in $\mathbb{Q}$, for any $\bar{a}$, there is a solution of $p(\bar{x},\bar{a})$. Then for some polynomial(or rational polynomial) $q(\bar{y})$ with $\mathbb{Q}$ coefficients, $p(q(\bar{y}),\bar{y})=0$ holds in the rational polynomial fields over $\mathbb{Q}$.

For example, $x^2+y^2=1$ does not satisfy the condition but for $x+y=0$ it holds.

And how about the same question in p-adic field $\mathbb{Q}_{p}$?