Let $k$ be a field, $A$ be an integral domain, $B \subset A$, and $A, B$ are both finitely generated $k$ algebra. Let $p \subset B$ be a prime ideal. Suppose there exists prime ideals $q \subset A$, such that $q \cap B=p$, and $q$ is the minimal such ideal in the sense of inclusion. Then, is it true $ dim A\_q \leq dim B\_p$ ?


For the geometric meaning, it comes from the exercise of Chapter 2, 3.22(a) of Hartshorne, where: Let $ f: Spec(A) \to Spec(B) $ be a dominant morphism, $p \in Spec(B), Y'=$ {$ \bar{ p }$} (the closure of {$p$}) and $Z$ be an irreducible component of $f^{-1}(Y')$, whose generic point $q$ maps to $p$, then show that $ codim(Z,X) \leq codim(Y',Y)$.


I guess, everything translates faithfully to the above algebra fact except "$f$ dominant " is weakend by " $ B \to A$ is injective". 



Comparation of dimensions of rings
Dear Li, first of all I think that when you write "... such that $q \cap B=p$, and $q$ is *the* minimal such ideal in the sense of inclusion", you mean "... and $q$ is *a* minimal ideal...".


The answer to your question is given, I think, by the following more general result  

**Theorem** Let $\phi: B\to A$ be a morphism of noetherian rings and ${\frak q} \subset A$ a prime ideal with inverse image ${\frak p}\subset B$. Then we have the following formula 
$$dim A\_{\frak q}\leq dim B\_{\frak p} +dim (A\_{\frak q}\otimes\_B \kappa(\frak p)) $$


Notice that there is no mention of injectivity for $\phi$ , nor of a field nor of finite generation of $A$ or $B$.  

Now, if $\frak q$ happens to be to be -as in your case- the generic point of one of the irreducible components of the fibre at $\frak p$ of the morphism $Spec(\phi): Spec(A) \to Spec(B)$, then the local ring of the fiber at $\frak q$, namely $A\_{\frak q}/{\frak p}A\_{\frak q} = A\_{\frak q}\otimes\_B \kappa(\frak p)$, is zero-dimensional (see reminder below) and you get the formula you wished.


**Reminder** The local ring of the generic point of an irreducible scheme is a ring having only one prime ideal (its nilpotent radical) and thus has dimension zero. If the scheme is also reduced, the local ring of its generic point is a field.


**Bibliography**  

 Matsumura, *Commutative Algebra*, Theorem 19, page 79  

 Matsumura, *Commutative Ring Theory*, Theorem 15.1, page 116


**An example** In view of Li's comment it might be of interest to some users to see an example.  

Let $k$ be a field , $B=k[t]$ and $A=k[t,X,Y]/(t-XY)=k[t,x,y]$. Let $\phi:B\to A$ be the inclusion. Then the fibre of ${\frak p} =(t)\in Spec(B)$ is the subscheme 
$F=V(t) \subset Spec(A)$. Please note that, even though $A$ and $B$ are domains, the fibre has two irreducible components with generic points ${\frak q}=(t,x)$ and ${\frak q}'=(t,y)$. The potentially confusing fact is that to the "physical" point $Q={\frak q}$ (say) are associated *two* local ring. On the one hand the local ring of $Q$ in the scheme $Spec(A)$, which is $ \mathcal O\_{Spec(A), Q}=A\_{{\frak q}}$ $=A\_{(t,x)}$ . And on the other the local ring of $Q$ in the scheme $F$, which is $\mathcal O\_{F,Q}=A\_{{\frak q}}/tA\_{{\frak q}}=k(y)$, a field as expected.


