All we need is an easy explanation of the problem, so here it is.
WHERE order_date >= ‘2019-01-01’;
— AND operator
WHERE birth_date > ‘1990-01-01’ AND points > 1000;
— OR operator
WHERE birth_date > ‘1990-01-01’OR points > 1000 AND state = ‘VA’;
— NOT operator
— Exercise: FROM order_items table get the items
— for order #6
— where total price is greater than 30
WHERE order_id = 6
AND quantity * unit_price >= 30;
When I first began using MYSQL, I would run a query and only the last SELECT statement would run and the results would show in the result tab. The ACTION OUTPUT would show the time-stamp which clearly indicated only the last SELECT statement in the editor was run.
Now, all queries ending with a semi-colon are running simultaneously and each appears on its own tab and in the ACTION OUTPUT section on the bottom (i.e., “orders43”, “customers44”, “customers45” and so on.)
The only way I can get the most recent result is by highlighting the specific SELECT statement and running the query. However, I want to know why the results aren’t just “overriding” each other and the most recent SELECT statement being the results displayed in the same result tab…
At this rate, I’ll have hundreds of result tabs for each query ending with a semi-colon, and this is clearly not what I want nor was it how the workbench was working for me up until recently.
I am not sure why this is occurring, or how to stop it.
Any help would be greatly appreciated.
How to solve :
I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.
You have actually 3 possibilities to run the queries:
- Run everything that’s in the editor. This is like running an external script. Workbench opens a result tab for each statement that returns a result set. Use the flash icon or
cmd/ctrl+shift+enterto execute (
cmdon macOS, otherwise
- Select a single statement or multiple statements and press the same shortcut as in point 1. This will only run the selected code. The editor is clever enough to find statement boundaries automatically to run complete statements.
- Place your cursor in the statement you want to run and press
cmd/ctrl+enter. This will only run this single statement (and hence only show a single result set).
Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂