Take the tour ×   Recall that, given two commutative rings $A$
and $B$, the set of morphisms of rings $A\to B$ is in bijection
with the set of morphisms of schemes
$\text{Spec}(B)\to\text{Spec}(A)$. Furthermore, we know that
Spec$(A)$ has a base of open affine subsets, the "basic" or
"principal" open affines $D(f)$ for all $f\in A$. Furthermore,
$D(f)\cong $Spec$(A)$ as schemes, and the inclusion
$D(f)\hookrightarrow\text{Spec}(A)$ corresponds to the
localization map $A\to A_f$.  But answers to a recent
MathOverflow question show that open affine subschemes of affine
schemes can arise in other ways.   In order to try to make sense
of the situation above, I'd like to know the following.  Given a
commutative ring $A$, is there a "ring-theoretic"
characterization of the ring homomorphisms $A\to B$ that realize
$\text{Spec}(B)$ as an open affine subscheme of $\text{Spec}(A)$
(more precisely, those morphisms such that the induced map
$\text{Spec}(B)\to\text{Spec}(A)$ is an open immersion)?  Of
course, "ring-theore