Short exact sequences and prime numbers 
Let $p,q$ be prime numbers. Prove that there is a short exact sequence $0\to \mathbb{Z}_p\xrightarrow{f}\mathbb{Z}_{pq}\xrightarrow{g}\mathbb{Z}_q\to 0$ with $f$ being the map $x\mapsto qx$ and $g$ the identity map; prove that the former short exact sequence splits if and only if $p\neq q$.

Please tell me if this would be a satisfactory proof:
$(1)$ $f:\mathbb{Z}_p\to\mathbb{Z}_{pq}$  is defined by $f([x]_p)=[qx]_{pq}$. It must be shown that $f$ is injective: $f([x]_p)=f([y]_p)\iff [qx]_{pq} = [qy]_{pq} \iff x=y$.
$(2)$ $g:\mathbb{Z}_{pq}\to\mathbb{Z}_q$ by the natural projection $g([x]_{pq})=[x]_q$ which is onto.
$(3)$ And the last condition is $\operatorname{ker} g = f(\mathbb{Z}_p)$, which follows by definition since $\ker g$ is the set of multiples of $q$ in $\mathbb{Z}_{pq}$ which is the image of $f$.
I have two questions, first if what I did before is ok or is missing something; a second is regarding to prove that the s.e.q splits, how could I do that?
Maybe I can use the splitting lemma?, if I remember correctly the short exact sequence $0\to A \to B \to C$ splits if $A\bigoplus B = C$, and certaily $\mathbb{Z}_p\bigoplus \mathbb{Z}_q = \mathbb{Z}_{pq}$.
 A: To answer your first question, your workings are correct (though I wouldn't claim that $x = y$, as you seem to have taken $x,y \in \mathbb{Z}$ - better to say that if $qx \equiv qy \mod pq$, then $x \equiv y \mod p$. But this is being super picky).
Secondly, your memory that the sequence splitting implies that $A \bigoplus B = C$ is correct. The converse is not true, though, so this is only enough to prove that the sequence doesn't split for $p = q$ (since $\mathbb{Z}/p^2$ is not isomorphic to $\mathbb{Z}/p \times \mathbb{Z}/p$).
For the case $p\neq q$, we want a map $\phi: \mathbb{Z}/q \rightarrow \mathbb{Z}/pq$ such that the composition 
$$\mathbb{Z}/q \longrightarrow \mathbb{Z}/pq \longrightarrow \mathbb{Z}/q$$ 
is the identity. Any such map $\phi$  is determined by where you send $1$ mod $q$ (as this generates the group).
What are possible choices of $\phi(1)$? Well, for $\phi$ to be a homomorphism we need it to have order $q$ in $\mathbb{Z}/pq$, and the only way this is going to happen is if the projection $\phi(1) \mod p$ is zero (why?). We also need $\phi(1) \equiv 1 \mod q$, or this is not a map that will split the sequence. So we want to solve the congruences
$$\phi(1) \equiv 1 \mod q,$$
$$\phi(1) \equiv 0 \mod p.$$
Can you finish the proof from here?
