Sweet Chilly Philly Sweet Chilly Philly - 1 year ago 106
MySQL Question

MY SQL Workbench: Default ORDER BY

I have looked around and can't find an answer to this.

I was wondering if there is a way in MY SQL Workbench where you can add a default

to every query?

I am looking to

For example when I 'Right Click' on my table schema and say 'Select Rows' the resulting query is:

SELECT * FROM payments

I would like it to be:


Answer Source

is there a way in MY SQL Workbench where you can add a default ORDER BY to every query?


What's more, result sets from SQL queries present their rows in a formally unpredictable order in the absence of ORDER BY clauses sufficient to determine the order. A lot of people get tripped up by this: they assume that because a result set appeared in a certain order yesterday, it will appear in the same order today. It does until it doesn't. If a program relies on ordering when it isn't specified in an ORDER BY clause, well, see Murphy's Law.

Ditto for software versions. People sometimes mistakenly believe it's a defect in a new version of a RDMS server like MySQL when it presents results in a different order from the preceding version. It isn't.

This can help performance. Ordering can be a time- and space- hog of an operation. When the query planner knows it doesn't have to order rows in a result set, it can just present them in whatever order it finds them.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download