Is music interval always a concept in terms of scales and do we always have to take the first note as tonic? What would be the interval between D note and E note in C major scale?
No. Intervals can be used whenever talking about the distance between two notes. They come up a lot when talking about scales, chords, and melody.
The first note described an interval is not always the tonic in fact I would say in most cases it's not how it would be described. It's just a point of reference and your last question shows why this is not the case. D to E is always a Major 2nd regardless of context. Whether you are looking at it in the C Major scale, a Dsus2 chord, or just encountering a D up to an E in a melody.
I think you're just asking about the NAMING of intervals? Yes, the name of a musical interval is absolute. It is derived from the number of letter names encompassed, and the relationship of the upper note to the major scale starting on the lower. D to E is a major 2nd - and the easiest way of confirming this is to think of a D major scale. And that's it, no matter whether the interval occurs as 1 to 2 in D major, 2 to 3 in C major or 7 to #1 in Eb major, it's still a major 2nd.
A similar question is sometimes asked about chords. "What notes are in D major chord when the tune's in the key of Bb minor?" Same answer. D major is D, F#, A - whatever key the piece is in. (It would be a pretty outside chromatic chord in Bb minor, but that's another matter!)
The confusing part with intervals is how they're named. It gives the impression that they could be related to major or minor scale notes. However, with intervals, major means bigger, and minor means smaller.
C>D is called M2, and so is D>E. They just happen to also be in C major scale. E>F, though, is only one semitone difference, so it's called m2.
Intervals always use the lower note as the starting point, and count up letter names initially. Then the number of semitones is taken into consideration. Thus - C>A. CDEFGA - 6 letter names, so it's a 6th. With 9 semitones between, it's called a major 6th (M6) If the note is Ab, the gap is smaller, so it's called minor 6th (m6). Make it Abb (that's not G) it's called diminished 6th. Make it A# (not Bb) and it's an even bigger gap, of 10 semitones, and it becomes augmented 6th (+6).
Note that 4ths and 5ths are generally perfect, and making the gap smaller gets them the title diminished; making the gap bigger, augmented.
It stands to reason then, that two same-sounding intervals can have two different names. C>Eb is a m3, but the same sounding C>D# (in 12tet) will be aug2.
We don't have to take the first/lower note as tonic, but I find it easier to calculate that way, regardless of what key the interval may be written in. That way, I know pretty quickly if it's major, minor or perfect. If not, then what's happened to put it 'out of key', imagining that the bottom note is the root of the key I'm thinking in. But others either just 'know', or calculate cold.
It appears to me that you're confusing two notions: internvals and degrees. This is a very common mistake.
An interval is the distance between 2 notes. It is not related to any scale. For example:
The distance between
E is a tone. It is also refered to as a major second.
The distance between
C is a semitone. It is also refered to as a mminor second.
The distance between
B is a tritone. It is also refered to as an augmented fourth.
Degrees are, on the other hand completely related to a scale! It is the relative position of the notes in the same scale.
For example, in a diatonic scale, we have:
I: tonic II: super tonic III: mediant IV: sub-domninant V: dominant VI: sub mediant VII: leading tone (in french: sensible)
The link between the two
Now that you make a clear distinction between these two notions, you can connect them super easily in terms of intervals between two degrees. For example:
The interval between the tonic and the mediant is a third.
The interval between the dominant and the sus-dominant is a second
And so on...
As has been pointed out an interval is the distance between two tones. It is hopefully clear that the interval between two tones is the same whether you start with the lower one going up or you start from the upper one going down.
There seems to be a confusion whether it is related to scales. The reason for that is probably because when you start learning about intervals and their names you usually start with a scale, C major, and then learn the intervals and their names in relation to the distance from C.
Later on you learn to recognize the intervals on their own completely independent of any scale. Music without scales, like atonal music, definitely has intervals.
An additional note:
At the same time you are learning to use the term "interval" on its own as mentioned above you are also continuing to use it in connection with scales and chords. Like a G7 chord. So that might be why some people could think that an interval starts from the lower note since in that case it does, but in principle it is just a distance between two notes.