In the category of schemes, the equalizer of two morphisms $f,g : X \to Y$ is always a locally closed immersion into $X$ (since this is just $X \times_{Y \times Y} Y$ and $\Delta : Y \to Y \times Y$ is a locally closed immersion). What about the converse, is every locally closed immersion some equalizer? In other words, is every locally closed subscheme the locus where two maps agree?

Certaily every open immersion $U \to X$ is an equalizer, namely of the two maps $X \to X \cup_U X$. For closed immersions $Z \to X$, a similar construction works: The pushout $X \cup_Z X$ exists also in this case, see here, and is constructed locally, so that it is enough to remark that $A \to A/I$ is the coequalizer of the two maps $A \times_{A/I} A \to A$ in the category of rings. I general we have a composition of a closed immersion followed by an open immersion, but I'm not sure if we can do the same construction.