By a combination of optical second harmonic generation and transport measurements, we have investigated interfaces formed by either crystalline or amorphous thin films of LaAlO3 grown on TiO2-terminated SrTiO3(001) substrates. Our approach aims at disentangling the relative role of intrinsic and extrinsic doping mechanisms in the formation of the two-dimensional electron gas. The different nature of the two mechanisms is revealed when comparing the sample response variation as a function of temperature during annealing in air. However, before the thermal treatment, the two types of interfaces show almost the same intensity of the second harmonic signal, provided the overlayer thickness is the same. As we will show, the second harmonic signal is proportional to the depth of the potential well confining the charges at the interface. Therefore, our result demonstrates that this depth is about the same for the two different material systems. This conclusion supports the idea that the electronic properties of the two-dimensional electron gas are almost independent of the doping mechanism of the quantum well