Where exactly did the phrase "hell on legs" come from?
Solution 1:
"X on legs" is a way of saying that someone or something is the personification of X. This means that they embody the nature of X, by being so extreme in their X-ness as to be identifiable with X itself.
For example, there's not just hell on legs, but sex on legs (a very attractive person), trouble on legs (a person who causes a lot of trouble), and so on. I think that you could say this for any quality X - it's not limited to just a few set phrases.
In "SQL is hell on legs", the hell is referring to a place or state of misery, torment, or wickedness (Merriam-Webster). So it is saying that SQL is so wretchedly awful as to have become the literal embodiment of woe.
In other uses of hell on legs, other qualities of hell may be invoked (it's somewhere you don't want to be, it's where wicked people go, it's generally ominous or threatening). The earliest use I can find is to describe a stove or furnace, presumably since hell is hot:
When my uncles were boys they used to sneak down from the arctic regions and dress in front of this ornate hell-on-legs.
(from Be it ever so humble by Dwight Farnham, 1942)
Our stove was a grate whose modest dimensions gave no token of an appetite so abnormal that Rushton declared it had a tape-worm. When well-fed it gave out too much heat, - became, in fact, as my chum complained, "a young hell on legs".
(from My college chums, a magazine article by Henry Augustin Beers from 1882, which is the earliest Google Books hit)