TITLE: Subset of Spec(A) realized as inverse image of some Spec(B)
QUESTION [5 upvotes]: Let $A$ be a (commutative) ring and $U$ be an arbitrary subset of $\mathrm{Spec}(A)$. Do there exist a ring $B$ and a ring homomorphism $\varphi\colon A\to B$ such that $\varphi^{-1}(\mathrm{Spec}(B))=U$ ? If $\varphi\colon A\to B$ and $\varphi'\colon A\to B'$ are two ring homomorpisms such that $\varphi^{-1}(\mathrm{Spec}(B))=\varphi'^{-1}(\mathrm{Spec}(B'))=U$, do there exist a ring homomorpism $f\colon B\to B'$ such that $f\varphi=\varphi'$ ?

REPLY [3 votes]: There are already two nice counterexamples. Let me just point out for question (1) a characterization of images of $\mathrm{Spec}(B)$ in $X:=\mathrm{Spec}(A)$: 

A subset $U$ of $X$ is the image of some $\mathrm{Spec}(B)\to X$ if and only if $U$ is pro-constructible. 

See EGA IV.1.9.5. In a noetherian space, $U$ is pro-constructible if it is an arbitrary intersection of constructible subsets (i.e. finite unions of locally closed subsets) of $X$.  A constructible subset of $\mathrm{Spec}(\mathbb Z)$ (or any irreducible noetherian scheme of dimension $1$) is either finite or contains the generic point, so a pro-constructible subset is either finite or contains the generic point. This "explains" the example of Laurent.