I have several queries in the editor, each terminating with a semi-colon (I am teaching myself SQL and so in the editor is a mix of queries and notes like below):
SELECT *
FROM orders
WHERE order_date >= '2019-01-01';
— AND operator
SELECT *
FROM customers
WHERE birth_date > '1990-01-01' AND points > 1000;
— OR operator
SELECT *
FROM customers
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
SELECT *
FROM order_items
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.
Thanks!
Best Answer
You have actually 3 possibilities to run the queries:
cmd/ctrl+shift+enter
to execute (cmd
on macOS, otherwisectrl
).cmd/ctrl+enter
. This will only run this single statement (and hence only show a single result set).