Create an Algorithm, that translates human language into code
A simple approach would be just syntactic conversion, as done in precompilers/preprocessors.

A second step might be interpretation of some sort of controlled language where you allow more complex phrases, as long as they are not ambiguous.

A not very different, but data-driven, approach is represented by form-filling chat bots (couldn't quickly find a generic link, but plenty of examples in search results) where you aim to identify/locate the necessary bits to build what you expect to be your queries.

A more advanced approach that might give you some interesting ideas is this screenshot-to-HTML builder, based on recurrent neural networks, namely LSTM and GRU.

This could go further with named entity extraction, context interpretation, error-correction, and so on. The list continues infinitely.

The last, simply because, as many do, you have left out much of your problem definition implicit, which reminds me of our little friend Alice in Wonderland:

Alice: Would you tell me, please, which way I ought to go from here?
The Cheshire Cat: That depends a good deal on where you want to get to.
Alice: I don't much care where.
The Cheshire Cat: Then it doesn't much matter which way you go.
Alice: ...So long as I get somewhere.
The Cheshire Cat: Oh, you're sure to do that, if only you walk long enough.