Do you know this scenario: you are writing down a stored procedure but you can’t for the life of you remember the exact syntax of that CASE statement? Has it to end with CASE or not? Can I use more than one WHEN part and how should that be written? Usually you end up opening a web page and read through the excellent MySQL online docs. However, this might cost too much time if you quickly need different statements and other detail info. Here’s where MySQL Workbench’s context help jumps in.
The server can help
It’s probably only known to the die-hard terminal operators who write most of their SQL queries in a MySQL console window: the MySQL server already has a stripped down set of help topics produced by the Docs team. That means you can always get at least the syntax but often far more information for a particular syntax element when you work with a server. When you install a MySQL server it usually comes with loaded help tables. For those experimenting with pre-releases of the server you can download scripts to fill your help tables.
MySQL Workbench makes use of this little gem. The query at the current caret position is examined to find a help topic. If one could be found it is shown in the Context Help side bar.
But wait, isn’t the output of the help topic in the command line client rather simple? Yes, that’s how it looks:
But it still is the same data as shown in the sidebar. With some reformatting MySQL Workbench presents a much better readable version of that text. And not only that. URLs are displayed as clickable links. Selecting a link to another topic simply switches to that in the sidebar. External documentation is shown in a separate browser tab. So what you actually get is both: the quick lookup while typing and direct access to the online help with the extended info for that topic. This will often save you from doing an explicit online search. Pretty cool, hu? But there’s more.
To the point
Writing a complex query can easily cover 2-3 pages and when you’re down in that dreaded JOIN part you certainly don’t want the help for the SELECT statement. And MySQL Workbench can deliver that. It looks at the word at the current caret position (math operators qualify too) and if that doesn’t have a topic to show the next inner part is examined (e.g. a subselect or a JOIN). So you get help as close as possible for your current work position.
Determining a topic is complicated, especially if your query is in a half finished state, so it might not always give you the wanted info, however. But we will improve that feature over time.