if someone says a song is in a certain key, say G, does that mean that all the notes in the song are from the G major scale? (except ofcourse those out of key put in there on purpose)

Or does it simply mean that the tonal center of the song is G, and playing anything in the key of G (G pentatonic, major, minor, dorian whatever) stays in key with the song?

and, if the case is so that if a song is in G major i have to only play G major, what if I wanna add a sad sounding solo/chord progression? how do i do that? can we switch keys mid songs? like from G major to G minor?

finally, the song welcome to the jungle. i think right after the breakdown, slash hits 6 powerchords only one fret apart . how is that in any scale? why doesnt it sound out of key?

i have looked but if you know of any lesson that answers these questions, a link would suffice.

thanks in advance.
it means that all the notes in the song are in the G major scale, so yes.
but obviously sometimes you play notes that arent in the scale to creat alot of tension.
like for example, instead of playing the G major scale, play the E harmonic minor scale.
only 1 note different, and still sounds pretty damn cool.
(the difference is that the E harmonic minor has a D sharp instead of a D.)
my 6 best friends:
Ibanez Artcore AF75
Schecter C-1 Hellraiser
LTD H-207 7 string
Ibanez Acoustic
Remember, there is absolutely no rules to music, when writing, you can do whatever you want, change keys, tempo, not even use a key, and no one can say what you are doing is wrong.

And with the key thing, it just means the tonal centre is G I think.
Pretty much yeah. If someone just says you're in the key of G, it means G is the tonal centre, and if they don't specify anything beyond that then it's safe to assume they mean major. But usually they'll say key of G and then what scale, so G Major, G Minor, G Phrygian, whatever.

As for changing keys mid-song, yes you can do that, you can do whatever the heck you like as long as it sounds good. Theory isn't a bunch of rules that you have to follow, it's a bunch of rules and guidelines that if you follow them will usually make your music sound good, but it's also ok to break the rules as long as it sounds good.

As for the power-chords that Slash plays, he's just playing a chromatic run of power-chords. Again, it's not really following any scale, but what the hey, if it sounds good do it.
sig goes here
ya i understand all and i am not restricting myself to anything, i just want to understand keys.

ok E aeolian has the same notes as G major. but if the key of the song is G major, and all the instruments playing are playing stuff from the G major, then wont the E aeolian just sound "incomplete"? i mean its the same notes, but instead of ending a phrase i want sounding complete with a G i would end it with an E, but the song is going in G so i didnt really get the sound i want, and my phrase sounds incomplete, waiting for a G. isnt that whats gonna happen? am i making sense? lol

ummm i read about axis theory, so if i wanna apply that to any song, say i want a sad sounding section in a G major song. i just start playing a Min7, Min9, Min11? and solo on top of that with G aeolian? is that staying in key?
^ that's called changing to the Parallel Minor (G major -> G minor). It can definately create a sad sounding section, and it IS a key change. Similarly, it's very easy to change to Em by playing a Bm (that's in G major) then B7 (dominant of Em) then Em.

If you're playing "E aeolian" over a G tonic, then it'll want to resolve to G, you're entirely correct. That's why calling it "E" anything is incorrect.