I\'ve read this SO question
I\'ve also executed the following help topics:
:h BufEnter
:h BufNewFile
:h BufLeave>
Colorschemes are global; their colors apply to all windows at the same time. Therefore, you can only create the illusion of different colorschemes per buffer / filetype / window, which will be shattered when you have different ones visible at the same time. If you don't use window splits or only ever have splits using the same colorscheme visible at the same time, your solution with :autocmd should work, though.
The BufLeave is the counterpart of BufEnter; the BufNewFile is just a special case for new buffers. All have the same *.sql pattern so that they undo each other. For example, when you move from your .vimrc, the BufEnter will execute. When you move back, the BufLeave will execute. For your .vimrc buffer, similar events will fire, but there's no action behind them, since you haven't defined similar autocmds for *.vim.
Note: If you want to extend your switching to more filetypes and colorschemes, this answer may be helpful.