MacSQL maintains a query history for each document. This history is visible in the Query Drawer in the History folder.
You can scroll backwards through this history by selecting Next Query from the Query menu or by typing Command-Up Arrow. You can scroll forward by selecting Previous Query from the Query menu or by typing Command-Down Arrow.
The size of the query history is adjustable in the Settings Panel. The default behavior is to remember the last 10 queries that were made.