Before worrying about 7’s and 9’s and whatnot, consider simple triads. This is probably easier understood with a piano than a guitar.
Triads, as you would suspect, have three notes. A major triad consists of the intervals of a major-third and then a minor-third. For example, the C-major triad is the notes C, E and G. From C to E is a major third, or four semitones. The notes C#, D and D# are in between. From E to G is a minor third, or three semitones. The notes F and F# are in between. (On a piano keyboard, you will notice that there is no black key between E and F. Thus the difference between E and F is a semitone, the same difference as between C and C#.) The interval from the root (or tonic), C, to the highest note, G, is a perfect fifth, or seven semitones.
C-major is called “major” because it sounds full, happy and complete. The notes also come directly from the C-major scale, C, D, E, F, G, A, B, C.
A minor triad is a major triad upside-down. It consists of a minor-third and then a major-third. The interval from the tonic to the highest note is still a perfect fifth. Thus, C-minor must have C and G. Moving the middle note down one semitone to E-flat gives us a minor third followed by a major third. A minor triad is minor because it sounds hollow or sad and somewhat dissonent. Notice also that the notes of a C-minor triad are taken directly from the C-minor scale, C, D, E-flat, F, G, A-flat, B-flat, C.
You may be wondering why these intervals seem not to be directly related to the number of semitones between things. Why does a perfect fifth have seven semitones, for example? The reason is because our modern tuning system with 12 notes per-octave is a compromise based on historical tuning systems which are a fascinating subject in their own right. But note that when we consider the subsets of eight-note major and minor scales, a fifth is formed by the first and fifth notes of the scale, not counting the notes outside the scale.
Similarly, a triad is always formed by the first, third and fifth notes in a scale. The first, third and fifth notes of a major scale give you a major triad and the same notes from a minor scale give you a minor triad.
Remember how both kinds of triads have a perfect fifth in them? What happens if we mess with that? Say we take C-major (C-E-G) and change it to C-E-G#. Now we have two major thirds. C to G# is an augmented fifth. This is a C-aug triad. Now say we mess with C-minor (C-Eflat-G) and change the G to G-flat. Now we have two minor thirds. This is a diminished triad, and the interval from C to G-flat is a diminished fifth.
So now you know all about triads. More complicated chords are constructed by adding notes to these four basic forms. (Usually.) A seventh chord adds the seventh note from the scale of the triad you started with. The notes for C-major come from the C-major scale, so C7 consists of C, E, G and B. The interval from C to B is a major seventh.
A suspended chord usually has the third replaced by a fourth. For example, C-major suspended would be C-F-G. A Csus7 would be C-F-G-B.
B9 is left as an exercise for the reader.
If you’re an engineer you will appreciate the mathematical relationships between scales, chords and tuning systems. But the topic is vast and requires lots of reading.
Here are some good books:
Tonal Harmony by Stefan Kostka and Dorothy Payne
Temperament: How Music Became a Battleground for the Great Minds of Western Civilization by Stuard Isacoff (This is a must-read for anyone who wonders where our seemingly arbitrary 12-note chromatic scale came from.)