For the question:
How many years have you studied English?
does it mean studying English only or studying all courses in English?
You can learn English even without taking English courses. If I'm asked this, I'd include my time with and without courses. I think if you just answer "5 years", people would just think you've learnt English for 5 years, with or without courses. You an also explicitly say "I've been studying English for 5 years at school A" to talk about just that one school.