Not sure about all of your suggestions. Let me see if I can clarify what you're looking for.
* simply decision if content should be stored in history or not,
Do you mean that the user should use a flag to place the result of a query into the history?
like:
--ans SELECT * FROM cities...
Not sure if that's what you mean, but it seems kind of unnecesary. They can just hit the \ans flag beforehand.
* simply remove last entry (table) of history
That could be useful. What do you think Maciej?
* queries should be joined to content, only name is not enough
Don't know what you mean. Could you try re-wording that?
Ian