It's even simpler. The "starts with a vowel" rule is about pronunciation. The spelling is entirely orthogonal. If you pronounce "SQL" as "Ess-cue-ell", it's "an". If you pronounce it as "sequel", it's "a".
Aside: the reason "an" is also sometimes used for word starting with an "h" is that the "h" in those cases is silent and the pronounciation therefore starts with a vowel (following the silent "h"). There are some style guides that recommend using "an" for words where the "h" isn't silent (or "a" for words where it is) but they're just being intentionally obtrusive.
Aside: the reason "an" is also sometimes used for word starting with an "h" is that the "h" in those cases is silent and the pronounciation therefore starts with a vowel (following the silent "h"). There are some style guides that recommend using "an" for words where the "h" isn't silent (or "a" for words where it is) but they're just being intentionally obtrusive.