aLess commonBut when it happens, it’s not easy to fix

The scene again

Select multiple SQL statements for execution

The specific error

[42000][1064] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select * from city c' at line 2
Copy the code

This problem has been bothering me for several days. Once I suspected the datagrip version bug, I chose to update the version, but the problem still exists! So in the occurrence of an hour and search fruitless after the choice of shelving, since can not be batch implementation, that one implementation! Today, I suddenly remembered that I had changed the shortcut key to execute SQL before, so I immediately located to the corresponding Settings in the picture below, and then the truth came to light.

In the figure, the “for Selection Execute” option is Exactly as one statement. If multiple SQL statements are selected under this option, they will be identified as one SQL statement.

The solution

Change the “for Selection execute” option to Exactly as statements