Lets say we have an electron with known De Broglie wavelength $\lambda$. Can anyone justify or explain why we calculate its energy $E$ using 1st the De Broglie relation $\lambda = h/p$ to get momentum $p$ and 2nd using the invariant interval to calculate $E$:
\begin{align} p^2c^2 &= E^2 - {E_0}^2\\ E &= \sqrt{p^2c^2 + {E_0}^2} \end{align}
Why we are not alowed to do it like we do it for a photon:
\begin{align} E=h\nu = h\frac{c}{\lambda} \end{align}
These equations return different results.