The following diagram illustrates the key signatures of all the major scales that contain a sharp.
The sharp key signatures can be summarized as follows.
There is one sharp in the key of G major.
There are two sharps in the key of D major.
There are three sharps in the key of A major and so on.
Notice as the number of sharps increase, each new key is a fifth higher than the last.
For example, C to G is a fifth
G to D is a fifth
D to A is a fifth and so on.
Also note that as the number of sharps increases, each new key contains all of the sharps from the previous keys. The additional sharp is always a semitone lower than the root note of the new key. For example, the key of B contains all the sharps of the previous keys (F#, C#, G#,D#),plus a new sharp A# (a semitone lower than B).
Here are the key signatures for all the major scales that contain a flat.
The flat key signatures can be summarized as follows.
As the number of flats increases, each new key is a 5th lower than the last.
For example, C to F is a fifth
F to Bb is a fifth
Bb to Eb is a fifth and so on.
As the number of flats increases, each new key contains all the flats of the previous keys and the additional flat is always a fifth lower than the last additional flat. For example, the key of Db contains all the flats in the key of Ab (Bb Eb Ab Db) plus an additional flat which is a 5th lower than Db - Gb.
All these major scales can be summarized in the following diagram known as the cycle of fifths.