It is easy to create a bijection between two bounded open intervals of $\mathbb{R}$, such as:
$$ \begin{align} f : (a,b) &\to (\alpha,\beta) \\ x &\mapsto \alpha+(x-a)(\beta-\alpha). \end{align} $$
It is also possible to biject a bounded open interval of $\mathbb{R}$ onto the whole of $\mathbb{R}$, e.g.:
$$ \begin{align} f : (a,b) &\to \mathbb{R} \\ x &\mapsto \tanh^{-1} x. \end{align} $$
Consider now the set of rational numbers $\mathbb{Q}$. The bijection between two bounded open intervals still holds, but is it possible to biject: $$ f : (p,q) \to \mathbb{Q} $$
where $p,q\in\mathbb{Q}$ and $(p,q) = \{x\in \mathbb{Q} : p < x < q\}$?
The answer to this question: (Is there a bijection between $(0,1)$ and $\mathbb{R}$ that preserves rationality?) -- that is, $f(x) = \frac{1}{x} - 2$ for $(0,\frac{1}{2})$ and $f(x) = 2 - \frac{1}{x - 1}$ on $[\frac{1}{2},1)$ -- is a bijection from $(0,1)$ to $\Bbb R$ that preserves rationality; then $f|_{\Bbb Q}$ is a bijection from $(0,1)_{\Bbb Q}$ to $\mathbb{Q}$.
I'm not sure how this could be extended to general $(p,q)$, but this is an example of one function for one such interval.
EDIT: as Whacka has pointed out, simply by composing this function with a bijection from $(0,1)_{\Bbb Q}$ to $(p,q)_{\Bbb Q}$, this may be achieved. One such map is $x \mapsto (q-p)x + p$, whose inverse is $x \mapsto \frac{x - p}{q - p}$.
So in general, a bijection from $(p,q)_{\Bbb Q}$ to $\Bbb Q$ is:
$f(x) = \frac{q - p}{x - p} - 2,\;x \in (p, \frac{p+q}{2})$
$f(x) = 2 - \frac{q - p}{x - q},\;x \in [\frac{p+q}{2}, q)$